Compiling Eigen library with nvcc (CUDA)

前端 未结 3 1773
长发绾君心
长发绾君心 2020-12-17 02:45

I tried to compile following program (main.cu) with the nvcc (CUDA 5.0 RC):

#include 
#include 

int main( int argc, char**         


        
3条回答
  •  暖寄归人
    2020-12-17 03:23

    Starting with Eigen 3.3, nvcc (7.5) succeeds in passing Eigen code to cl (MSVC 2013) (almost?) correctly. For example, the following code produces only 11 warnings:

    #include 
    #include 
    
    int main()
    {
        std::cout << "Hello Eigen\t";
        std::cout << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << "\n";
        std::cout << "Hello nvcc\t";
        std::cout << __CUDACC_VER_MAJOR__ << "." << __CUDACC_VER_MINOR__ << "." << __CUDACC_VER_BUILD__ << "\n";
        return 0;
    }
    

    Output as expected (Eigen 3.3rc1):

    Hello Eigen 3.2.94
    Hello nvcc 7.5.17

    But a long list of warnings (see post history if you actually want to see them).

    Update:

    Unfortunately, using CUDA 8.0 & VS2015 (with both Eigen 3.2.9 & Eigen 3.3rc1) results in compilation errors again:

    "operator=" has already been declared in the current scope eigen\src\Core\Block.h 111
    "operator=" has already been declared in the current scope eigen\src\Core\Ref.h 89

    So close...

    Update 2:

    This has been fixed in commit 59db051 and is available by either using the development branch or waiting for v3.3 (or 3.3rc2) to actually come out.

提交回复
热议问题