Results 1 to 5 of 5

Thread: Getting "invalid device function" when compiling with device emulation

  1. #1
    Join Date
    Mar 2010
    Posts
    73

    Getting "invalid device function" when compiling with device emulation

    I am going to use CUDA with cmake (v 2.8) on my Mac OS . So far it was goign well at that time, I made a little sample just to try it out stated below.However when I moved on emulation mode, it is unable to get the CUDA kernel anymore and I the error message getting generated :

    Cuda error: kernel invocation: invalid device function .

    I don't know, if it's a issue with cmake or CUDA on my Mac..If you guys have anything related to this then let me know first !!!!!!!!!

  2. #2
    Join Date
    May 2006
    Posts
    976

    Getting "invalid device function" when compiling with device emulation

    It seems like this is a issue with the FindCUDA.cmake script that I maintained. There is a new cudartemu library that displayed up in 3.0 that I did not figured out and which you require to link against instead of the actual cudart. I will move ahead and update the FindCUDA.cmake script with this latest properties, but in the meantime, you can manage the library that CUDA_CUDART_LIBRARY indicates to from ccmake or from the cmake-gui. Just have it point to libcudartemu.dylib instead of libcudart.dylib.
    Searching the forums can help you to find your answers more quickly

  3. #3
    Join Date
    Oct 2004
    Posts
    1,342

    Re: Getting "invalid device function" when compiling with device emulation

    One more option is that you can be able to add the following components to your CMakeLists.txt file just before cuda_add_executable(test). I have checked this and it performs very well on my mac (OSX 10.5, CUDA 3.0, CMake 2.8.0). Just one thing should be remembered that this may not work with future versions of CUDA where emulation is properly and permanently removed.

    Code:
    if(CUDA_VERSION VERSION_GREATER "2.3")
      find_library_local_first(CUDA_CUDARTEMU_LIBRARY cudartemu "\"cudartemu\" library")
      if(CUDA_BUILD_EMULATION)
        set(CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
        if(APPLE)
         
          get_filename_component(_cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH)
          if(_cuda_path_to_cudart)
            list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
          endif()
        endif()
    
       
        if (CUDA_CUDA_LIBRARY)
          set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
        endif(CUDA_CUDA_LIBRARY)
    
        mark_as_advanced(
          CUDA_CUDARTEMU_LIBRARY
          )
      endif()
    endif()

  4. #4
    Join Date
    Mar 2010
    Posts
    73

    Re: Getting "invalid device function" when compiling with device emulation

    A lot of thanks for your prompt replies ! I frequently checked it and it seems to work. I am unable to get actually however why the emulation mode will be removed. Will you still be able to use emulation (maybe with an associated library) in upcoming CUDA versions? And one thing more, nvcc-gdb is not available for OSX currently in the library, so the only debugging option that I have is to use emulation, According to me .. What about you all ????

  5. #5
    Join Date
    Dec 2007
    Posts
    996

    Re: Getting "invalid device function" when compiling with device emulation

    I am not sure about the detailed explanation of the CUDA suggested product road map, so I am unable to give you such type of information when emulation mode will passed away.

    I also don't have any idea about cuda-gdb for Mac OSx , though I am aware that there are implementations of printf available for CUDA. I don't know right off hand where the code might be suggested, though. Well, May be it could help you somewhat to resolve the issue. You might try with a separate thread about the cuda-gdb for Mac on this forum then you can get more help from specialist guys .....

Similar Threads

  1. Replies: 5
    Last Post: 12-03-2012, 09:42 AM
  2. Replies: 4
    Last Post: 12-02-2011, 07:10 AM
  3. Replies: 4
    Last Post: 07-04-2010, 03:10 PM
  4. "Unknown Base System Device" in Device Manager
    By Ameeryan in forum Hardware Peripherals
    Replies: 3
    Last Post: 22-12-2009, 10:00 PM
  5. ACPI error and "unkown device" in Device Manager
    By HAYES in forum Vista Hardware Devices
    Replies: 2
    Last Post: 05-02-2008, 12:33 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,296,522.62401 seconds with 17 queries