njm18 / gmatrix

R package for unleashing the power of NVIDIA GPU's
Other
16 stars 5 forks source link

Can't get it working on MacOS 10.12 (Sierra) #7

Open Peetiegonzalez opened 7 years ago

Peetiegonzalez commented 7 years ago

Hi there. I tried downgrading Cuda to known working versions but I get incompatibilities between it and any valid versions of XCode that will run on MacOS 10.12, so I decided to go with the latest versions and see if I could work out the errors.

Do you have any idea what parameters I might be able to tweak? I don't think my version of Cuda is 64-bit. There are no bin or lib directories whose name suggests that. EDIT Cuda is only available as a x86_64, but the bin folder is /usr/local/cuda/bin no reference to 64b in the names.

Here are the versions and a verbose response from R upon installing.

MacOS 10.12 XCode 8.2

clang --version: Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin16.0.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Cuda 8.0.61

R:> version _
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major 3
minor 3.3
year 2017
month 03
day 06
svn rev 72310
language R
version.string R version 3.3.3 (2017-03-06) nickname Another Canoe

Installing directly from within R:

install.packages("gmatrix" ,

  • configure.args = "
  • --with-cuda-home=/usr/local/cuda") Package which is only available in source form, and may need compilation of C/C++/Fortran: 'gmatrix' Do you want to attempt to install these from sources? y/n: y installing the source package 'gmatrix'

trying URL 'http://cran.rstudio.com/src/contrib/gmatrix_0.3.tar.gz' Content type 'application/x-gzip' length 416595 bytes (406 KB)

downloaded 406 KB

During startup - Warning messages: 1: Setting LC_CTYPE failed, using "C" 2: Setting LC_TIME failed, using "C" 3: Setting LC_MESSAGES failed, using "C" 4: Setting LC_MONETARY failed, using "C"

The downloaded source packages are in '/private/var/folders/4_/1z64c4kn2dgfby6k76vm3bkm0000gn/T/RtmpV9Ars0/downloaded_packages'

Peetiegonzalez commented 7 years ago

$ cd /private/var/folders/n4/m979q4t973dd9b0ty4qjr3bw0000gn/T/Rtmpc41Yc3/downloaded_packages $ git clone https://github.com/njm18/gmatrix.git Cloning into 'gmatrix'... remote: Counting objects: 629, done. remote: Total 629 (delta 0), reused 0 (delta 0), pack-reused 629 Receiving objects: 100% (629/629), 633.98 KiB | 447.00 KiB/s, done. Resolving deltas: 100% (383/383), done. $ rm -rf ./gmatrix/.git $ MAKE="make -j7" $ CUDA_HOME="/usr/local/cuda" $ R CMD INSTALL gmatrix --configure-args="--with-arch=sm_50 --with-cuda-home=$CUDA_HOME"

On my laptop the installation works, but gtest fails:

library(gmatrix) Now using device 0 - "GeForce GT 650M" Starting cublas on device 0. Creating new states on device 0.

次のパッケージを付け加えます: ‘gmatrix’

以下のオブジェクトは ‘package:base’ からマスクされています:

 svd 

gtest() Checking matrix multiplication, crossprod and tcrossprod... Floating point exception: 8

It's not a very powerful GPU and I'm running a 4K monitor, so I take the error message with a grain of salt.

On my mac pro, the installation fails because my CUDA driver is insufficient. It's an old GPU, I will report back when I install my new GPU that is currently in transit.

Peetiegonzalez commented 7 years ago

Update: install worked on Mac Pro 2008. OSX 10.11.6, with Geforce GTX 960. CUDA 8.0.61. R version 3.3.3 Just putting this here for posterity in case anyone else is having problems with OSX installation.

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=/usr/local/cuda"
peter$ r

R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(gmatrix)
Now using device 0 - "GeForce GTX 960"
Starting cublas on device 0.
Creating new states on device 0.

Attaching package: ‘gmatrix’

The following object is masked from ‘package:base’:

    svd

> gtest()
Checking matrix multiplication, crossprod and tcrossprod... 
Checking outer product and kronecker product... 
Checking Binary Operations... *  +  ==  !=  &  |  -  /  ^  >  <  >=  <=  
Checking Unary Operations/special functions... sqrt  exp  expm1  log  log2  log10  log1p  sin  cos  tan  asin  acos  atan  sinh  cosh  tanh  asinh  acosh  atanh  abs  lgamma  gamma  sign  round  ceiling  floor  is.na  is.nan  is.finite  is.infinite  !  -  +  
Checking ifelse and which... 
Checking sort and order... 
Checking max, min, sum and col/row sums/means... 
Checking gsumby... 
Checking transpose... 
Checking logRowSums... 
Checking indexing and diag functions... 
Testing Random Generators...
Checking distribution functions...
Checking solver functions...

The following errors/warnings were detected:
Error:
*** max not working correctly for type: 2 
nkamitaki commented 7 years ago

@Peetiegonzalez Thank you for detailing your efforts in troubleshooting package installation on Mac OSX - I ran into the exact same sequence of problem and your notes were really helpful.

One detail I wanted to add if you're still working on this, or for anyone who might stumble across this with a similar setup - I think your laptop installation w/ GeForce GT 650M GPU should work if you switch to '--with-arch=sm_30' as the 650M is only Compute 3.0 capable (https://developer.nvidia.com/cuda-gpus). '--with-arch=sm_50' will compile given adequate CUDA but to run would require a Compute 5.0 GPU such as the Geforce GTX 960 you received later.

My setup passes gtest() w/ Mac OSX 10.12.6 / GT 650M (378.05.05.25f01 driver) / CUDA v.8.0.61 (8.0.90 driver)