Re: Compiling NAMD for CUDA

From: Thomas Albers (talbers_at_binghamton.edu)
Date: Sat Jun 11 2011 - 21:53:56 CDT

Hello Axel!

>> I am trying to compile NAMD with CUDA support, so far unsuccessfully.
>>
>> The system is a Gentoo Linux with recent kernel, gcc 4.4.5, NVIDIA
>> toolkit 2.3:
>
> cuda 2.x is not compatible with gcc-4.x
> you have to install gcc-3.x and trick nvcc
> into using that instead of gcc-4.x.
>
> on my fedora box i had the following set up.
>
> [akohlmey_at_fermi ~]$ ll -l !$
> ll -l /opt/gcc-34/bin/
> total 0
> lrwxrwxrwx 1 root root 22 2010-03-26 17:48 g++ -> ../../../usr/bin/g++34
> lrwxrwxrwx 1 root root 22 2010-03-26 17:48 gcc -> ../../../usr/bin/gcc34
>
> and then used:
>
> nvcc -ccbin /opt/gcc-34/bin

Turns out that gcc-4.3 is compatible with CUDA-2.3 as well. Actually,
nvcc has an option to tell it which compiler it should use. I have had
luck with adjusting arch/Linux-x86_64.cuda. This line does the trick:

CUDACC=$(CUDADIR)/bin/nvcc --compiler-bindir=/usr/bin/gcc-4.3.4 -O3
--maxrreg count 32 -arch sm_11 -Xcompiler "-m64" $(CUDA)

Thomas

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:24:04 CST