Freddie Witherden <[email protected]> writes: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 20/10/2012 19:32, Andreas Kloeckner wrote: >> PyCUDA creates a temporary folder for each compiler invocation in >> a process-safe manner. Only the resulting binary is stored in the >> shared cache directory you found. The structure of this cache for >> PyCUDA is really simple--a hash of the file being compiled, with >> ".cubin" appended. Theoretically, two processes could race each >> other in writing the cache file, or a process could find the >> half-done write done by another process. Despite lots of use in MPI >> processes that would trigger conflicts exactly like this, I haven't >> yet run into an issue. > > Is the hash just based on the contents of the source module or does it > also include the compiler options? I have a couple of heterogeneous > systems with SM 1.3 and SM 2.0 cards and would like to be able to run > > python test.py --sm13 & > python test.py --sm20 &
Just checked, the code is actually smarter than I remembered: https://github.com/inducer/pycuda/blob/master/pycuda/compiler.py#L76 Platform bitness, compiler versions, options, and *preprocessed source* (i.e. include files) are actually part of the hash. > Would it be possible to initally create the .cubin file with a > process/thread dependent name and then move it into place (with its > final non-process dependent name). As moves are---within > reason---usually atomic this may mitigate the issue of one process > rewriting a .cubin file while another process is reading it. Ah, good idea. If you've got time for a patch, that'd be more than welcome. Andreas _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
