MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0010586 | CMake | Modules | public | 2010-04-21 05:16 | 2011-01-19 18:55 |
Reporter | MrNightLifeLover | ||||
Assigned To | James Bigler | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | OS Version | |||
Product Version | CMake-2-8 | ||||
Target Version | CMake-2-8 | Fixed in Version | CMake-2-8 | ||
Summary | 0010586: Emulation mode does not work when using cmake with CUDA 3.0 | ||||
Description | I'm trying to use CUDA with cmake (v 2.8) on my Mac (OSX 10.6). So far it works fine, I created a small sample just to try it out (see below). However when I switch on emulation mode, it cannot invoke the CUDA kernel anymore and I get the following error message: Cuda error: kernel invocation: invalid device function . I also tried to compile it by invoking nvcc by hand and didn't get the error message, so I think it could be a problem with cmake. I also tried the it on Linux (64bit) and ended up with the same result: It works when not using emulation mode, when I enable emulation mode I'm stuck with the same error. | ||||
Steps To Reproduce | |||||
Additional Information | Below the files CMakeLists.txt cmake_minimum_required(VERSION 2.8) project (test) find_package(CUDA) add_definitions(-Wall) # Use CUDA emulator? set(CUDA_BUILD_EMULATION ON) set(CUDA_64_BIT_DEVICE_CODE OFF) # Does not work on a Mac currently set(CMAKE_C_FLAGS -m32) set(CMAKE_CXX_FLAGS -m32) set(CUDA_VERBOSE_BUILD ON) include_directories("${PROJECT_BINARY_DIR}") cuda_add_executable(test test.cu ) test.cu #include <cuda.h> #include <stdlib.h> #include <stdio.h> #include "test_kernel.cu" void checkCUDAError(const char *msg); int main( int argc, const char** argv ) { int n = 3; float* a_h; a_h = (float *)malloc(sizeof(float)*n); float* a_d; cudaMalloc((void**) &a_d, sizeof(float)*n); hello<<<1,128>>>(a_d, n); checkCUDAError("kernel invocation"); checkCUDAError("memcpy"); free(a_h); cudaFree(a_d); return 0; } void checkCUDAError(const char *msg) { cudaError_t err = cudaGetLastError(); if( cudaSuccess != err) { fprintf(stderr, "Cuda error: %s: %s.\n", msg, cudaGetErrorString( err) ); exit(EXIT_FAILURE); } } test_kernel.cu #include <stdio.h> __global__ void hello(float*a, int i) { int j = i+1; #ifdef _DEVICEEMU printf("Hello.\n"); #endif } | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2010-04-21 05:16 | MrNightLifeLover | New Issue | |||
2011-01-17 15:48 | David Cole | Assigned To | => James Bigler | ||
2011-01-17 15:48 | David Cole | Status | new => assigned | ||
2011-01-17 15:49 | David Cole | Note Added: 0024807 | |||
2011-01-19 17:34 | James Bigler | Note Added: 0024935 | |||
2011-01-19 17:35 | James Bigler | Note Added: 0024936 | |||
2011-01-19 17:35 | James Bigler | Status | assigned => closed | ||
2011-01-19 17:35 | James Bigler | Resolution | open => fixed | ||
2011-01-19 18:55 | David Cole | Fixed in Version | => CMake-2-8 | ||
2011-01-19 18:55 | David Cole | Target Version | => CMake-2-8 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|