- fractalMandelbrot<<<dg,db>>>(ptrDevPixels, this->w, this->h, domaineMath, static_cast<int>(this->n));\r
+\r
+ if (this->multiGPU)\r
+ {\r
+ HANDLE_ERROR(cudaSetDevice(0));\r
+ fractalMandelbrot<<<dg,db>>>(ptrDevPixels, this->w, 0, this->hFirstDevice, domaineMath, this->n);\r
+\r
+ const int nbDevice = Device::getDeviceCount();\r
+\r
+ // Rend chaque tranche par un GPU différent puis copie chaque tranche dans la mémoire du premier GPU.\r
+ #pragma omp parallel for\r
+ for (int i = 0; i < nbDevice - 1; ++i)\r
+ {\r
+ HANDLE_ERROR(cudaSetDevice(i + 1));\r
+ fractalMandelbrot<<<dg,db>>>(this->ptrDevPixelsMultGPU[i], this->w, i * this->hDevices + this->hFirstDevice, (i + 1) * this->hDevices + this->hFirstDevice, domaineMath, this->n);\r
+ HANDLE_ERROR(cudaMemcpy(ptrDevPixels + this->w * this->hFirstDevice + i * this->w * this->hDevices, this->ptrDevPixelsMultGPU[i], sizeof(uchar4) * this->w * this->hDevices, cudaMemcpyDeviceToDevice));\r
+ }\r
+\r
+ HANDLE_ERROR(cudaSetDevice(0));\r
+ }\r
+ else\r
+ {\r
+ fractalMandelbrot<<<dg,db>>>(ptrDevPixels, this->w, 0, this->h, domaineMath, this->n);\r
+ }\r