On Mon, 4 Apr 2011 19:10:33 +0200, "Bergtholdt, Martin" <martin.bergtho...@philips.com> wrote: > Hi Andreas, > > I managed to build PyCuda under Windows-7 Visual Studio 9.0 2008 > 64-bit. In general I faced this problem: > > PyCuda code seems to assume that a (unsigned) long is 64-bit under a > 64-bit architecture. This is not the case for msvc-64. Neither is an > int/unsigned int, they are all 32-bit. Only (unsigned) long long is > 64-bit. > > In the patch that I attached I used size_t for all instances of > unsigned int and unsigned long where a size type was involved. The > standard library under windows at least uses 32-bit unsigned int and > 64-bit unsigned int for win32 and win64 respectively. I'm not sure if > this is portable to Mac and Linux. > > I also added some explicit type casts to get rid of remaining warnings > where it seemed appropriate. > > The result is: code compiles without warning under Visual Studio 2008 > in 32 and 64 bit version. You might still want to check that I was > not overzealous.
I've looked over your patch, most of what you did seems reasonable to me. I did however factor out your hash function type patches into one conditional typedef that simply fixes a hash type before hand, to avoid duplicating code. After a few really minor syntax fixes (gcc doesn't seem to like multi-word constructor-style casts), e.g. 'unsigned int(5)', everything compiles and works on Linux as well. > I still get a warning at link time, but this seems unimportant: > > wrap_cudadrv.obj : warning LNK4197: export 'init_driver' specified multiple > times; using first specification > Creating library build\temp.win-amd64-2.7\Release\src/cpp\_driver.lib and > object build\temp.win-amd64-2.7\Release\src/cpp\_driver.exp > C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\x64\mt.exe -nologo > -manifest build\temp.win-amd64-2.7\Release\src/cpp\_driver.pyd.manifest > -outputresource:build\lib.win-amd64-2.7\pycuda\_driver.pyd;2 > building '_pvt_struct' extension > C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c > /nologo /Ox /MD /W3 /GS- /DNDEBUG -Id:\Python27\include -Id:\Python27\PC > /Tcsrc/wrapper/_pycuda_struct.c > /Fobuild\temp.win-amd64-2.7\Release\src/wrapper/_pycuda_struct.obj > _pycuda_struct.c > C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL > /nologo /INCREMENTAL:NO /LIBPATH:d:\Python27\libs > /LIBPATH:d:\Python27\PCbuild\amd64 /EXPORT:init_pvt_struct > build\temp.win-amd64-2.7\Release\src/wrapper/_pycuda_struct.obj > /OUT:build\lib.win-amd64-2.7\pycuda\_pvt_struct.pyd > /IMPLIB:build\temp.win-amd64-2.7\Release\src/wrapper\_pvt_struct.lib > /MANIFESTFILE:build\temp.win-amd64-2.7\Release\src/wrapper\_pvt_struct.pyd.manifest > _pycuda_struct.obj : warning LNK4197: export 'init_pvt_struct' specified > multiple times; using first specification > Creating library > build\temp.win-amd64-2.7\Release\src/wrapper\_pvt_struct.lib and object > build\temp.win-amd64-2.7\Release\src/wrapper\_pvt_struct.exp > C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\x64\mt.exe -nologo > -manifest > build\temp.win-amd64-2.7\Release\src/wrapper\_pvt_struct.pyd.manifest > -outputresource:build\lib.win-amd64-2.7\pycuda\_pvt_struct.pyd;2 They only occur once in the source, so I'm guessing this the result of something Python does to find module init functions. I agree that these are likely harmless. I've merged your patch. Thanks for your contribution! Can you please confirm that current git works for you out of the box? Andreas
pgpDHFOZKMASm.pgp
Description: PGP signature
_______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda