I’m having a really peculiar issue. I’m on ubuntu 16.04. The samples work fine - however if I have a cu file test.cu with the contents
#include <assert.h>
#include <cuda_runtime.h>
int main(int argc, char **argv) {
int *tmp = 0;
cudaMallocManaged(&tmp, 256);
assert(tmp);
cudaFree(tmp);
}
and compile it with
/usr/local/cuda-9.0/bin/nvcc -o test test.cu
and then run test I get
test: test.cu:7: int main(int, char**): Assertion `tmp’ failed.
Aborted (core dumped)
The allocation failed? What?
Ok so I rename the file to test.cpp and compile it, and run it – works FINE.
W T F? lol
So, the samples all build in .cu files, so what makes this different? I don’t get it.