E_1996
E_1996

Reputation: 89

Difficulties in installing ArrayFire

I installed the RcppArrayFire R package ( via https://github.com/daqana/rcpparrayfire ) and I am trying to run the following simple example:

#include <RcppArrayFire.h>

// [[Rcpp::depends(RcppArrayFire)]]     
// [[Rcpp::plugins(cpp14)]]      
 
 
 // [[Rcpp::export]] 
 af::array                               AF_example_1( int n_rows,  
                                                       int n_cols) {   
   
   af::array  mat_AF =  af::constant(1, n_rows, n_cols)  ;  
   
   return(mat_AF);   
   
 }

It compiles fine, however I get the following error whenever I try to run it from R:

ArrayFire Exception (Internal error:998):
In ../inst/include/RcppArrayFireWrap.h:46
Error: error in Arrayfire

Also I am compiling with the following flags:

  Sys.setenv(CXX14FLAGS="-O3 -march=native -mtune=native -fPIC ")
  Sys.setenv(CXX_STD = "CXX14")  
  Sys.setenv(CXX14="/opt/rh/devtoolset-8/root/usr/bin/g++")

Is there something wrong with my code or compilation flags?

Thanks!

EDIT (note: reason for discrepancy between this info and info in comment is that i re-installed and downgraded OS for a different reason unrelated to this post) :

Session info:


R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rstan_2.32.3        BH_1.81.0-1         StanHeaders_2.26.28 RcppEigen_0.3.3.9.4 Rcpp_1.0.11         RcppArrayFire_0.1.0 drat_0.2.4          githubinstall_0.2.2

loaded via a namespace (and not attached):
 [1] QuickJSR_1.0.8     prettyunits_1.2.0  ps_1.7.5           utf8_1.2.4         digest_0.6.33      mime_0.12          R6_2.5.1           stats4_3.6.3       httr_1.4.7        
[10] ggplot2_3.4.4      pillar_1.9.0       rlang_1.1.2        curl_5.1.0         rstudioapi_0.15.0  data.table_1.14.8  miniUI_0.1.1.1     callr_3.7.3        urlchecker_1.0.1  
[19] devtools_2.4.5     stringr_1.5.1      loo_2.6.0          htmlwidgets_1.6.3  munsell_0.5.0      shiny_1.8.0        compiler_3.6.3     httpuv_1.6.12      pkgconfig_2.0.3   
[28] pkgbuild_1.4.2     htmltools_0.5.7    tibble_3.2.1       gridExtra_2.3      codetools_0.2-16   matrixStats_1.1.0  fansi_1.0.5        crayon_1.5.2       later_1.3.1       
[37] grid_3.6.3         jsonlite_1.8.7     xtable_1.8-4       gtable_0.3.4       lifecycle_1.0.4    magrittr_2.0.3     scales_1.2.1       RcppParallel_5.1.7 cli_3.6.1         
[46] stringi_1.8.2      cachem_1.0.8       fs_1.6.3           promises_1.2.1     remotes_2.4.2.1    ellipsis_0.3.2     vctrs_0.6.4        tools_3.6.3        glue_1.6.2        
[55] purrr_1.0.2        processx_3.8.2     pkgload_1.3.3      parallel_3.6.3     fastmap_1.1.1      inline_0.3.19      colorspace_2.1-0   sessioninfo_1.2.2  memoise_2.0.1     
[64] profvis_0.3.8      usethis_2.2.2     
> 
> RcppArrayFire::arrayfire_info()


ArrayFire v3.8.0 (CUDA, 64-bit Linux, build d99887a)
Platform: CUDA Runtime 11.7, Driver: 515.43.04
[0] NVIDIA GeForce GTX 970, 4021 MB, CUDA Compute 5.2


> RcppArrayFire::arrayfire_device_info()
$name
[1] "NVIDIA_GeForce_GTX_970"

$platform
[1] "CUDA"

$toolkit
[1] "v11.7"

$compute
[1] "5.2"


OS: Linux Mint 20 Cinnamon

ArrayFire version: v3.8

I installed ArrayFire using the .sh installer found here:

https://arrayfire.s3.amazonaws.com/index.html

using the following commands in the Linux terminal:


chmod +x arrayfire.sh
./arrayfire.sh

then, I had trouble installing using the configure.args argument to change the directory, i.e.:

  install_github("daqana/rcpparrayfire" , configure.args = "--with-arrayfire=/home/enzo/Downloads/arrayfire" )

So I moved the install directory to /opt:

sudo mv Downloads/arrayfire /opt/arrayfire

And then I could install RcppArrayFire using:

  require(drat)
  drat::addRepo("daqana")
  install.packages("RcppArrayFire"

EDIT 2:

If I change the variable type to f64 I get this error instead:

ArrayFire Exception (Internal error:998):
In function cuda::Module common::compileModule(const string&, const std::vector<std::basic_string<char> >&, const std::vector<std::basic_string<char> >&, const std::vector<std::basic_string<char> >&, bool)
In file src/backend/cuda/compile_module.cpp:277
NVRTC Error(7): NVRTC_ERROR_BUILTIN_OPERATION_FAILURE
Log: 
nvrtc: error: failed to open libnvrtc-builtins.so.11.1.
  Make sure that libnvrtc-builtins.so.11.1 is installed correctly.

 0# 0x00007F6422281C3F in /opt/arrayfire/lib64/libafcuda.so.3
 1# 0x00007F64232AB84C in /opt/arrayfire/lib64/libafcuda.so.3
 2# 0x00007F642267BEF8 in /opt/arrayfire/lib64/libafcuda.so.3
 3# 0x00007F642267F77D in /opt/arrayfire/lib64/libafcuda.so.3
 4# 0x00007F6422680407 in /opt/arrayfire/lib64/libafcuda.so.3
 5# 0x00007F642221B72E in /opt/arrayfire/lib64/libafcuda.so.3
 6# 0x00007F6422309C3D in /opt/arrayfire/lib64/libafcuda.so.3
 7# af_get_data_ptr in /opt/arrayfire/lib64/libafcuda.so.3
 8# af_get_data_ptr in /opt/arrayfire/lib64/libaf
Error: error in Arrayfire

EDIT 3:

Sometimes (using the exact same program) I will instead get an aborted session message and I get the following error messages:

[42259:42259:20231126,235559.444822:ERROR process_memory_range.cc:86] read out of range
[42259:42259:20231126,235559.444856:ERROR elf_image_reader.cc:558] missing nul-terminator
[42259:42259:20231126,235559.444919:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.446864:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.446892:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.446912:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.446933:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.446952:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.446974:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447163:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447184:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447360:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447385:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447457:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447475:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447494:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447592:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447614:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447637:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447659:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447681:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447703:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447726:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447748:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447770:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447791:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447813:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447834:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447856:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447877:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447899:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447921:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447942:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447966:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.447990:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.448013:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42259:20231126,235559.448037:ERROR elf_dynamic_array_reader.h:61] tag not found
[42259:42260:20231126,235559.473501:ERROR directory_reader_posix.cc:42] opendir: No such file or directory (2)

Upvotes: 1

Views: 191

Answers (0)

Related Questions