Detlef:
Yes, the code I posted was for debug porpuses, this is the current code:
float4 positions[m_spheresnum];
uint64_t seed = std::random_device{}() | std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 mt(seed);
std::gamma_distribution<float> dist_w(alpha,beta);
std::uniform_real_distribution<float> space_dist(0.0,1.0);
std::uniform_real_distribution<float> o_rad(0.0,8.0f); // origin-radius (2.0 meters max, cubic root of (8.0 meters))
float* pos = reinterpret_cast<float*>(m_buffers.position->map());
for(uint32_t i= 0, idx = 0; i<m_spheresnum; i++)
{
theta = 2.0 * M_PI * space_dist(mt);
phi = acos(1.0 - 2.0 * space_dist(mt));
r = std::cbrt(o_rad(mt));
x = r*sin(phi)*cos(theta);
y = r*sin(phi)*sin(theta);
z = r*cos(phi);
pos[idx++]= current_pos.x + x_offset + x;
pos[idx++]= current_pos.y + y_offset + y;
pos[idx++]= current_pos.z + z_offset + z;
pos[idx++]= rain_size_factor*dist_w(mt);
}
m_buffers.position->unmap();
}
I know that space_dist is used twice, I use it to calculate two different values(theta & phi).
Data type of uniform distributions is float.
I’m measuring the gpu performance with the nvidia smi, these are the results when the simulation is working properly:
019/07/15 14:25:45.863, Quadro M6000 24GB, P0, 24472 MiB, 3719 MiB, 3 %, 11 %
2019/07/15 14:25:46.864, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 3 %, 12 %
2019/07/15 14:25:47.865, Quadro M6000 24GB, P0, 24472 MiB, 3728 MiB, 3 %, 17 %
2019/07/15 14:25:48.866, Quadro M6000 24GB, P0, 24472 MiB, 3728 MiB, 1 %, 3 %
2019/07/15 14:25:49.867, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 3 %, 12 %
2019/07/15 14:25:50.868, Quadro M6000 24GB, P0, 24472 MiB, 3719 MiB, 3 %, 14 %
2019/07/15 14:25:51.869, Quadro M6000 24GB, P0, 24472 MiB, 3719 MiB, 2 %, 12 %
2019/07/15 14:25:52.870, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 1 %, 4 %
2019/07/15 14:25:53.872, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 2 %, 12 %
2019/07/15 14:25:54.873, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 2 %, 12 %
2019/07/15 14:25:55.874, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 2 %, 11 %
2019/07/15 14:26:21.903, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 8 %, 45 %
2019/07/15 14:26:22.904, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 8 %, 47 %
2019/07/15 14:26:23.906, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 8 %, 34 %
2019/07/15 14:26:24.907, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 5 %, 21 %
2019/07/15 14:26:25.908, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 7 %, 25 %
2019/07/15 14:26:26.909, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 4 %, 20 %
2019/07/15 14:26:27.910, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 6 %, 26 %
2019/07/15 14:26:28.911, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 2 %, 16 %
2019/07/15 14:26:29.913, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 5 %, 25 %
2019/07/15 14:26:30.914, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 1 %, 7 %
2019/07/15 14:26:31.927, Quadro M6000 24GB, P0, 24472 MiB, 3710 MiB, 5 %, 16 %
And these are the results when the issue is present:
2019/07/15 14:21:19.530, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 2 %, 7 %
2019/07/15 14:21:20.531, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 45 %
019/07/15 14:21:58.575, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 44 %
2019/07/15 14:21:59.576, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 46 %
2019/07/15 14:22:00.578, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 2 %, 25 %
2019/07/15 14:22:01.579, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 5 %, 15 %
2019/07/15 14:22:02.583, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 44 %
2019/07/15 14:22:03.585, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 45 %
2019/07/15 14:22:04.586, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 2 %, 21 %
019/07/15 14:22:45.631, Quadro M6000 24GB, P0, 24472 MiB, 3720 MiB, 11 %, 60 %
2019/07/15 14:22:46.632, Quadro M6000 24GB, P0, 24472 MiB, 3720 MiB, 11 %, 52 %
2019/07/15 14:22:47.633, Quadro M6000 24GB, P0, 24472 MiB, 3720 MiB, 10 %, 50 %
2019/07/15 14:22:48.635, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 10 %, 53 %
2019/07/15 14:22:49.636, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 50 %
2019/07/15 14:22:50.637, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 53 %
2019/07/15 14:22:51.638, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 53 %
2019/07/15 14:22:52.639, Quadro M6000 24GB, P0, 24472 MiB, 3711 MiB, 9 %, 48 %
As you can see, the gpu shows a considerable increase in work load when the issue appears, what do you think about this measures? Again, this occurs when a lot of frames have passed, when it starts, some frames looks great but the issue comes every two or three frames for the rest of the simulation.