Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation error of using a variable declared with a __device__ modifier directly in the host code #13

Closed
ghost opened this issue Mar 8, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 8, 2016

Welcome at  Tue Mar  8 18:22:33 2016
* installing *source* package ‘gputools’ ...
** package ‘gputools’ successfully unpacked and MD5 sums checked
checking "CUDA compiler"... "environment variable NVCC not set"
checking for nvcc... /usr/local/cuda/bin/nvcc
"using NVCC=/usr/local/cuda/bin/nvcc"
checking "root of the CUDA install directory"... "using CUDA_HOME=/usr/local/cuda"
checking "location of CUDA libraries"... checking for "/usr/local/cuda/lib/libcublas.so"... no
checking for "/usr/local/cuda/lib64/libcublas.so"... no
checking for "/usr/local/cuda/lib/libcublas.dylib"... yes
checking "R"... "using /usr/local/Cellar/r/3.2.3_1/R.framework/Resources for the root of the R install directory"
"using /usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include for R header files"
checking for rpath flag style... checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
rpath flag style... llvm
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 -
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" rinterface.cu -o rinterface.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" mi.cu -o mi.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" sort.cu -o sort.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" granger.cu -o granger.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" qrdecomp.cu -o qrdecomp.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" correlation.cu -o correlation.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" hcluster.cu -o hcluster.o
hcluster.cu(449): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(457): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(468): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(516): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(517): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(518): warning: a __device__ variable "hcluster_min_val_d" cannot be directly read in a host function

hcluster.cu(518): warning: a __device__ variable "hcluster_min_col_d" cannot be directly read in a host function

hcluster.cu(522): warning: a __device__ variable "hcluster_min_val_d" cannot be directly read in a host function

hcluster.cu(523): warning: a __device__ variable "hcluster_min_col_d" cannot be directly read in a host function

hcluster.cu(523): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(523): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(524): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(524): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(530): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(531): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(532): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(532): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(532): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(539): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(541): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(543): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(548): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(549): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(550): warning: a __device__ variable "hcluster_min_val_d" cannot be directly read in a host function

hcluster.cu(551): warning: a __device__ variable "hcluster_min_col_d" cannot be directly read in a host function

hcluster.cu(552): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(553): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(554): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(561): warning: a __device__ variable "hcluster_dist_d" cannot be directly written in a host function

hcluster.cu(579): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(589): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(636): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(637): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(638): warning: a __device__ variable "hcluster_min_val_d" cannot be directly read in a host function

hcluster.cu(638): warning: a __device__ variable "hcluster_min_col_d" cannot be directly read in a host function

hcluster.cu(642): warning: a __device__ variable "hcluster_min_val_d" cannot be directly read in a host function

hcluster.cu(643): warning: a __device__ variable "hcluster_min_col_d" cannot be directly read in a host function

hcluster.cu(643): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(643): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(644): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(644): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(650): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(651): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(652): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(652): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(652): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(659): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(661): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(663): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

hcluster.cu(668): warning: a __device__ variable "hcluster_dist_d" cannot be directly read in a host function

hcluster.cu(669): warning: a __device__ variable "hcluster_count_d" cannot be directly read in a host function

hcluster.cu(670): warning: a __device__ variable "hcluster_min_val_d" cannot be directly read in a host function

hcluster.cu(671): warning: a __device__ variable "hcluster_min_col_d" cannot be directly read in a host function

hcluster.cu(672): warning: a __device__ variable "hcluster_sub_d" cannot be directly read in a host function

hcluster.cu(673): warning: a __device__ variable "hcluster_sup_d" cannot be directly read in a host function

hcluster.cu(674): warning: a __device__ variable "hcluster_merge_val_d" cannot be directly read in a host function

/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" distance.cu -o distance.o
distance.cu(829): warning: a __constant__ variable "distance_vg_a_d" cannot be directly read in a host function

distance.cu(837): warning: a __constant__ variable "distance_vg_a_d" cannot be directly read in a host function

distance.cu(838): warning: a __constant__ variable "distance_vg_a_d" cannot be directly read in a host function

distance.cu(838): warning: a __device__ variable "distance_d_d" cannot be directly read in a host function

distance.cu(843): warning: a __constant__ variable "distance_vg_b_d" cannot be directly read in a host function

distance.cu(848): warning: a __constant__ variable "distance_vg_a_d" cannot be directly read in a host function

distance.cu(848): warning: a __constant__ variable "distance_vg_b_d" cannot be directly read in a host function

distance.cu(849): warning: a __device__ variable "distance_d_d" cannot be directly read in a host function

distance.cu(853): warning: a __device__ variable "distance_d_d" cannot be directly read in a host function

distance.cu(858): warning: a __constant__ variable "distance_vg_a_d" cannot be directly read in a host function

distance.cu(859): warning: a __constant__ variable "distance_vg_b_d" cannot be directly read in a host function

distance.cu(860): warning: a __device__ variable "distance_d_d" cannot be directly read in a host function

/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" matmult.cu -o matmult.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" lsfit.cu -o lsfit.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" kendall.cu -o kendall.o
/usr/local/cuda/bin/nvcc -c -Xcompiler "-fPIC -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -g -O2" -I. -I"/usr/local/cuda/include" -I"/usr/local/Cellar/r/3.2.3_1/R.framework/Resources/include" cuseful.cu -o cuseful.o
d/usr/local/cuda/bin/nvcc -shared -Xlinker -rpath,"/usr/local/cuda/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  -F/usr/local/Cellar/r/3.2.3_1/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -lm -liconv -licuuc -licui18n" -L"/usr/local/cuda/lib" -lcublas  rinterface.o mi.o sort.o granger.o qrdecomp.o correlation.o hcluster.o distance.o matmult.o lsfit.o kendall.o cuseful.o -o gputools.so
ld: library not found for -licuuc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [gputools.so] Error 1
ERROR: compilation failed for package ‘gputools’
* removing ‘../R/library/gputools’

The downloaded source packages are in
    ‘../RtmpJYFHbo/downloaded_packages’
Warning message:
In install.packages("gputools") :
  installation of package ‘gputools’ had non-zero exit status

They're mainly within this file, hcluster.cu.
and caused by these codes:

cudaMalloc((void**)&hcluster_count_d, n * sizeof(float));
    cudaMalloc((void**)&hcluster_min_val_d, n * sizeof(float));
    cudaMalloc((void**)&hcluster_min_col_d, n * sizeof(size_t));
    cudaMalloc((void**)&hcluster_sub_d, (n - 1) * sizeof(int));
    cudaMalloc((void**)&hcluster_sup_d, (n - 1) * sizeof(int));
    cudaMalloc((void**)&hcluster_merge_val_d, (n - 1) * sizeof(float));

This page may be helpful to you, since I have little knowledge about C/CPP/CudaC currently.

@ghost
Copy link
Author

ghost commented Mar 8, 2016

Problem solved by setting icu environment variables properly.

@ghost ghost closed this as completed Mar 8, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants