quantumlib/qsim

Compile problem from source with cuda support

KardRi opened this issue · 0 comments

I am trying to compile qsimcirq with cuda support from source and also tried v0.19.0 release zip, since the precompiled version on pypi doesn't come with cuda. (gpu_mode=1 or 2 doesn't work)

Following the instructions here https://quantumai.google/qsim/tutorials/gcp_gpu, after pip install -v ., first I met cmake complaining about target_link_libraries should be all keyword or all plain. The conflict resolves by adding keyword (PUBLIC?) to FindCUDA.cmake (deprecated cmake module) or instead using findCUDAToolKit for all the CMakeList under pybind_interface folder.

CMake Error at pybind_interface/cuda/CMakeLists.txt:30 (target_link_libraries):
      The plain signature for target_link_libraries has already been used with
      the target "qsim_cuda".  All uses of target_link_libraries with a target
      must be either all-keyword or all-plain.

      The uses of the plain signature are here:

       * /usr/local/share/cmake-3.24/Modules/FindCUDA.cmake:1996 (target_link_libraries)

Next I encounter the error about the code itself and have no idea how to get rid of.

/home/user/qsim19/qsim-0.19.0/pybind_interface/cuda/pybind_main_cuda.cpp(30): error: no instance of constructor "qsim::StateSpaceCUDA<FP>::Parameter::Parameter [with FP=float]" matches the argument list
                argument types are: (unsigned int, unsigned int)
          ) : ss_params{num_state_threads, num_dblocks} {}
                       ^

    1 error detected in the compilation of "/home/user/qsim19/qsim-0.19.0/pybind_interface/cuda/pybind_main_cuda.cpp".

I am using Ubuntu 20.04, python 3.8/3.10, cuda 12.3, tried gcc11.1.0 or gcc9.4.0, cmake 3.27.9/3.24 on python venv, tried several configurations, all stucks here.

CUQUANTUM_ROOT is set to the python package ~/.local/lib/python3.8/site-packages/cuquantum/