maesfahani / gpuocelot

Automatically exported from code.google.com/p/gpuocelot
0 stars 0 forks source link

In "emulated" mode printf always prints zero for any number #72

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. In file "configure.ocelot" set device to "emulated"
2. Compile and run the following hello world program

#include <cuda.h>
#include <stdio.h>

__global__
void
helloKernel(){
  if(threadIdx.x & 1 > 0){ //odd thread
    printf("Hello world, from odd thread %d\n", threadIdx.x);
  }else{
    printf("Hello world, from even thread %d\n", threadIdx.x);
  }
}

int
main(int argc, char* argv[]){
  dim3 grid(1,1);
  dim3 block(20,1);
  helloKernel<<<grid, block>>>();
  cudaDeviceReset(); //needed to flush printf cuda buffer
  return 0;
}

3. The printf always prints "0" for every number (I also tried to print 
constants and literals... same result) 

4. If I remove "emulated" from the device field and leave only "llvm" then the 
output is as expected

What version of the product are you using? On what operating system?
gpuocelot 2.1 build 1985
Debian Linux wheezy

Original issue reported on code.google.com by doctorn...@gmail.com on 23 Jul 2012 at 9:15

GoogleCodeExporter commented 8 years ago
Also reporting this issue on svn revision 2042 with device=emulated and cuda 
4.2.9.

When I downgraded cuda to 4.0.17 printf works correctly for me.

Original comment by amckinle...@googlemail.com on 31 Aug 2012 at 11:34