Page 1 of 1

Unable to recompile magma 1.2.1

Posted: Tue Aug 13, 2013 12:15 pm
by adrianor
Hi,

I have been unable to recompile magma-1.2.1 from the original installation I had. Everything started with the automatic shutdown of the workstation. Once reinitiated, someone installed cuda 5.5. Now we have 3 versions of CUDA: CUDA, CUDA-4.5 and CUDA-5.5 in /usr/local. For some reason, when I tried to recompile my former program that uses magma it failed with the warning:

============================================================================================
cc -I/usr/local/cuda/include -I/home/jivifair/src/magma-1.2.1/include -c -o fortran.o /usr/local/cuda/src/fortran.c
In file included from /usr/local/cuda/src/fortran.c:67:
/usr/local/cuda/src/fortran_common.h:405:2: error: #error unsupported Fortran compiler
make: *** [fortran.o] Error 1
============================================================================================

So I made 'make clean' in /home/jivifair/src/magma-1.2.1 and tried to recompile magma from here using again 'make'.
When I do it, everything seems to work fine except this step:
============================================================================================
.......
.......
make[2]: Leaving directory `/home/jivifair/src/magma-1.2.1/testing/lin'
gcc -O3 -DADD_ -DHAVE_CUBLAS -DGPUSHMEM=130 -I/usr/local/cuda/include -I../include -I../control -c testing_zgemm.cpp -o testing_zgemm.o
gcc -fPIC -Xlinker -zmuldefs -DGPUSHMEM=130 testing_zgemm.o -o testing_zgemm \
lin/liblapacktest.a -L../lib -lmagma -lmagmablas -lmagma \
-L/usr/lib64/atlas -L/usr/local/cuda/lib64 \
-lf77blas -llapack -latlas -lcblas -lcublas -lm
../lib/libmagma.a(auxiliary.o): In function `printout_devices':
auxiliary.cpp:(.text+0x242): undefined reference to `cudaGetDeviceCount'
auxiliary.cpp:(.text+0x299): undefined reference to `cudaGetDeviceProperties'
../lib/libmagma.a(auxiliary.o): In function `magma_num_gpus':
auxiliary.cpp:(.text+0x318): undefined reference to `cudaGetDeviceCount'
../lib/libmagma.a(auxiliary.o): In function `magma_is_devptr':
auxiliary.cpp:(.text+0x3e4): undefined reference to `cudaGetDevice'
auxiliary.cpp:(.text+0x3f7): undefined reference to `cudaGetDeviceProperties'
auxiliary.cpp:(.text+0x400): undefined reference to `cudaGetLastError'
auxiliary.cpp:(.text+0x429): undefined reference to `cudaPointerGetAttributes'
auxiliary.cpp:(.text+0x446): undefined reference to `cudaGetLastError'
../lib/libmagma.a(timer.o): In function `get_current_time':
timer.cpp:(.text+0x65): undefined reference to `cudaDeviceSynchronize'
../lib/libmagma.a(zset_get.o): In function `magma_zcopymatrix_async':
zset_get.cpp:(.text+0x3a): undefined reference to `cudaMemcpy2DAsync'
../lib/libmagma.a(zset_get.o): In function `magma_zcopymatrix':
zset_get.cpp:(.text+0x8f): undefined reference to `cudaMemcpy2D'
../lib/libmagma.a(alloc.o): In function `magma_free_pinned':
alloc.cpp:(.text+0x2): undefined reference to `cudaFreeHost'
../lib/libmagma.a(alloc.o): In function `magma_malloc_pinned':
alloc.cpp:(.text+0x35): undefined reference to `cudaMallocHost'
../lib/libmagma.a(alloc.o): In function `magma_free':
alloc.cpp:(.text+0x82): undefined reference to `cudaFree'
../lib/libmagma.a(alloc.o): In function `magma_malloc':
alloc.cpp:(.text+0xb5): undefined reference to `cudaMalloc'
../lib/libmagma.a(error.o): In function `magma_xerror(cudaError, char const*, char const*, int)':
error.cpp:(.text+0x3c7): undefined reference to `cudaGetErrorString'
collect2: ld returned 1 exit status
make[1]: *** [testing_zgemm] Error 1
make[1]: Leaving directory `/home/jivifair/src/magma-1.2.1/testing'
make: *** [test] Error 2
============================================================================================

My make.inc is the following:

============================================================================================
#//////////////////////////////////////////////////////////////////////////////
# -- MAGMA (version 1.2.1) --
# Univ. of Tennessee, Knoxville
# Univ. of California, Berkeley
# Univ. of Colorado, Denver
# June 2012
#//////////////////////////////////////////////////////////////////////////////

#
# GPU_TARGET specifies for which GPU you want to compile MAGMA:
# "Tesla" (NVIDIA compute capability 1.x cards)
# "Fermi" (NVIDIA compute capability 2.x cards)
# See http://developer.nvidia.com/cuda-gpus

GPU_TARGET = Tesla

CC = gcc
NVCC = nvcc
FORT = gfortran

ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib

OPTS = -O3 -DADD_
F77OPTS = -O3 -DADD_
FOPTS = -O3 -DADD_ -x f95-cpp-input
NVOPTS = -O3 -DADD_ --compiler-options -fno-strict-aliasing -DUNIX
LDOPTS = -fPIC -Xlinker -zmuldefs

#LIB = -lf77blas -latlas -lcblas -lf2c -lcublas -lm
LIB = -lf77blas -llapack -latlas -lcblas -lcublas -lm

CUDADIR = /usr/local/cuda

LIBDIR = -L/usr/lib64/atlas -L$(CUDADIR)/lib64
INC = -I$(CUDADIR)/include
============================================================================================

Is it an interference with the cuda-5.5? How can I fix this bug and reinstall again magma?

Thanks in advance,
Adrian O.

Re: Unable to recompile magma 1.2.1

Posted: Tue Aug 13, 2013 5:03 pm
by mgates3
The "#error unsupported Fortran compiler" comes from trying to compile CUDA's file /usr/local/cuda/src/fortran.c without -DCUBLAS_GFORTRAN. You can add that to OPTS. In the new magma release, it is added to OPTS in testing/Makefile, for only that fortran.c file.

I'm not sure about the other error. When you make clean, can you verify that the library and all object files really are deleted? E.g., this should not find any files:

magma> ls -l lib/*.a lib/*.so
magma> ls -l */*.o */*.cu_o

magma-1.2.1 is somewhat old, so you may consider upgrading. The new magma-1.4.0 release is imminent.
-mark

Re: Unable to recompile magma 1.2.1

Posted: Tue Aug 13, 2013 8:41 pm
by adrianor
Hi mark,

indeed,
==========================================
[jivifair@titan-gpu magma-1.2.1]$ ls -l lib/*.a lib/*.so
ls: lib/*.a: No such file or directory
ls: lib/*.so: No such file or directory

[jivifair@titan-gpu magma-1.2.1]$ ls -l */*.o */*.cu_o
ls: */*.o: No such file or directory
ls: */*.cu_o: No such file or directory
==========================================
what really worries me is that once I do

[jivifair@titan-gpu magma-1.2.1]$ make

I got a bunch of errors, just to name a few:
alloc.cpp:(.text+0x82): undefined reference to `cudaFree'
alloc.cpp:(.text+0xb5): undefined reference to `cudaMalloc'

-Adrian

Re: Unable to recompile magma 1.2.1

Posted: Wed Aug 14, 2013 3:09 pm
by mgates3
Try adding the CUDA runtime library -lcudart to your LIB:

LIB = -lf77blas -llapack -latlas -lcblas -lcublas -lcudart -lm

Actually, I don't know how it compiled without that before.
On the other hand, MAGMA 1.4 was just released, so it's a nice time to upgrade.

-mark

Re: Unable to recompile magma 1.2.1

Posted: Thu Aug 15, 2013 12:30 pm
by adrianor
hi mark,

my gosh, I think it's working right now. I was able to compile, now I have to check it numerically,
thank you very much.
I will consider in the next few days to change the version.

As a way of feedback, why this worked (cudart)?

-Adrian

Re: Unable to recompile magma 1.2.1

Posted: Wed Aug 21, 2013 2:32 pm
by mgates3
cudaFree, cudaMalloc, etc. are in the cudart (runtime) library, so it is required. As I said, if you previously compiled without it, I don't know how that worked.
-mark