compiling lib/gpu

Hi,

when compiling lib/gpu on a Mac OS 10.6.7, I encountered the following error:

pair_gpu_build_kernel.cu(32): error: calling a __device__ function("tex1Dfetch") from a __host__ function("fetch_pos") is not allowed

When I modified the function fetch_pos with the __device__ modifier, the error was eliminated with this file; but similar errors showed up with other .cu files. So I guess there might be something wrong with the setting on my local machine. How can I resolve this issue?

FYI, I'm using CUDA Toolkit 4.0, compiling with SINGLE_SINGLE CUDA precision, sm_1.1, and -m32; lib/gpu from lammps 1 July 2011. Makefile.mac is attached though I thought it is not the same as distributed, and the path to cuda home is correct for my machine.

Any suggestions are appreciated. Thanks in advance,

-Trung

Makefile.mac (1.75 KB)

Hi,

when compiling lib/gpu on a Mac OS 10.6.7, I encountered the following
error:

pair_gpu_build_kernel.cu(32): error: calling a __device__
function("tex1Dfetch") from a __host__ function("fetch_pos") is not allowed

strange. i tried various permutations of settings on an x86_64 linux
machine trying to compile in 32-bit and 64-bit mode for -arch=sm_11
but i cannot reproduce this.

When I modified the function fetch_pos with the __device__ modifier, the
error was eliminated with this file; but similar errors showed up with other
.cu files. So I guess there might be something wrong with the setting on my
local machine. How can I resolve this issue?

it is hard to tell, where this is coming from. i would suspect
some preprocessor magic bombed on your machine.

cheers,
    axel.

Hi Trung,

This is a problem with the library on macs for cuda 4 that I need to fix. In the meantime, you can edit lib/gpu/geryon/ucl_nv_kernel.h:

Change:

#ifndef __inline
#define __inline static __inline__ __device__
#endif

to be:

#define __inline static __inline__ __device__

- Mike

Hi Mike,

thanks for the workaround. lib/gpu compiles successfully now.

Btw, I noticed that on my Mac machine __inline was defined in /usr/include/sys/cdefs.h:94, causing the #define preprocessor following #ifndef __inline in lib/gpu/geryon/ucl_nv_kernel.h disregarded.

-Trung

Quoting "Brown, W. Michael" <[email protected]...>: