- const int nbSpheres = 10;
- Sphere* shperes = this->createSpheres(10);
-
- // Copie les spheres dans la constant memory.
+ Sphere* spheres = this->createSpheres(NB_SPHERES);
+ cout << "sizeof(Sphere): " << sizeof(Sphere) << endl;
+ cout << "Nb of spheres: " << NB_SPHERES << endl;
+ cout << "sizeof(spheres): " << NB_SPHERES * sizeof(Sphere) << endl;
+ cout << "dg: " << this->dg.x << " x " << this->dg.y << endl;
+ cout << "db: " << this->db.x << " x " << this->db.y << endl;
+
+#if CURRENT_MEMORY_MODEL == MEMORY_MODEL_GLOBAL or CURRENT_MEMORY_MODEL == MEMORY_MODEL_SHARED
+ // Copie des spheres dans la global memory.
+ const size_t sizeSpheres = NB_SPHERES * sizeof(Sphere);
+ HANDLE_ERROR(cudaMalloc(&this->ptrDevSpheres, sizeSpheres));
+ HANDLE_ERROR(cudaMemcpy(this->ptrDevSpheres, spheres, sizeSpheres, cudaMemcpyHostToDevice));
+#elif CURRENT_MEMORY_MODEL == MEMORY_MODEL_CONSTANT
+ // Copie des spheres en constant memory.
+ ConstantMemoryLink cmSpheresLink = constantMemorySpheresLink();
+ Sphere* ptrDevConstSperes = (Sphere*)cmSpheresLink.ptrDevTab;
+ size_t sizeALL = cmSpheresLink.sizeAll;
+ HANDLE_ERROR(cudaMemcpy(ptrDevConstSperes, spheres, sizeALL, cudaMemcpyHostToDevice));
+#endif
+
+ cout << "sizeof(Sphere): " << sizeof(Sphere) << endl;