MAGMA installation for mac 10.9 with NVIDIA GPU
MAGMA installation for mac 10.9 with NVIDIA GPU
Hi
Recently, I tried installing MAGMA on my mac OS 10.9, with NVIDIA GeForce GT 650M.
However, the installation failed.
I have few experience of installing libraries, so I really appreciate if you can help me.
The error says:
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [testing_z_cublas_v2] Error 1
make: *** [test] Error 2
This is what I did:
-- installed LAPACK, ATLAS, and CUDA.
-- downloaded magma-1.4.1
-- copy make.inc.atlas into make.inc
This is how I modified in make.inc:
-- provided path to libraries
-- deleted -DMAGMA_SETAFFINITY and -lgfortran -lifcore (but I don't know if I should do this..)
-- changed -L$(CUDADIR)/lib64 into -L$(CUDADIR)/lib
make.inc looks like:
OPTS = -O3 -DADD_ -fopenmp
F77OPTS = -O3 -DADD_
FOPTS = -O3 -DADD_ -x f95-cpp-input
NVOPTS = -O3 -DADD_ -Xcompiler -fno-strict-aliasing
LDOPTS = -fopenmp
LIB = -llapack -lf77blas -latlas -lcblas -lcublas -lcudart -lstdc++ -lm
LAPACKDIR ?= /Users/hiroki/Desktop/lapack-3.5.0
ATLASDIR ?= /usr/local/atlas
CUDADIR ?= /usr/local/cuda
-include make.check-atlas
-include make.check-cuda
LIBDIR = -L$(LAPACKDIR) \
-L$(ATLASDIR)/lib \
-L$(CUDADIR)/lib
INC = -I$(CUDADIR)/include
I researched about the error, but honestly, I don't really understand.
Any help is much appreciated.
Recently, I tried installing MAGMA on my mac OS 10.9, with NVIDIA GeForce GT 650M.
However, the installation failed.
I have few experience of installing libraries, so I really appreciate if you can help me.
The error says:
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [testing_z_cublas_v2] Error 1
make: *** [test] Error 2
This is what I did:
-- installed LAPACK, ATLAS, and CUDA.
-- downloaded magma-1.4.1
-- copy make.inc.atlas into make.inc
This is how I modified in make.inc:
-- provided path to libraries
-- deleted -DMAGMA_SETAFFINITY and -lgfortran -lifcore (but I don't know if I should do this..)
-- changed -L$(CUDADIR)/lib64 into -L$(CUDADIR)/lib
make.inc looks like:
OPTS = -O3 -DADD_ -fopenmp
F77OPTS = -O3 -DADD_
FOPTS = -O3 -DADD_ -x f95-cpp-input
NVOPTS = -O3 -DADD_ -Xcompiler -fno-strict-aliasing
LDOPTS = -fopenmp
LIB = -llapack -lf77blas -latlas -lcblas -lcublas -lcudart -lstdc++ -lm
LAPACKDIR ?= /Users/hiroki/Desktop/lapack-3.5.0
ATLASDIR ?= /usr/local/atlas
CUDADIR ?= /usr/local/cuda
-include make.check-atlas
-include make.check-cuda
LIBDIR = -L$(LAPACKDIR) \
-L$(ATLASDIR)/lib \
-L$(CUDADIR)/lib
INC = -I$(CUDADIR)/include
I researched about the error, but honestly, I don't really understand.
Any help is much appreciated.
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
It's okay to install LAPACK and ATLAS, but it is not needed. MacOS already comes with the BLAS and LAPACK in its Veclib (aka Accelerate) framework. See the make.inc.macos. Basically, add "-framework veclib" to LIB, instead of lapack, f77blas, cblas, and atlas.
MacOS supports both 32-bit and 64-bit binaries (and fat binaries that contain both). This error is saying it can't find some symbol (i.e. function) for 64-bit. So either you are missing some required library, or one of the libraries is 32-bit instead of 64-bit. Was there more to that error message, like *which* symbols it didn't find? That would tell what library it is missing. Or it should complain that a library is not for the architecture being linked if the library is 32-bit. CUDA and Veclib are both fat (32 and 64-bit), so you should be able to link either way.
HOWEVER, there is also a bug in Veclib that manifests itself in 64-bit, which causes some BLAS routines to return bad values. So I find it is easier to compile everything 32-bit, by adding -m32 to the various OPTS. See make.inc.macos.
-mark
MacOS supports both 32-bit and 64-bit binaries (and fat binaries that contain both). This error is saying it can't find some symbol (i.e. function) for 64-bit. So either you are missing some required library, or one of the libraries is 32-bit instead of 64-bit. Was there more to that error message, like *which* symbols it didn't find? That would tell what library it is missing. Or it should complain that a library is not for the architecture being linked if the library is 32-bit. CUDA and Veclib are both fat (32 and 64-bit), so you should be able to link either way.
HOWEVER, there is also a bug in Veclib that manifests itself in 64-bit, which causes some BLAS routines to return bad values. So I find it is easier to compile everything 32-bit, by adding -m32 to the various OPTS. See make.inc.macos.
-mark
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
Thank you for your quick reply Mark.
Okay, I understood that I can use make.inc.macos also.
But currently, I am still trying to use LAPACK and ATLAS.
I will try this way for a little bit more, and if this doesn't work, I will use make.inc.macos.
Yes there is a following error message in addition to "symbol(s) not found for architecture x86_64"
Undefined symbols for architecture x86_64:
"__gfortran_compare_string", referenced from:
_ilaenv_ in liblapack.a(ilaenv.o)
"__gfortran_st_write", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_st_write_done", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_stop_string", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_string_len_trim", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_transfer_character_write", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_transfer_integer_write", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"_cublasDzasum", referenced from:
_magma_dzasum in libmagma.a(blas_z.o)
"_cublasDznrm2", referenced from:
_magma_dznrm2 in libmagma.a(blas_z.o)
"_cublasIzamax", referenced from:
_magma_izamax in libmagma.a(blas_z.o)
"_cublasIzamin", referenced from:
_magma_izamin in libmagma.a(blas_z.o)
"_cublasSetKernelStream", referenced from:
_magmablasSetKernelStream in libmagma.a(stream.cu_o)
"_cublasZaxpy", referenced from:
_magma_zaxpy in libmagma.a(blas_z.o)
"_cublasZcopy", referenced from:
_magma_zcopy in libmagma.a(blas_z.o)
"_cublasZdotc", referenced from:
_magma_zdotc in libmagma.a(blas_z.o)
"_cublasZdotu", referenced from:
_magma_zdotu in libmagma.a(blas_z.o)
"_cublasZdrot", referenced from:
_magma_zdrot in libmagma.a(blas_z.o)
"_cublasZdscal", referenced from:
_magma_zdscal in libmagma.a(blas_z.o)
"_cublasZgemm", referenced from:
_magma_zgemm in libmagma.a(blas_z.o)
"_cublasZgemv", referenced from:
_magma_zgemv in libmagma.a(blas_z.o)
"_cublasZgerc", referenced from:
_magma_zgerc in libmagma.a(blas_z.o)
"_cublasZgeru", referenced from:
_magma_zgeru in libmagma.a(blas_z.o)
"_cublasZhemm", referenced from:
_magma_zhemm in libmagma.a(blas_z.o)
"_cublasZhemv", referenced from:
_magma_zhemv in libmagma.a(blas_z.o)
"_cublasZher", referenced from:
_magma_zher in libmagma.a(blas_z.o)
"_cublasZher2", referenced from:
_magma_zher2 in libmagma.a(blas_z.o)
"_cublasZher2k", referenced from:
_magma_zher2k in libmagma.a(blas_z.o)
"_cublasZherk", referenced from:
_magma_zherk in libmagma.a(blas_z.o)
"_cublasZrot", referenced from:
_magma_zrot in libmagma.a(blas_z.o)
"_cublasZscal", referenced from:
_magma_zscal in libmagma.a(blas_z.o)
"_cublasZswap", referenced from:
_magma_zswap in libmagma.a(blas_z.o)
"_cublasZsymm", referenced from:
_magma_zsymm in libmagma.a(blas_z.o)
"_cublasZsyr2k", referenced from:
_magma_zsyr2k in libmagma.a(blas_z.o)
"_cublasZsyrk", referenced from:
_magma_zsyrk in libmagma.a(blas_z.o)
"_cublasZtrmm", referenced from:
_magma_ztrmm in libmagma.a(blas_z.o)
"_cublasZtrmv", referenced from:
_magma_ztrmv in libmagma.a(blas_z.o)
"_cublasZtrsm", referenced from:
_magma_ztrsm in libmagma.a(blas_z.o)
"_cublasZtrsv", referenced from:
_magma_ztrsv in libmagma.a(blas_z.o)
Am I missing any libraries? or does this message say these functions above are only for 32 bits?
Okay, I understood that I can use make.inc.macos also.
But currently, I am still trying to use LAPACK and ATLAS.
I will try this way for a little bit more, and if this doesn't work, I will use make.inc.macos.
Yes there is a following error message in addition to "symbol(s) not found for architecture x86_64"
Undefined symbols for architecture x86_64:
"__gfortran_compare_string", referenced from:
_ilaenv_ in liblapack.a(ilaenv.o)
"__gfortran_st_write", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_st_write_done", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_stop_string", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_string_len_trim", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_transfer_character_write", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"__gfortran_transfer_integer_write", referenced from:
_xerbla_ in liblapack.a(xerbla.o)
"_cublasDzasum", referenced from:
_magma_dzasum in libmagma.a(blas_z.o)
"_cublasDznrm2", referenced from:
_magma_dznrm2 in libmagma.a(blas_z.o)
"_cublasIzamax", referenced from:
_magma_izamax in libmagma.a(blas_z.o)
"_cublasIzamin", referenced from:
_magma_izamin in libmagma.a(blas_z.o)
"_cublasSetKernelStream", referenced from:
_magmablasSetKernelStream in libmagma.a(stream.cu_o)
"_cublasZaxpy", referenced from:
_magma_zaxpy in libmagma.a(blas_z.o)
"_cublasZcopy", referenced from:
_magma_zcopy in libmagma.a(blas_z.o)
"_cublasZdotc", referenced from:
_magma_zdotc in libmagma.a(blas_z.o)
"_cublasZdotu", referenced from:
_magma_zdotu in libmagma.a(blas_z.o)
"_cublasZdrot", referenced from:
_magma_zdrot in libmagma.a(blas_z.o)
"_cublasZdscal", referenced from:
_magma_zdscal in libmagma.a(blas_z.o)
"_cublasZgemm", referenced from:
_magma_zgemm in libmagma.a(blas_z.o)
"_cublasZgemv", referenced from:
_magma_zgemv in libmagma.a(blas_z.o)
"_cublasZgerc", referenced from:
_magma_zgerc in libmagma.a(blas_z.o)
"_cublasZgeru", referenced from:
_magma_zgeru in libmagma.a(blas_z.o)
"_cublasZhemm", referenced from:
_magma_zhemm in libmagma.a(blas_z.o)
"_cublasZhemv", referenced from:
_magma_zhemv in libmagma.a(blas_z.o)
"_cublasZher", referenced from:
_magma_zher in libmagma.a(blas_z.o)
"_cublasZher2", referenced from:
_magma_zher2 in libmagma.a(blas_z.o)
"_cublasZher2k", referenced from:
_magma_zher2k in libmagma.a(blas_z.o)
"_cublasZherk", referenced from:
_magma_zherk in libmagma.a(blas_z.o)
"_cublasZrot", referenced from:
_magma_zrot in libmagma.a(blas_z.o)
"_cublasZscal", referenced from:
_magma_zscal in libmagma.a(blas_z.o)
"_cublasZswap", referenced from:
_magma_zswap in libmagma.a(blas_z.o)
"_cublasZsymm", referenced from:
_magma_zsymm in libmagma.a(blas_z.o)
"_cublasZsyr2k", referenced from:
_magma_zsyr2k in libmagma.a(blas_z.o)
"_cublasZsyrk", referenced from:
_magma_zsyrk in libmagma.a(blas_z.o)
"_cublasZtrmm", referenced from:
_magma_ztrmm in libmagma.a(blas_z.o)
"_cublasZtrmv", referenced from:
_magma_ztrmv in libmagma.a(blas_z.o)
"_cublasZtrsm", referenced from:
_magma_ztrsm in libmagma.a(blas_z.o)
"_cublasZtrsv", referenced from:
_magma_ztrsv in libmagma.a(blas_z.o)
Am I missing any libraries? or does this message say these functions above are only for 32 bits?
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
You need to add -lgfortran for __gfortran_compare_string, etc.
The _cublasDzasum, etc. should be in -lcublas, which provides both 32-bit and 64-bit versions. Unless you provided the wrong path to cuda, I don't know why that would not be found.
-mark
The _cublasDzasum, etc. should be in -lcublas, which provides both 32-bit and 64-bit versions. Unless you provided the wrong path to cuda, I don't know why that would not be found.
-mark
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
Thank you very much for your help, Mark.
Currently, I have this error:
ld: library not found for -lgfortran
I already installed gfortran.
I would like to know which version of gfortran is required for MAGMA.
Thank you
Currently, I have this error:
ld: library not found for -lgfortran
I already installed gfortran.
I would like to know which version of gfortran is required for MAGMA.
Thank you
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
Can you find the libgfortran.a or libgfortran.so library file? That's what -lgfortran refers to. If it isn't in a standard library path, you need to add its directory to LIBDIR in make.inc. For instance, if it was installed in
/mnt/gfortran/lib/libgfortran.a
then add that directory to LIBDIR, something like:
LIBDIR = -L$(MKLROOT)/lib/intel64 \
-L$(CUDADIR)/lib64 \
-L/mnt/gfortran/lib
MAGMA should work with any reasonably recent version of gfortran. That is, don't ask about a 10 year old version, but something even a couple years old should work.
Note it is not MAGMA that needs -lgfortran, but your LAPACK library that needs it. With Veclib, it is not needed.
-mark
/mnt/gfortran/lib/libgfortran.a
then add that directory to LIBDIR, something like:
LIBDIR = -L$(MKLROOT)/lib/intel64 \
-L$(CUDADIR)/lib64 \
-L/mnt/gfortran/lib
MAGMA should work with any reasonably recent version of gfortran. That is, don't ask about a 10 year old version, but something even a couple years old should work.
Note it is not MAGMA that needs -lgfortran, but your LAPACK library that needs it. With Veclib, it is not needed.
-mark
-
clintpatty
- Posts: 1
- Joined: Sat Sep 20, 2014 3:21 pm
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
Have you tried this yet with Fortran, such as gfortran linked here:
http://hpc.sourceforge.net
I would like to get it working on the newer MacBook Pro with CUDA-capable graphics and OpenCL with the coprocessor, so I would like to compare the NVIDIA vs Iris Pro, but I cannot tell from reading if the OpenCL is only supporting AMD or will also support any OpenCL-capable device. Thanks.
http://hpc.sourceforge.net
I would like to get it working on the newer MacBook Pro with CUDA-capable graphics and OpenCL with the coprocessor, so I would like to compare the NVIDIA vs Iris Pro, but I cannot tell from reading if the OpenCL is only supporting AMD or will also support any OpenCL-capable device. Thanks.
Re: MAGMA installation for mac 10.9 with NVIDIA GPU
clintpatty,
I would recommend using cuda MAGMA 1.5, if you have a CUDA GPU.
However, it is possible to use clMAGMA and AMD's clBLAS with general OpenCL GPUs, not just AMD GPUs. Except the Iris Pro doesn't support double-precision, and it seems clBLAS requires double-precision. At least, on my Mac laptop I have to initialize the OpenCL context with only the NVIDIA card, skipping the Iris Pro card, to get clBLAS to run. Otherwise it crashes with a "Trace/BPT trap" error.
We are updating clMAGMA now, and using it on MacOS should be much easier with the next release, expected in November.
-mark
I would recommend using cuda MAGMA 1.5, if you have a CUDA GPU.
However, it is possible to use clMAGMA and AMD's clBLAS with general OpenCL GPUs, not just AMD GPUs. Except the Iris Pro doesn't support double-precision, and it seems clBLAS requires double-precision. At least, on my Mac laptop I have to initialize the OpenCL context with only the NVIDIA card, skipping the Iris Pro card, to get clBLAS to run. Otherwise it crashes with a "Trace/BPT trap" error.
We are updating clMAGMA now, and using it on MacOS should be much easier with the next release, expected in November.
-mark