building with USER-CUDA on Mac OS X

Hello list,

does anyone here have experience with compiling a cuda enables LAMMPS
version under OSX? I have a machine with 10.7.5 (with FINK installed).
I installed the latest cuda 5.0.xx.

* To build lib/cuda I had to add '-m64' to the NVCC_FLAGS
* Building the main executable throws a redefinition of ‘struct
timespec_2’ error.

I've set prec_timer to 0 (as recommended for mac; lib/cuda does not
build when set to 1).
I did get it to build by adding #define _STRUCT_TIMESPEC just before
#include <ctime> in src/cuda_data.h (to suppress the redefinition in
/usr/include/sys/_structs.h)

This seems a bit hackish and is not mentioned either in the manual nor
ever mentioned on the mailing list (according to the archive search)

Daniel

P.S.: LAMMPS version "12 Aug 2013"

hello daniel,

Hello list,

does anyone here have experience with compiling a cuda enables LAMMPS
version under OSX? I have a machine with 10.7.5 (with FINK installed).
I installed the latest cuda 5.0.xx.

* To build lib/cuda I had to add '-m64' to the NVCC_FLAGS
* Building the main executable throws a redefinition of ‘struct
timespec_2’ error.

I've set prec_timer to 0 (as recommended for mac; lib/cuda does not
build when set to 1).
I did get it to build by adding #define _STRUCT_TIMESPEC just before
#include <ctime> in src/cuda_data.h (to suppress the redefinition in
/usr/include/sys/_structs.h)

This seems a bit hackish and is not mentioned either in the manual nor
ever mentioned on the mailing list (according to the archive search)

if i remember correctly, this was added as a workaround.
i've recently spent some time (pun intended) improving the internal
profiling facilities in LAMMPS and also experimented with
clock_gettime() which is recommended over gettimeofday(), particularly
since it offers (theoretically) a much higher resolution. however, i
found that its time measurements on modern CPUs are massively
inconsistent and often quite different from gettimeofday(). in
addition, clock_gettime() is not very portable and on linux even not
part of the standard c library but in a separate library -lrt.

exactly this lack of portability has led to the ugly workaround. a
much better solution would be to use a small (inline) wrapper function
that would work similar to MPI_Wtime() (or one could just use that
instead).

axel.

hi,

here is a small refactoring of the hires timer workaround that should
make it more portable and also allows turn it off on linux.

http://git.icms.temple.edu/git/?p=lammps-icms.git;a=commitdiff;h=a6ceede04a362b059fb56a868735b7853066669d

if that works and there are no objections, i'll forward it to steve.
just let me know.

ciao,
    axel.

Hi I am fine with that.

Christian