The compiler chokes on the C++ coding that you pointed out. I'm not sure exactly how to handle it, maybe just convert it all to c syntax? For now I'll just commit out those lines and just work on trying to get something to compile.
Now are you saying the code should be, retval, WINAPI wine_cudaGetDeviceCount( int* count ){ return cudaGetDeviceCount( count ); }
or should it be
retval, WINAPI wine_cudaGetDeviceCount( int* count )
or
retval = WINAPI wine_cudaGetDeviceCount( int* count ){ return cudaGetDeviceCount( retval ); }
I've never used retval and going off of http://www.systhread.net/texts/200612retval.php , it seems that retval is as simple as returning the value from a function, so I set the input to equal retval then I can return the function ( retval) and it will have all the values right? Maybe I am miss understanding it.
On Mon, Jul 7, 2008 at 12:26 PM, Stefan Dösinger stefan@codeweavers.com wrote:
Actually you want something like
retval WINAPI wine_cudaSomething(int a, int etc)
so instead of the void use the return value the function is supposed to return
WINAPI tells the compiler about the calling convention(ie, first parameter on the stack, in ecx, or elsewhere, who takes care about cleaning up the stack, etc). You'll have to check the calling convention Win32 cuda uses, but most likely WINAPI is correct. You don't have to care about the Linux cuda calling convention, since the compiler knows about that from the Linux cuda headers
I am also not quite sure about some constructs, like
"wine_cudaBindTexture( size_t* offset, const struct texture < T, dim, readMode >& texRef, const void* devPtr, const struct cudaChannelFormatDesc& desc, size_t size = UINT_MAX )" As far as I know this contains C++ or Microsoft syntax, which is not valid in pure C.
Hi Seth,
Now are you saying the code should be, retval, WINAPI wine_cudaGetDeviceCount( int* count ){ return cudaGetDeviceCount( count ); }
or should it be
retval, WINAPI wine_cudaGetDeviceCount( int* count )
or
retval = WINAPI wine_cudaGetDeviceCount( int* count ){ return cudaGetDeviceCount( retval ); }
None of the above. retval was just a standin for a type declaration. I don't know what the proper return type is, but Google does: it's cudaError_t. So the proper declaration is likely to be:
cudaError_t WINAPI wine_cudaGetDeviceCount(int *count) { return cudaGetDeviceCount(count); }
--Juan
Ah ok, now I understand.
I am having a problem with the opengl section of it. It doesn't like GLuint . I've added the gl.h file to my list of headers as I thought maybe I needed the header to define it. But it still doesn't like it. Here are the errors, and one of the lines of code. I've googled it and GLuint is proper. It's just an unsigned int. It is also "c" code not c++, so I'm not sure what it is complaining about. Any ideas?
cudart.c:261: error: expected ')' before 'bufferObj' cudart.c:265: error: expected declaration specifiers or '...' before 'GLuint'
cudaError_t WINAPI wine_cudaGLRegisterBufferObject( GLuint bufferObj ){
Thanks
On Mon, Jul 7, 2008 at 1:21 PM, Juan Lang juan.lang@gmail.com wrote:
Hi Seth,
Now are you saying the code should be, retval, WINAPI wine_cudaGetDeviceCount( int* count ){ return cudaGetDeviceCount( count ); }
or should it be
retval, WINAPI wine_cudaGetDeviceCount( int* count )
or
retval = WINAPI wine_cudaGetDeviceCount( int* count ){ return cudaGetDeviceCount( retval ); }
None of the above. retval was just a standin for a type declaration. I don't know what the proper return type is, but Google does: it's cudaError_t. So the proper declaration is likely to be:
cudaError_t WINAPI wine_cudaGetDeviceCount(int *count) { return cudaGetDeviceCount(count); }
--Juan
On Mon, Jul 7, 2008 at 3:52 PM, Seth Shelnutt shelnutt2@gmail.com wrote:
Ah ok, now I understand.
I am having a problem with the opengl section of it. It doesn't like GLuint . I've added the gl.h file to my list of headers as I thought maybe I needed the header to define it. But it still doesn't like it. Here are the errors, and one of the lines of code. I've googled it and GLuint is proper. It's just an unsigned int. It is also "c" code not c++, so I'm not sure what it is complaining about. Any ideas?
cudart.c:261: error: expected ')' before 'bufferObj' cudart.c:265: error: expected declaration specifiers or '...' before 'GLuint'
Check the IMPORT variable in Makefile.in and see if everything you need is listed.
--John
cudart.c:261: error: expected ')' before 'bufferObj' cudart.c:265: error: expected declaration specifiers or '...' before 'GLuint'
cudaError_t WINAPI wine_cudaGLRegisterBufferObject( GLuint bufferObj ){
Check your includes again. GLuint is defined in <GL/gl.h> here. --Juan
I have #include <GL/gl.h>, maybe I do not have my makefile correct. I've attached the makefile, the cudart.c and all the nvidia header's need (14 of them) in one tar.bz2 file. Can someone check my makefile and all? I read through the nvidia license and it is ok to redistribute the headers.
On Mon, Jul 7, 2008 at 5:29 PM, Juan Lang juan.lang@gmail.com wrote:
cudart.c:261: error: expected ')' before 'bufferObj' cudart.c:265: error: expected declaration specifiers or '...' before 'GLuint'
cudaError_t WINAPI wine_cudaGLRegisterBufferObject( GLuint bufferObj ){
Check your includes again. GLuint is defined in <GL/gl.h> here. --Juan
I have #include <GL/gl.h>, maybe I do not have my makefile correct. I've attached the makefile, the cudart.c and all the nvidia header's need (14 of them) in one tar.bz2 file. Can someone check my makefile and all? I read through the nvidia license and it is ok to redistribute the headers.
Nothing to do with the makefile. Your includes are wrong. I changed your includes as follows: --- cudart.c.orig 2008-07-07 14:54:51.000000000 -0700 +++ cudart.c 2008-07-07 14:54:57.000000000 -0700 @@ -1,8 +1,9 @@ /*This is a wrapper for cudart.dll and libdudart.so.2.0*/
-#include <GL/gl.h> #include <stdlib.h> +#include <windows.h> +#include <GL/gl.h> #include <string.h> #include "cuda_runtime.h" #include "cuda_runtime_api.h" /*I am unsure if both these headers are needed, both do contain some of the functions*/
This gets a lot of the compile errors to go away, but not all of them. In several places you misspelled GLuint as GLUint. In the future please be more careful, discussing basic stuff like this gets a little tedious. --Juan
I apologise for the simple mistakes. But I only made those spelling errors after the fact and I was trying to get it working, I saw from google one forums post where the U was capitalised so I thought I'd try it, I just had forgot to put it back.
I have fixed all the error and now it doesn't complain about any errors with the file but I think my make file is not correct. After I fixed the paths to the linking library libcudart.so.2.0, now it is saying it that the linking isn't done.
gcc: /usr/local/cuda/lib/libcudart.so.2.0: linker input file unused because linking not done
Also after that I get an error about libcudart.so.2-LhAtfa.o is an empty file. What is that LhAtfa.o? Of course it is an empty file as far as I know that isn't a real file. What is it trying to link to?
Thanks,
Seth Shelnutt
On Mon, Jul 7, 2008 at 5:59 PM, Juan Lang juan.lang@gmail.com wrote:
I have #include <GL/gl.h>, maybe I do not have my makefile correct. I've attached the makefile, the cudart.c and all the nvidia header's need (14
of
them) in one tar.bz2 file. Can someone check my makefile and all? I read through the nvidia license and it is ok to redistribute the headers.
Nothing to do with the makefile. Your includes are wrong. I changed your includes as follows: --- cudart.c.orig 2008-07-07 14:54:51.000000000 -0700 +++ cudart.c 2008-07-07 14:54:57.000000000 -0700 @@ -1,8 +1,9 @@ /*This is a wrapper for cudart.dll and libdudart.so.2.0*/
-#include <GL/gl.h> #include <stdlib.h> +#include <windows.h> +#include <GL/gl.h> #include <string.h> #include "cuda_runtime.h" #include "cuda_runtime_api.h" /*I am unsure if both these headers are needed, both do contain some of the functions*/
This gets a lot of the compile errors to go away, but not all of them. In several places you misspelled GLuint as GLUint. In the future please be more careful, discussing basic stuff like this gets a little tedious. --Juan
I think I am using winemaker wrong. It does not give me a .res file as the winelib user's guide says I need, and the guide says I should be getting a Makefile.in and configure script. When I try to use it and link to the libcudart.so.2.0 file it acts like the target directory is libcudart.so.2.0
shelnutt@Ubuntu32-L:~/wine/patches/cuda$ winemaker --nosource-fix --dll -Ldir /usr/local/cuda/lib/ -library libcudart.so.2.0 error: the work directory, "libcudart.so.2.0", has already been specified (was "/usr/local/cuda/lib/")
I'm not sure if just the winelib guide is out of date, it says many of the parts are, or if I'm not understanding it right. I've also looked at the man page for winemaker and I guess I just don't get how to specify which files to link to.
I've spent the whole day reading different things and I'm just not sure why it is creating an empty file. I'm still getting the same error messages even when using winemaker correctly.
shelnutt@Ubuntu32-L:~/wine/patches/cuda$ make winegcc -shared cuda.dll.spec -mno-cygwin -o cuda.dll.so cudart.o /usr/local/cuda/lib/libcudart.so.2.0 -lodbc32 -lole32 -loleaut32 -lwinspool -luuid -lcudart gcc: /usr/local/cuda/lib/libcudart.so.2.0: linker input file unused because linking not done winebuild: libcudart.so.2-jP21n2.o is an empty file winegcc: winebuild failed make: *** [cuda.dll.so] Error 2
Can someone at least point me in the right direction? Google gives me nothing and I can't find anything about this. I know the linking part is just saying that there is no need to link in this file.
Now I thought it might be because I don't have a proper .res file as winemaker didn't set it up to build one. I used winebuild winebuild --dll -fPIC -o -spec -Ecuda.dll.spec
and now I the -spec file which has some interesting code but I have no clue what to do with it. I think I need to use wrc to compile a .res file but it wants a .res file as input.
My coding is good, now I'm just trying to figure out how to get wine to compile the damn thing.
shelnutt@Ubuntu32-L:~/wine/patches/cuda$ make winegcc -shared cuda.dll.spec -mno-cygwin -o cuda.dll.so cudart.o /usr/local/cuda/lib/libcudart.so.2.0 -lodbc32 -lole32 -loleaut32 -lwinspool -luuid -lcudart gcc: /usr/local/cuda/lib/libcudart.so.2.0: linker input file unused because linking not done winebuild: libcudart.so.2-jP21n2.o is an empty file winegcc: winebuild failed make: *** [cuda.dll.so] Error 2
Why do you need to link explicitly to libcudart.so.2.0? Try omitting that to see what happens. --Juan