glenco / lensed

forward reconstruction of lenses and sources from strong lensing observations
http://glenco.github.io/lensed/
MIT License
5 stars 3 forks source link

performance issues on Nvidia #189

Open ntessore opened 9 years ago

ntessore commented 9 years ago

Lensed is much slower on Nvidia GPUs (at least on Mac) than on the nominally less powerful Intel and AMD cards. With the basic profiling capabilities of #187, it should be possible to at least get an idea of where the time is spent on the individual platforms.

ntessore commented 9 years ago

After testing, it seems like the time spent in the individual OpenCL functions is the same as in the case with AMD/Intel GPUs, except a slight overhead for memory transfers (the AMD and Intel cards I tested on are integrated chips, and memory transfers are zero-cost).

Furthermore, I have found that the extra time is spent neither on the CPU nor on the GPU. The OpenCL implementation simply waits on a semaphore, uselessly, for no apparent reason. This happens when the blocking clEnqueueMapBuffer calls are made. Especially strange is that this also happens when there is nothing in the queue to block on.

Finally I tried rewriting to use the pinned memory as Nvidia does in their OpenCL SDK examples, using a fixed mapped memory segment and clEnqueue{Read|Write}Buffer from/to it. The same hang occurs. This is mysterious.