CUDA AND CGAL

Hello everybody!

I have got a serious problem with using of cudart and cgal libraries in the same project. I made a simple c++ project using qt creator under linux ubunut 12.04 had been installed on my laptop. The project contains next info:

INCLUDEPATH += /usr/local/cuda-5.0/include
/usr/include/CGAL
$$PWD/include

LIBS += -L/usr/local/lib -lGLU
-L/usr/local/cuda-5.0/lib -lcudart
-L$$PWD/libs/ -lCudaDevice
-L$$PWD/libs/ -lCudaSlice
-L/usr/lib -lCGAL

I had separetaly compiled libCudaDevice.so and libCudaSlice.so using Nsight Eclipse and attached them to Qt project. Everything worked fine until I attached libCGAL.so. The problem is that the parts of the application which use methods provided by libCudaDevice.so and libCudaSlice.so began to work incorectly when -L/usr/lib -lCGAL presented in the project. But when I comment -L/usr/lib -lCGAL --> #-L/usr/lib -lCGAL the programm began to work normaly.

I had surfed the net in order to find answer connected with my problem and found out I’m not the one who was in the same situation. Unfortunately there were not any reply which can explain whats is going on.

I hope you can help. I’ll be glad for any respond. Thank you in advance and sorry about my English.

here is related topic (there isn’t any reply either)
https://devtalk.nvidia.com/default/topic/465619/?comment=3309036

If you expect people to offer suggestions then you probably need a more precision description than “began to work incorrectly”. But it sounds unrelated to the link you posted, since that is about compilation failures whereas your problems only start when you link CGAL.

There are no compilation errors. The programm starts normaly but when I attaching CGAL lib the parts of application contain CUDA calls begin to work with errors. For example cudaGetDeviceCount returns zero instead of 1. But when I comment the string -L/usr/lib -lCGAL in the project profile cudaGetDeviceCount begin to work normaly, as any other cuda functions.
I had tested my project very carefully before created this post. As I said there were no compilation or linking errors.

Sound like some sort of symbol conflicts. Can you explore loading the shared CGAL library via dlopen()? Can you link CGAL as a static library?

Another tactic may be to load your application, as it is now, in GDB. Set a breakpoint at cudaGetDeviceCount(). Step through your code and see if it ever calls into CGAL. You won’t have the debug symbols for CUDA, but GDB should be able to map function pointers to shared libraries.

Hi.

I found out interesting fact. The problem depends on machine architecutre. I had compiled my project on another computer (PC Core 2 Duo, Linux Ubuntu, 2Gb RAM, 1 GB Video GeForce 9200 GT). So everything started normaly and could work together.
This problem connected with laptop architecture. Now I’m checking next ideas:

  1. It might be I have to recompile CUDA libriries for my laptop.
  2. Also the reason could be in order of include directories.
  3. May be it depens on optimus architecture… In this case I don’t know what to do.