[gmx-users] Re: Build on OSX with 4.6beta1

Szilárd Páll szilard.pall at cbr.su.se
Wed Dec 5 02:29:16 CET 2012


Hi Carlo,

I think I know now what the problem is. The CUDA compiler, nvcc, uses a the
host compiler to compile CPU code which is generated as C++ and therefore,
a C++ compiler is needed. However, up until CUDA 5.0 nvcc did not recognize
the Intel C++ compiler (icpc) and it would only accept icc as host
compiler. As all host-compilers supported by nvcc happily compile C++ code
with the compiler that is normally used for C (gcc, icc), I decided to pass
the C compiler as host-compiler to nvcc. Although this has worked for a
bunch of gcc versions as well as icc 12/13 on Linux, for some strange
reason, in your case (and probably on Mac OS in general) this did not
result in correct linking.

I still can't tell whether what Roland's fix does is needed or we could do
it some other way.

Thanks for the information, a fix will be implemented for an upcoming beta.

Cheers,

--
Szilárd


On Tue, Dec 4, 2012 at 8:02 PM, Carlo Camilloni
<carlo.camilloni at gmail.com>wrote:

> Dear Szilárd,
>
> My cmake version in the 2.8.9. The error is
>
> Linking C shared library libgmx.dylib
> Undefined symbols for architecture x86_64:
>  "std::terminate()", referenced from:
>      do_memtest(unsigned int, int, int) in
> libgpu_utils.a(gpu_utils_generated_gpu_utils.cu.o)
>      memtestState::allocate(unsigned int) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
>  "typeinfo for int", referenced from:
>      memtestState::allocate(unsigned int) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
>  "___cxa_allocate_exception", referenced from:
>      memtestState::allocate(unsigned int) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
>  "___cxa_begin_catch", referenced from:
>      memtestState::allocate(unsigned int) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
>  "___cxa_end_catch", referenced from:
>      memtestState::allocate(unsigned int) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
>  "___cxa_throw", referenced from:
>      memtestState::allocate(unsigned int) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
>  "___gxx_personality_v0", referenced from:
>      Dwarf Exception Unwind Info (__eh_frame) in
> libgpu_utils.a(gpu_utils_generated_gpu_utils.cu.o)
>      Dwarf Exception Unwind Info (__eh_frame) in
> libgpu_utils.a(gpu_utils_generated_memtestG80_core.cu.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[2]: *** [src/gmxlib/libgmx.6.dylib] Error 1
> make[1]: *** [src/gmxlib/CMakeFiles/gmx.dir/all] Error 2
> make: *** [all] Error 2
>
> and is the same if I compile with clang/clang++
> or gcc-mp-4.7/g++-mp-4.7 (in order to get the openMP parallelisation that
> is not
> supported by clang) or gcc/g++ (compiling in the most simple fashion just
> with cmake ../ -DGMX_CPU_ACCELERATION=SSE4.1)
>
> the code compiled with the all the above compilers and the standard gcc
> for the nvcc part works and gives
> reproducible results on simple systems.
>
> again in all the above cases it is enough to change the c compiler to a
> c++ compiler
> in src/gmxlib/CMakeFiles/gmx.dir/link.txt
>
> Best,
> Carlo
>
>
>
> >
> > Message: 1
> > Date: Mon, 3 Dec 2012 16:10:11 +0100
> > From: Szil?rd P?ll <szilard.pall at cbr.su.se>
> > Subject: Re: [gmx-users] Build on OSX with 4.6beta1
> > To: Discussion list for GROMACS users <gmx-users at gromacs.org>
> > Message-ID:
> >    <CANnYEw5qX6mrVvnON0jj_-9YnnVX9b5VGh3g2G0_UgK-ig8gCQ at mail.gmail.com>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > Hi,
> >
> > I think this happens either because you have cmake 2.8.10 and the
> > host-compiler gets double-set or because something gets messed up when
> you
> > use clang/clang++ with gcc as the CUDA host-compiler. Could you provide
> the
> > exact error output you are getting as well as cmake invocation? As I
> don't
> > have access to such a machine myself, I'll need some help with figuring
> out
> > what exactly is causing the trouble.
> >
> > Btw, the CUDA Mac OS X user guide states that you need to use "The gcc
> > compiler and toolchain installed using Xcode" (
> >
> http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/index.html
> > ).
> >
> > Note that on Intel CPUs, when running on a single node, you'll get much
> > better performance (up to +30%!) if you use only OpenMP-based
> > parallelization - which is the default with up to 16 threads (on Intel).
> >
> > Cheers,
> > --
> > Szilárd
> >
> >
> > On Fri, Nov 30, 2012 at 11:01 AM, Carlo Camilloni <
> carlo.camilloni at gmail.com
> >> wrote:
> >
> >> Dear All,
> >>
> >> I have successfully compiled the beta1 of gromacs 4.6 on my macbook pro
> >> with mountain lion.
> >> I used the latest cuda and the clang/clang++ compilers in order to have
> >> access to the AVX instructions.
> >> mdrun works with great performances!! great job!
> >>
> >> two things:
> >>
> >> 1. the compilation was easy but not straightforward:
> >> cmake ../ -DGMX_GPU=ON
> >> -DCMAKE_INSTALL_PREFIX=/Users/carlo/Codes/gromacs-4.6/build-gpu
> >> -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang
> >> -DCUDA_NVCC_HOST_COMPILER=/usr/bin/gcc -DCUDA_PROPAGATE_HOST_FLAGS=OFF
> >>
> >> and then I had to manually edit
> >> src/gmxlib/CMakeFiles/gmx.dir/link.txt
> >>
> >> and change clang to clang++
> >> (I noted that in many other places it was correctly set, and without
> this
> >> change I got an error on some c++ related stuff)
> >>
> >> 2. is there any way to have openmp parallelisation on osx?
> >>
> >> Best,
> >> Carlo
> >>
> >>
> >> --
> >> gmx-users mailing list    gmx-users at gromacs.org
> >> http://lists.gromacs.org/mailman/listinfo/gmx-users
> >> * Please search the archive at
> >> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> >> * Please don't post (un)subscribe requests to the list. Use the
> >> www interface or send it to gmx-users-request at gromacs.org.
> >> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> --
> gmx-users mailing list    gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> * Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>



More information about the gromacs.org_gmx-users mailing list