gtcasl / gpuocelot

GPUOCelot: A dynamic compilation framework for PTX
http://gpuocelot.gatech.edu/
BSD 3-Clause "New" or "Revised" License
280 stars 69 forks source link

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

Open jwang323 opened 9 years ago

jwang323 commented 9 years ago

From doctorn...@gmail.com on July 23, 2012 17:15:56

What steps will reproduce the problem? 1. In file "configure.ocelot" set device to "emulated"

  1. Compile and run the following hello world program

include

include

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; }

  1. The printf always prints "0" for every number (I also tried to print constants and literals... same result)
  2. 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: http://code.google.com/p/gpuocelot/issues/detail?id=72

jwang323 commented 9 years ago

From amckinle...@googlemail.com on August 31, 2012 04:34:09

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.