osx mavericks - CUDA on OSX - NVCC can't find STL array header -
i'm in process of porting cuda app windows osx, , unable compile. (ultimately i'm trying xcode build .cu source custom build rule, that's story [unless has updated cuda plugin works xcode 5].)
here's happens in terminal:
$ nvcc -ccbin /usr/bin/clang -gencode=arch=compute_30,code=\"sm_30,compute_30\" --compile -cudart static -o visualizer.cu.obj visualizer.cu visualizer.cu:4:10: fatal error: 'array' file not found #include <array> ^ 1 error generated. $ here's top of source file in question:
#include "visualizer.cuh" #include <iostream> #include <array> using namespace std; #include "cudahelpers.h" #include "openglhelpers.h" #include "glerror.h" #include "files.h" visualizer::visualizer(void) { /// constructor code removed brevity } visualizer::~visualizer(void) { } /// snip it appears nvcc isn't able locate stl array header. (it's worth noting array appears c++11 header, though i'm not sure if that's relevant.)
i find unusual can't find array, iostream isn't problem.
any suggestions? same source file builds under win7 x64 using same cuda sdk version (5.5).
on off chance it's helpful, here's output of env in same terminal session i'm using launch nvcc:
$ env term_program=iterm.app term=xterm shell=/bin/bash tmpdir=/var/folders/sw/7xhtxxnd39x8r5zy9tkq94780000gn/t/ apple_pubsub_socket_render=/tmp/launch-jgreai/render user=dlively ssh_auth_sock=/tmp/launch-hkideo/listeners __cf_user_text_encoding=0x1f5:0:0 __checkfix1436934=1 path=/usr/local/cuda/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin pwd=/users/dlively/projects/thesis/golightly/golightly dbus_launchd_session_bus_socket=/tmp/launch-335uc6/unix_domain_listener lang=en_us.utf-8 iterm_profile=default shlvl=1 colorfgbg=7;0 home=/users/dlively dyld_library_path=/usr/local/cuda/lib: iterm_session_id=w0t0p0 logname=my_user_name _=/usr/bin/env oldpwd=/users/dlively/projects/thesis/golightly $ it occurred me stl headers/libs aren't referenced environment variable, i'm not sure where, exactly, located, or best way (environment variable? nvcc.profile? -i... command line option?) supply information.
help!
update
all of cuda samples build correctly (via make). however, if add together line
#include <array> to source file (even in samples), fails.
update 2
output of nvcc --verbose:
#$ _space_= #$ _cudart_=cudart #$ _here_=/usr/local/cuda/bin #$ _there_=/usr/local/cuda/bin #$ _target_size_= #$ _target_dir_= #$ _target_size_=64 #$ top=/usr/local/cuda/bin/.. #$ nvvmir_library_dir=/usr/local/cuda/bin/../nvvm/libdevice #$ path=/usr/local/cuda/bin/../open64/bin:/usr/local/cuda/bin/../nvvm/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin #$ includes="-i/usr/local/cuda/bin/../include" "-i/usr/local/include/" "-i/usr/local/include/**" #$ libraries= "-l/usr/local/cuda/bin/../lib" #$ cudafe_flags= #$ opencc_flags= #$ ptxas_flags= #$ "/usr/bin"/clang -stdlib=libstdc++ -d__cuda_arch__=300 -e -x c++ -dcuda_double_math_functions -d__cudacc__ -d__nvcc__ -std=c++11 "-i/usr/local/cuda/bin/../include" "-i/usr/local/include/" "-i/usr/local/include/**" -d"_mbcs" -include "cuda_runtime.h" -m64 -o "/var/folders/sw/7xhtxxnd39x8r5zy9tkq94780000gn/t//tmpxft_00001010_00000000-6_visualizer.cpp1.ii" "visualizer.cu" visualizer.cu:4:10: fatal error: 'array' file not found #include <array> ^ 1 error generated. # --error 0x1 --
this c++11 header not available in libstdc++ version available on mac. note not advisable link cuda runtime library libc++ should avoid these features in cuda code.
a bit of details on confusing terms:
libstdc++ - gnu c++ standard library. apple ships old version compatibility purposes. libc++ - it's c++ standard library developed under llvm umbrella. apple actively participates in development , links default since, afaik, 10.9 , xcode 5.update
note in output flag "-stdlib=libstdc++" passed clang. that's selects standard library.
cuda osx-mavericks nvcc
No comments:
Post a Comment