Closed ghost closed 8 years ago
Thanks for trying gmatrix. You are the first person that I am aware of trying to install for OS X.
The first question that comes to mind is as to whether "/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" is the correct include directory for R?
nathan
@njm18 Yes, it is. In OS X, most of my binaries are installed to /usr/local/Cellar/ by Homebrew
Hi, It is hard for me to debug this b/c I don't have a Mac to replicate the problem. However, based on looking at the gputools configure.ac file I made a modification for mac users. Could you give it a try:
git clone https://github.com/njm18/gmatrix.git rm ./gmatrix/.git -rf MAKE="make -j7" R CMD INSTALL gmatrix --configure-args="--with-arch=sm_50 --with-cuda-home=$CUDA_HOME"
Please let me know if it works, nathan
Hi, I got another error.
R CMD INSTALL gmatrix --configure-args="--with-arch=sm_50 --with-cuda-home=$CUDA_HOME"
Welcome at Sat Mar 19 15:29:20 2016
* installing to library ‘../R/library’
* installing *source* package ‘gmatrix’ ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
setting CUDA home directory to /Developer/NVIDIA/CUDA-7.5
checking for /Developer/NVIDIA/CUDA-7.5/bin/nvcc... yes
setting compute capability of the target device to sm_50
checking for CUDA headers... checking for /Developer/NVIDIA/CUDA-7.5/include/cublas_v2.h... yes
checking whether this is a 64-bit version of CUDA... checking for /Developer/NVIDIA/CUDA-7.5/lib64/libcublas.so... no
checking whether cusolver is used... checking for /Developer/NVIDIA/CUDA-7.5/include/cusolverDn.h... yes
setting R home directory to /usr/local/Cellar/r/3.2.4/R.framework/Resources
checking for R... yes
setting R header files to
Welcome at Sat Mar 19 15:29:20 2016
/usr/local/Cellar/r/3.2.4/R.framework/Resources/include
Goodbye at Sat Mar 19 15:29:20 2016
checking build system type... i386-apple-darwin15.3.0
checking host system type... i386-apple-darwin15.3.0
configure: creating ./config.status
config.status: creating src/Makefile
** libs
** arch -
Makefile:10: *** target pattern contains no `%'. Stop.
ERROR: compilation failed for package ‘gmatrix’
* removing ‘../R/library/gmatrix’
Hi, Thanks for staying with me here. It would be great if I could see the actual Makefile generated by configure. Could you send me the results from: cat --number gmatrix/src/Makefile
nathan
Hi, here it is.
1 # Compilers
2 NVCC = /Developer/NVIDIA/CUDA-7.5/bin/nvcc
3
4 # Program-specifics
5 OBJS = fact.o dist.o conversions.o general.o ops.o manipulation.o matrix.o
6 TARGET = gmatrix.so
7
8 # Compiler options
9 FLAGS = -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I
10 Welcome at Sat Mar 19 23:48:50 2016
11 /usr/local/Cellar/r/3.2.4/R.framework/Resources/include
12 Goodbye at Sat Mar 19 23:48:50 2016 "
13
14 # linker options
15 LDFLAGS = -shared -L/Developer/NVIDIA/CUDA-7.5/lib -Xlinker "-L/usr/local/opt/openblas/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -shared -L/Developer/NVIDIA/CUDA-7.5/lib -F/usr/local/Cellar/r/3.2.4/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -lm -liconv -licuuc -licui18n"
16 LIBS = -lcudart -lcublas -lcusolver
17
18 # Build rules
19 .SUFFIXES: .c .cu .o
20
21 all: $(TARGET)
22
23 $(TARGET): $(OBJS)
24 $(NVCC) $(LDFLAGS) $(LIBS) $(OBJS) -o $@
25
26 %.o: %.c
27 $(NVCC) -c $(FLAGS) $< -o $@
28
29 %.o: %.cu
30 $(NVCC) -c $(FLAGS) $< -o $@
31
32 clean:
33 rm -rf $(OBJS) $(TARGET)
34
I tried to edit it as:
1 # Compilers
2 NVCC = /Developer/NVIDIA/CUDA-7.5/bin/nvcc
3
4 # Program-specifics
5 OBJS = fact.o dist.o conversions.o general.o ops.o manipulation.o matrix.o
6 TARGET = gmatrix.so
7
8 # Compiler options
9 FLAGS = -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include"
10
11 # linker options
12 LDFLAGS = -shared -L/Developer/NVIDIA/CUDA-7.5/lib -Xlinker "-L/usr/local/opt/openblas/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -shared -L/Developer/NVIDIA/CUDA-7.5/lib -F/usr/local/Cellar/r/3.2.4/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -lm -liconv -licuuc -licui18n"
13 LIBS = -lcudart -lcublas -lcusolver
14
15 # Build rules
16 .SUFFIXES: .c .cu .o
17
18 all: $(TARGET)
19
20 $(TARGET): $(OBJS)
21 $(NVCC) $(LDFLAGS) $(LIBS) $(OBJS) -o $@
22
23 %.o: %.c
24 $(NVCC) -c $(FLAGS) $< -o $@
25
26 %.o: %.cu
27 $(NVCC) -c $(FLAGS) $< -o $@
28
29 clean:
30 rm -rf $(OBJS) $(TARGET)
31
but still got same error.
Welcome at Sat Mar 19 23:51:13 2016
* installing to library ‘../R/library’
* installing *source* package ‘gmatrix’ ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
setting CUDA home directory to /Developer/NVIDIA/CUDA-7.5
checking for /Developer/NVIDIA/CUDA-7.5/bin/nvcc... yes
setting compute capability of the target device to sm_50
checking for CUDA headers... checking for /Developer/NVIDIA/CUDA-7.5/include/cublas_v2.h... yes
checking whether this is a 64-bit version of CUDA... checking for /Developer/NVIDIA/CUDA-7.5/lib64/libcublas.so... no
checking whether cusolver is used... checking for /Developer/NVIDIA/CUDA-7.5/include/cusolverDn.h... yes
setting R home directory to /usr/local/Cellar/r/3.2.4/R.framework/Resources
checking for R... yes
setting R header files to
Welcome at Sat Mar 19 23:51:13 2016
/usr/local/Cellar/r/3.2.4/R.framework/Resources/include
Goodbye at Sat Mar 19 23:51:13 2016
checking build system type... i386-apple-darwin15.3.0
checking host system type... i386-apple-darwin15.3.0
configure: creating ./config.status
config.status: creating src/Makefile
** libs
** arch -
Makefile:10: *** target pattern contains no `%'. Stop.
ERROR: compilation failed for package ‘gmatrix’
* removing ‘../R/library/gmatrix’
Thanks... strange. Looks like R is adding an additional welcome message when I try to extract the include director. This doesn't happen in linux. Can you try running these two commands: R --slave --no-save -e "cat(R.home('include'))" R --silent --slave --no-save -e "cat(R.home('include'))"
If the silent option avoids the "Welcome" message I will change the configure.ac file. If the silent option doesn't work, I will have to find another approach. nathan
Yes, of course! You're welcome!
> R --slave --no-save -e "cat(R.home('include'))"
Welcome at Sun Mar 20 00:35:29 2016
/usr/local/Cellar/r/3.2.4/R.framework/Resources/include
Goodbye at Sun Mar 20 00:35:29 2016
> R --silent --slave --no-save -e "cat(R.home('include'))"
Welcome at Sun Mar 20 00:35:36 2016
/usr/local/Cellar/r/3.2.4/R.framework/Resources/include
Goodbye at Sun Mar 20 00:35:36 2016
In addition, probably I know why is that. In my R profile (~/.Rprofile), I added those words:
2 .First <- function(){
3 cat("\nWelcome at ", date(), "\n")
4 }
5
...
19 .Last <- function(){
20 cat("\nGoodbye at ", date(), "\n")
21 }
And I know that I'm not the only person doing that. :)
Ok. I see. Thanks! I didn't think about that. I did a work around on the config file now. Can you try again? nathan
Hi nathan, almost done except this error.
R CMD INSTALL gmatrix --configure-args="--with-arch=sm_50 --with-cuda-home=$CUDA_HOME"
Welcome at Sun Mar 20 09:53:34 2016
* installing to library ‘../R/library’
* installing *source* package ‘gmatrix’ ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
setting CUDA home directory to /Developer/NVIDIA/CUDA-7.5
checking for /Developer/NVIDIA/CUDA-7.5/bin/nvcc... yes
setting compute capability of the target device to sm_50
checking for CUDA headers... checking for /Developer/NVIDIA/CUDA-7.5/include/cublas_v2.h... yes
checking whether this is a 64-bit version of CUDA... checking for /Developer/NVIDIA/CUDA-7.5/lib64/libcublas.so... no
checking whether cusolver is used... checking for /Developer/NVIDIA/CUDA-7.5/include/cusolverDn.h... yes
setting R home directory to /usr/local/Cellar/r/3.2.4/R.framework/Resources
checking for R... yes
setting R header files to /usr/local/Cellar/r/3.2.4/R.framework/Resources/include
checking build system type... i386-apple-darwin15.3.0
checking host system type... i386-apple-darwin15.3.0
configure: creating ./config.status
config.status: creating src/Makefile
** libs
** arch -
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" fact.cu -o fact.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" dist.cu -o dist.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" conversions.cu -o conversions.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" general.cu -o general.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" ops.cu -o ops.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" manipulation.cu -o manipulation.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" matrix.cu -o matrix.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -shared -L/Developer/NVIDIA/CUDA-7.5/lib -Xlinker "-L/usr/local/opt/openblas/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -shared -L/Developer/NVIDIA/CUDA-7.5/lib -F/usr/local/Cellar/r/3.2.4/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -lm -liconv -licuuc -licui18n" -lcudart -lcublas -lcusolver fact.o dist.o conversions.o general.o ops.o manipulation.o matrix.o -o gmatrix.so
ld: library not found for -licuuc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [gmatrix.so] Error 1
ERROR: compilation failed for package ‘gmatrix’
* removing ‘../R/library/gmatrix’
I fixed this. It works now!
> brew uninstall icu4c
Uninstalling /usr/local/Cellar/icu4c/56.1... (244 files, 63.7M)
> brew install icu4c
==> Downloading http://7xkcej.dl1.z0.glb.clouddn.com/bottles/icu4c-56.1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring icu4c-56.1.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides libicucore.dylib (but nothing else).
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/icu4c/lib
CPPFLAGS: -I/usr/local/opt/icu4c/include
==> Summary
🍺 /usr/local/Cellar/icu4c/56.1: 244 files, 63.7M
> brew link icu4c
Warning: icu4c is keg-only and must be linked with --force
Note that doing so can interfere with building software.
> brew link icu4c --force
Linking /usr/local/Cellar/icu4c/56.1... 71 symlinks created
Then I added these two parameter to LDFLAGS and CPPFLAGS separately. And reinstall gmatrix.
> R CMD INSTALL gmatrix --configure-args="--with-arch=sm_50 --with-cuda-home=$CUDA_HOME"
Welcome at Sun Mar 20 10:17:52 2016
* installing to library ‘../R/library’
* installing *source* package ‘gmatrix’ ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
setting CUDA home directory to /Developer/NVIDIA/CUDA-7.5
checking for /Developer/NVIDIA/CUDA-7.5/bin/nvcc... yes
setting compute capability of the target device to sm_50
checking for CUDA headers... checking for /Developer/NVIDIA/CUDA-7.5/include/cublas_v2.h... yes
checking whether this is a 64-bit version of CUDA... checking for /Developer/NVIDIA/CUDA-7.5/lib64/libcublas.so... no
checking whether cusolver is used... checking for /Developer/NVIDIA/CUDA-7.5/include/cusolverDn.h... yes
setting R home directory to /usr/local/Cellar/r/3.2.4/R.framework/Resources
checking for R... yes
setting R header files to /usr/local/Cellar/r/3.2.4/R.framework/Resources/include
checking build system type... i386-apple-darwin15.3.0
checking host system type... i386-apple-darwin15.3.0
configure: creating ./config.status
config.status: creating src/Makefile
** libs
** arch -
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" fact.cu -o fact.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" dist.cu -o dist.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" conversions.cu -o conversions.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" general.cu -o general.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" ops.cu -o ops.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" manipulation.cu -o manipulation.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -c -arch=sm_50 -O2 -DADD_ -I/Developer/NVIDIA/CUDA-7.5/include -Xcompiler "-O2 -DADD_ -fPIC -I/usr/local/Cellar/r/3.2.4/R.framework/Resources/include" matrix.cu -o matrix.o
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -shared -L/Developer/NVIDIA/CUDA-7.5/lib -Xlinker "-L/usr/local/opt/openblas/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -shared -L/Developer/NVIDIA/CUDA-7.5/lib -F/usr/local/Cellar/r/3.2.4/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -lm -liconv -licuuc -licui18n" -lcudart -lcublas -lcusolver fact.o dist.o conversions.o general.o ops.o manipulation.o matrix.o -o gmatrix.so
installing to ../R/library/gmatrix/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘as.matrix’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘as.vector’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘rownames’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘colnames’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘rownames<-’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘colnames<-’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘t’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘diag’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘diag<-’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘crossprod’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘tcrossprod’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘%o%’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘colSums’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘rowSums’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘colMeans’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘rowMeans’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘mean’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘sort’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘which’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘ifelse’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘%x%’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘solve’ from package ‘base’ in package ‘gmatrix’
Creating a generic function for ‘qr’ from package ‘base’ in package ‘gmatrix’
Creating a new generic function for ‘svd’ in package ‘gmatrix’
Creating a generic function for ‘chol’ from package ‘base’ in package ‘gmatrix’
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Welcome at Sun Mar 20 10:19:16 2016
Now using device 0 - "GeForce GTX 750 Ti"
Starting cublas on device 0.
Creating new states on device 0.
Goodbye at Sun Mar 20 10:19:18 2016
* DONE (gmatrix)
Goodbye at Sun Mar 20 10:19:18 2016
Thank you! :+1:
PS: I edited
gmatrix/src/Makefile.in
file to display errors verbosely.