Browse Source

openmp tests

Nicolas Winkler 5 years ago
parent
commit
3be7d309c4
5 changed files with 9 additions and 30 deletions
  1. 0 18
      Almond.cpp
  2. 0 3
      Almond.h
  3. 1 1
      libmandel/src/CpuGenerators.cpp
  4. 7 7
      libmandel/src/CpuGeneratorsAVX.cpp
  5. 1 1
      libmandel/src/Mandel.cpp

+ 0 - 18
Almond.cpp

@@ -202,14 +202,6 @@ void Almond::on_chooseGenerator_clicked()
 }
 
 
-void Almond::on_selectPoint_clicked()
-{
-    if (currentView == MANDELBROT) {
-        emit this->mw->selectPoint();
-    }
-}
-
-
 void Almond::pointSelected(mnd::Real x, mnd::Real y)
 {
     if (currentView != JULIA) {
@@ -222,16 +214,6 @@ void Almond::pointSelected(mnd::Real x, mnd::Real y)
     currentView = JULIA;
 }
 
-void Almond::on_viewMandelbrot_clicked()
-{
-    if (currentView != MANDELBROT) {
-        //this->mw->setGenerator(mandelGeneratorSave);
-        this->mw->setViewport(mandelViewSave);
-        this->mw->getMandelInfo().julia = false;
-        this->mw->clearAll();
-        currentView = MANDELBROT;
-    }
-}
 
 void Almond::on_groupBox_toggled(bool arg1)
 {

+ 0 - 3
Almond.h

@@ -71,11 +71,8 @@ private slots:
 
     void backgroundTaskFinished();
 
-    void on_selectPoint_clicked();
     void pointSelected(mnd::Real x, mnd::Real y);
 
-    void on_viewMandelbrot_clicked();
-
     void on_wMandel_toggled(bool checked);
 
     void on_groupBox_toggled(bool arg1);

+ 1 - 1
libmandel/src/CpuGenerators.cpp

@@ -102,7 +102,7 @@ void CpuGenerator<T, mnd::NONE, parallel>::generate(const mnd::MandelInfo& info,
                 }
             }
             else
-                data[i + j * info.bWidth] = k;
+                data[i + j * info.bWidth] = float(k);
         }
     }
 }

+ 7 - 7
libmandel/src/CpuGeneratorsAVX.cpp

@@ -38,7 +38,7 @@ void CpuGenerator<float, mnd::X86_AVX, parallel>::generate(const mnd::MandelInfo
 
     if constexpr(parallel)
         omp_set_num_threads(omp_get_num_procs());
-#pragma omp parallel for schedule(static, 1) if (parallel)
+#pragma omp parallel for schedule(static, 1) collapse(2) if (parallel)
     for (long j = 0; j < info.bHeight; j++) {
         T y = T(view.y) + T(j) * T(view.height / info.bHeight);
         __m256 ys = {y, y, y, y, y, y, y, y};
@@ -273,9 +273,9 @@ void CpuGenerator<double, mnd::X86_AVX, parallel>::generate(const mnd::MandelInf
             _mm256_store_pd(ftRes, counter);
             for (int k = 0; k < 4 && i + k < info.bWidth; k++) {
                 if (info.smooth)
-                    data[i + k + j * info.bWidth] = ftRes[k] <= 0 ? info.maxIter :
-                        ftRes[k] >= info.maxIter ? info.maxIter :
-                        ((float)ftRes[k]) + 1 - ::log(::log(resa[k] * resa[k] + resb[k] * resb[k]) / 2) / ::log(2.0f);
+                    data[i + k + j * info.bWidth] = ftRes[k] <= 0 ? float(info.maxIter) :
+                        ftRes[k] >= info.maxIter ? float(info.maxIter) :
+                        float(((float)ftRes[k]) + 1 - ::log(::log(resa[k] * resa[k] + resb[k] * resb[k]) / 2) / ::logf(2.0f));
                 else
                     data[i + k + j * info.bWidth] = ftRes[k] > 0 ? float(ftRes[k]) : info.maxIter;
             }
@@ -286,9 +286,9 @@ void CpuGenerator<double, mnd::X86_AVX, parallel>::generate(const mnd::MandelInf
             i += 4;
             for (int k = 0; k < 4 && i + k < info.bWidth; k++) {
                 if (info.smooth)
-                    data[i + k + j * info.bWidth] = ftRes[k] <= 0 ? info.maxIter :
-                        ftRes[k] >= info.maxIter ? info.maxIter :
-                        ((float)ftRes[k]) + 1 - ::log(::log(resa[k] * resa[k] + resb[k] * resb[k]) / 2) / ::log(2.0f);
+                    data[i + k + j * info.bWidth] = ftRes[k] <= 0 ? float(info.maxIter) :
+                        ftRes[k] >= info.maxIter ? float(info.maxIter) :
+                        float(((float)ftRes[k]) + 1 - ::log(::log(resa[k] * resa[k] + resb[k] * resb[k]) / 2) / ::logf(2.0f));
                 else
                     data[i + k + j * info.bWidth] = ftRes[k] > 0 ? float(ftRes[k]) : info.maxIter;
             }

+ 1 - 1
libmandel/src/Mandel.cpp

@@ -302,7 +302,7 @@ std::vector<std::unique_ptr<MandelDevice>> MandelContext::createDevices(void)
             try {
                 //md.generator128 = std::make_unique<ClGenerator128>(device);
             }
-            catch (const std::string& err) {
+            catch (const std::string& /*err*/) {
                 //fprintf(stderr, "error creating 128bit cl generator: %s\n", err.c_str());
             }