Menu

COMPUTE_API_BUFFER_TYPE()

2016-04-04
2018-05-15
  • Eric Johnson

    Eric Johnson - 2016-04-04

    I came across this problem after running 'make'. It seems that a series of problem starts with COMPUTE_API_BUFFER_TYPE() not being treated as an operator by the compiler nvcc. The system is Ubuntu and there was no problem with installing dependencies, installing nvidia_driver_ubuntu and running configure-cuda. The error info is attached in the end. I suppose I'm making some sinple mistakes, and just wonder if anyone else has run into the same problem. Thank you!

    Error info
    Head file related
    .cu file related

     
    • Eric Johnson

      Eric Johnson - 2016-04-04

      I just noticed the pictures attached may not show on this page. Please 'right click' and open in another tab. I'm sorry about this.

       
      • sandezi

        sandezi - 2016-04-07

        In file included from cocolib++/compute_api/compute_engine.h:25:0,
        from cocolib++/compute_api/compute_grid.h:25,
        from cocolib++/compute_api/compute_array.h:25,
        from cocolib++/compute_api/compute_array.cpp:24:
        cocolib++/compute_api/compute_buffer.h:58:14: error: expected type-specifier before ‘COMPUTE_API_BUFFER_TYPE’
        operator COMPUTE_API_BUFFER_TYPE();
        ^
        cocolib++/compute_api/compute_buffer.h:59:20: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
        operator const COMPUTE_API_BUFFER_TYPE() const;
        ^
        cocolib++/compute_api/compute_buffer.h:59:5: error: ‘operator const int’ does not name a type
        operator const COMPUTE_API_BUFFER_TYPE() const;
        ^
        cocolib++/compute_api/compute_buffer.h:62:5: error: ‘COMPUTE_API_BUFFER_TYPE’ does not name a type
        COMPUTE_API_BUFFER_TYPE _data;
        ^

        I met the same problem, and have no idea about this. Looking forward to your reply. Thanks!

         

        Last edit: sandezi 2016-04-07
  • Simão Marto

    Simão Marto - 2018-05-15

    That issue is probably caused because the driver isn't being detected. Replace the contents of ./config_tests/test_compute_capability.cu by the following:

    #include <iostream>
    using namespace std;
    
    #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
    inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
    {
       if (code != cudaSuccess) 
       {
          cout << "GPUassert: " << cudaGetErrorString(code) << " " << file << " " << line << endl;
          if (abort) exit(0);
       }
    }
    
    int main()
    {
      cudaDeviceProp deviceProp;
      gpuErrchk(cudaGetDeviceProperties(&deviceProp,0))
      cout << "  detected compute capability " << deviceProp.major << "." << deviceProp.minor << endl;
      return deviceProp.major * 10 + deviceProp.minor;
    }
    

    And then run configure-cuda.sh. In my case it said

    GPUassert: no CUDA-capable device is detected ./config_tests/test_compute_capability.cu 39
    

    I solved this by installing the nvidia driver manually. For more information check this answer

    Ignore everything I wrote bellow this line


    Hello. I had the exact same problem, and hacked together a solution. I went in to file compute_buffer.h, and added afterline 28 the following:

    typedef float* COMPUTE_API_BUFFER_TYPE;
    

    This allowed the make process to continue, but eventually I had an error (after a very long list of warnigns).:

    make[1]: Entering directory `/home/simao/Documents/cocolib-release-6/tools/parse_lfa_results'
    g++ -c -m64 -pipe -I../../cocolib -pipe -g -Wall -g -D_REENTRANT -Wall -W -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o obj/main.o main.cpp
    main.cpp: In function ‘int main(int, char**)’:
    main.cpp:247:38: error: too many arguments to function ‘herr_t H5Eset_auto1(H5E_auto1_t, void*)’
    /usr/include/H5Epublic.h:216:15: note: declared here
    make[1]: *** [obj/main.o] Error 1
    make[1]: Leaving directory `/home/simao/Documents/cocolib-release-6/tools/parse_lfa_results'
    make: *** [sub-tools-parse_lfa_results-make_default-ordered] Error 2
    

    I then tried to solve this by removing (without really knowing what I'm doing) the third parameter (a NULL) in the function call at main.cpp:247:38. I got a new and different error:

    cd examples/ && make -f Makefile 
    make[1]: Entering directory `/home/simao/Documents/cocolib-release-6/examples'
    g++ -c -m64 -pipe -I../cocolib -pipe -g -Wall -g -D_REENTRANT -Wall -W -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o obj/main.o main.cpp
    g++ -c -m64 -pipe -I../cocolib -pipe -g -Wall -g -D_REENTRANT -Wall -W -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o obj/config.o config.cpp
    config.cpp: In function ‘bool coco::init_config_data(coco::config_data*)’:
    config.cpp:622:15: error: ‘rand’ was not declared in this scope
    make[1]: *** [obj/config.o] Error 1
    make[1]: Leaving directory `/home/simao/Documents/cocolib-release-6/examples'
    make: *** [sub-examples-make_default-ordered] Error 2
    

    To try and solve this, I added after line 27 of config.h the following:
    #include <stdlib.h>

    I also deleted all .o files just in case.
    Unfortunately, this didn't put an end to my nightmare, and more exciting errors appeared. This time I got more than three thousand lines of errors, all about undefined references. Here's a small sample:

    ../cocolib/libcocolib.a(cuda_interface_cuda.obj): In function `__sti____cudaRegisterAll_49_tmpxft_0000513b_00000000_4_cuda_interface_cpp1_ii_1ebb158b':
    /tmp/tmpxft_0000513b_00000000-1_cuda_interface.cudafe1.stub.c:4: undefined reference to `__cudaRegisterFatBinary'
    ../cocolib/libcocolib.a(cuda_interface_cuda.obj): In function `coco::cuda_device_name(unsigned long)':
    /home/simao/Documents/cocolib-release-6/cocolib/cuda/cuda_interface.cu:45: undefined reference to `cudaGetDeviceProperties'
    ../cocolib/libcocolib.a(cuda_interface_cuda.obj): In function `coco::cuda_device_count()':
    /home/simao/Documents/cocolib-release-6/cocolib/cuda/cuda_interface.cu:36: undefined reference to `cudaGetDeviceCount'
    ../cocolib/libcocolib.a(cuda_interface_cuda.obj): In function `__cudaUnregisterBinaryUtil':
    /usr/include/crt/host_runtime.h:172: undefined reference to `__cudaUnregisterFatBinary'
    ../cocolib/libcocolib.a(cuda_interface_cuda.obj): In function `coco::cuda_set_device(unsigned long)':
    /home/simao/Documents/cocolib-release-6/cocolib/cuda/cuda_interface.cu:53: undefined reference to `cudaSetDevice'
    ../cocolib/libcocolib.a(tv_l2_cuda.obj): In function `__sti____cudaRegisterAll_40_tmpxft_00005860_00000000_4_tv_l2_cpp1_ii_c1e4d73a':
    /tmp/tmpxft_00005860_00000000-1_tv_l2.cudafe1.stub.c:4: undefined reference to `__cudaRegisterFatBinary'
    ../cocolib/libcocolib.a(tv_l2_cuda.obj): In function `coco::tv_l2_energy(coco::tv_l2_data*)':
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:192: undefined reference to `cudaMemcpy'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:193: undefined reference to `cudaMemcpy'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:194: undefined reference to `cudaThreadSynchronize'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:192: undefined reference to `cudaGetLastError'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:192: undefined reference to `cudaGetErrorString'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:194: undefined reference to `cudaGetLastError'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:194: undefined reference to `cudaGetErrorString'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:193: undefined reference to `cudaGetLastError'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:193: undefined reference to `cudaGetErrorString'
    ../cocolib/libcocolib.a(tv_l2_cuda.obj): In function `coco::tv_l2_get_dual_xi(coco::tv_l2_data*, std::vector<coco::gsl_matrix*, std::allocator<coco::gsl_matrix*> >&)':
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:178: undefined reference to `cudaThreadSynchronize'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:178: undefined reference to `cudaGetLastError'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:178: undefined reference to `cudaGetErrorString'
    ../cocolib/libcocolib.a(tv_l2_cuda.obj): In function `coco::tv_l2_get_solution(coco::tv_l2_data*, coco::gsl_matrix*)':
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:160: undefined reference to `cudaThreadSynchronize'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:160: undefined reference to `cudaGetLastError'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:160: undefined reference to `cudaGetErrorString'
    ../cocolib/libcocolib.a(tv_l2_cuda.obj): In function `coco::tv_l2_initialize(coco::tv_l2_data*, coco::gsl_matrix*)':
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:142: undefined reference to `cudaMemset'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:143: undefined reference to `cudaMemset'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:144: undefined reference to `cudaMemset'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:145: undefined reference to `cudaMemset'
    /home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:146: undefined reference to `cudaMemset'
    ../cocolib/libcocolib.a(tv_l2_cuda.obj):/home/simao/Documents/cocolib-release-6/cocolib/tv/tv_l2.cu:147: more undefined references to `cudaMemset' follow
    

    Now I have no idea what to do. Maybe all I've done so far only made it worse, who knows.

     

    Last edit: Simão Marto 2018-05-16

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.