cuDNN code sample compile error - eclipse

I'm trying to install NVIDIA's cuDNN library and run their code sample, but it's giving me these errors and I don't know what is wrong.
make all
Building target: cuDNNtest
Invoking: NVCC Linker
/usr/local/cuda-7.5/bin/nvcc --cudart static -L/usr/local/cuda-7.5/lib64 -L/usr/local/cuda-7.5/targets/x86_64-linux/lib/ -L".../cuda-workspace/cuDNNtest/FreeImage/lib/linux/x86_64" -L/usr/lib -L/usr/local/cuda/lib64 --relocatable-device-code=true -gencode arch=compute_52,code=compute_52 -gencode arch=compute_52,code=sm_52 -link -o "cuDNNtest" ./fp16_dev.o ./fp16_emu.o ./mnistCUDNN.o ./UtilNPP/StopWatchLinux.o -lcudnn -lFreeImage -lcublas
./mnistCUDNN.o: In function `npp::ImageAllocator<unsigned char, 1ul>::Malloc2D(unsigned int, unsigned int, unsigned int*, bool)':
.../cuda-workspace/cuDNNtest/UtilNPP/ImageAllocatorsNPP.h:76: undefined reference to `nppiMalloc_8u_C1'
./mnistCUDNN.o: In function `npp::ImageAllocator<unsigned char, 1ul>::Free2D(unsigned char*)':
.../cuda-workspace/cuDNNtest/UtilNPP/ImageAllocatorsNPP.h:87: undefined reference to `nppiFree'
collect2: ld returned 1 exit status
make: *** [cuDNNtest] Error 1
I'm using Nsight Eclipse Edition on Linux centOS, cuda toolkit 7.5 and Titan X (compute capability 5.2, I think).
Thank you in advance.

I solved this adding -lnppi to the libraries list in the project's properties.

Related

Simulink Rapid accelerator mode compiler error Linux CentOS 7.3 undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>

Currently I am trying to run my Simulink model, built with Matlab 2019b, on a server of my university, which runs on Linux CentOS 7.3.1611. If I run the model in either 'normal', or 'accelerator' mode it is successful. However, if I try to run the model in 'rapid accelerator mode' the compiler returns an error during building. The errors all contain the element of not finding the standard library:
undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>
I have searched on MATLAB Answers and stackoverflow for solutions, but none have worked for me so far. I have also asked the IT service of my university for help but they could not help me out.
One of the solutions hinted towards the compiler not being able to find the correct libraries and that the library path should be added/updated here on stack overflow. However, if I print the Library path in matlab then it seems allright:
Library path:
<matlab_root>/cefclient/sys/os/glnxa64:<matlab_root>/sys/opengl/lib/glnxa64:<matlab_root>/sys/os/glnxa64:<matlab_root>/bin/glnxa64:<matlab_root>/extern/lib/glnxa64:<matlab_root>/runtime/glnxa64:<matlab_root>/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:
<matlab_root>/sys/java/jre/glnxa64/jre/lib/amd64/server:<compiler_root>/root/usr/lib64:<compiler_root>/root/usr/lib:<compiler_root>/root/usr/lib64/dyninst
Another problem could be the compiler. At first I used a gcc 8.x compiler, but later found out that a 6.3 version is required, so that is what I am using now
Lastly I found a that a problem could be that "(...) it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro." (from stack overflow)
The last option seems the most likely to me, however, I have not been able to solve this. I tried for instance:
set_param(model,'AccelMakeCommand','make_rtw CPP_OPTS="-D_GLIBCXX_USE_CXX11_ABI=0"')
and
set_param(model,'MakeCommand','make_rtw CPP_OPTS="-D_GLIBCXX_USE_CXX11_ABI=0"')
However, this did not help.
If anyone has a tip that could help me out, that would be great. I have added parts of the console output and the error message were it goes wrong down below for extra info.
Kind regards,
Nathan
Console output messages:
( A lot of other stuff)
### Processing Template Makefile: <matlab_root>/rtw/c/raccel/raccel_unix.tmf
### <model_folder>/slprj/raccel/MyModel/MyModel.mk which is generated from <matlab_root>/rtw/c/raccel/raccel_unix.tmf is up to date
### Building MyModel: <matlab_root>/bin/glnxa64/gmake -f MyModel.mk RSIM_SOLVER_SELECTION=2 PCMATLABROOT="<matlab_root>" EXTMODE_STATIC_ALLOC=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 EXTMODE_TRANSPORT=0 TMW_EXTMODE_TESTING=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 MODELREF_TARGET_TYPE=NONE ISPROTECTINGMODEL=NOTPROTECTING OPTS="-DTGT
an error.
Error message:
( A lot of stuff)
g++ -Wl,-rpath,<matlab_root>/sys/os/glnxa64
-L<matlab_root>/sys/os/glnxa64 -o MyModel
MyModel_c233cdf9_1.o MyModel_c233cdf9_1_create.o
MyModel_c233cdf9_1_setParameters.o
MyModel_c233cdf9_1_asserts.o
MyModel_c233cdf9_1_deriv.o
MyModel_c233cdf9_1_checkDynamics.o
MyModel_c233cdf9_1_output.o
MyModel_c233cdf9_1_assembly.o
MyModel_c233cdf9_1_computeConstraintError.o
MyModel_c233cdf9_1_mode_zero_crossings.o
MyModel_c233cdf9_1_geometries.o
MyModel_c233cdf9_1_gateway.o pm_printf.o rt_logging.o
rt_backsubrr_dbl.o rt_forwardsubrr_dbl.o rt_lu_real.o rt_matrixlib_dbl.o
MyModel.o MyModel_capi.o
MyModel_data.o MyModel_tgtconn.o rtGetInf.o
rtGetNaN.o rt_nonfinite.o rt_logging_mmi.o rtw_modelmap_utils.o
raccel_main_new.o raccel_sup.o raccel_mat.o simulink_solver_api.o
raccel_utils.o common_utils.o ext_svr.o updown.o ext_work.o
rtiostream_interface.o rtiostream_tcpip.o rtiostream_utils.o \
<matlab_root>/toolbox/physmod/sm/ssci/lib/glnxa64/sm_ssci_std.a
<matlab_root>/toolbox/physmod/sm/core/lib/glnxa64/sm_std.a
<matlab_root>/toolbox/physmod/pm_math/lib/glnxa64/pm_math_std.a
<matlab_root>/toolbox/physmod/simscape/engine/sli/lib/glnxa64/ssc_sli_std.a
<matlab_root>/toolbox/physmod/simscape/engine/core/lib/glnxa64/ssc_core_std.a
<matlab_root>/toolbox/physmod/network_engine/lib/glnxa64/ne_std.a
<matlab_root>/toolbox/physmod/common/math/core/lib/glnxa64/mc_std.a
<matlab_root>/toolbox/physmod/common/external/library/lib/glnxa64/ex_std.a
<matlab_root>/toolbox/physmod/common/foundation/core/lib/glnxa64/pm_std.a
<matlab_root>/bin/glnxa64/libmwcoder_target_services.so
<matlab_root>/bin/glnxa64/libmwcoder_ParamTuningTgtAppSvc.so
-L"<matlab_root>/bin/glnxa64" -lmwipp -lut -lmx -lmex
-lmat -lmwmathutil -lmwslexec_simbridge -lmwsl_fileio
-lmwsigstream -lmwsl_AsyncioQueue -lmwsl_services
-lmwsdi_raccel -lmwi18n -lmwsl_simtarget_instrumentation
-lfixedpoint -lmwslexec_simlog -lm -lpthread -ldl
<matlab_root>/bin/glnxa64/libQt5WebKit.so.5: undefined reference to
`std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_S_copy(char*, char const*, unsigned
long)#GLIBCXX_3.4.21'
<matlab_root>/bin/glnxa64/libmwboost_locale.so.1.65.1: undefined
reference to `std::__cxx11::numpunct<char>::id#GLIBCXX_3.4.21'
<matlab_root>/bin/glnxa64/libmwboost_serialization.so.1.65.1:
undefined reference to `typeinfo for
std::__codecvt_utf8_base<wchar_t>#GLIBCXX_3.4.21'
<matlab_root>/bin/glnxa64/libut.so: undefined reference to
`std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::assign(char const*)#GLIBCXX_3.4.21'
<matlab_root>/bin/glnxa64/libut.so: undefined reference to
`std::logic_error::logic_error(char const*)#GLIBCXX_3.4.21'
<matlab_root>/bin/glnxa64/libmwcoder_target_services.so: undefined
reference to `typeinfo for std::_V2::error_category#GLIBCXX_3.4.21'
<matlab_root>/bin/glnxa64/libmwboost_locale.so.1.65.1: undefined
reference to `typeinfo for std::__cxx11::moneypunct_byname<char,
false>#GLIBCXX_3.4.21'
( A lot of stuff)
collect2: error: ld returned 1 exit status
gmake: *** [MyModel] Error 1
Error(s) encountered while building "MyModel" - Show complete
stack trace
}

AOSP error - FAILED: /bin/bash -c "prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++

[ 2% 247/11700] target SharedLib: lib...libart_intermediates/LINKED/libart.so)
FAILED: /bin/bash -c "prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++ -nostdlib -Wl,-soname,libart.so -Wl,--gc-sections -shared -Lout/target/product/generic/obj/lib out/target/product/generic/obj/lib/crtbegin_so.o out/target/product/generic/obj/SHARED_LIBRARIES/libart_intermediates/interpreter/mterp/out/mterp_arm.o
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin/ld: error: out/target/product/generic/obj/SHARED_LIBRARIES/libart_intermediates/type_lookup_table.o: file is empty
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin/ld: error: out/target/product/generic/obj/SHARED_LIBRARIES/libart_intermediates/verifier/instruction_flags.o: file is empty
art/runtime/base/scoped_flock.cc:37: error: undefined reference to 'art::OS::OpenFileWithFlags(char const*, int)'
art/runtime/check_jni.cc:3240: error: undefined reference to 'art::operator<<(std::__1::basic_ostream >&, art::Primitive::Type const&)'
art/runtime/check_jni.cc:3056: error: undefined reference to 'art::operator<<(std::__1::basic_ostream >&,
art/runtime/class_linker.cc:2166: error: undefined reference to 'art::ObjectLock::ObjectLock(art::Thread*, art::Handle)'
art/runtime/class_linker.cc:2169: error: undefined reference to 'art::ObjectLock::WaitIgnoringInterrupts()'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[ 2% 247/11700] Building with Jack: o...t_intermediates/with-local/classes.dex
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make failed to build some targets (06:55 (mm:ss))
Getting this error when i run make -j16
Help me what to do !
Seems like some of your object files have been corrupted. I suggest you either clean the dir out/target/product/generic/obj/SHARED_LIBRARIES/libart_intermediates or/and clean ccache ccache -C
First advice is not to build with make -j16 as it takes too much ram.
For example compiling on 8 cores needs 64 GB of ram (tested on my server)
Try just compiling on a single core or at most on two. Another solution would be to call the command m instead of make to let it automatically find optimal settings on your hardware.
Another thing could be that you are missing some packages. Are you sure these packages are installed?
git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
They could have different names for your distro (for example if you use Arch).
Also to note:
Compiling should take between 2.5 to 4 hours depending on your cpu performance. - It needs 100GB for downloading the android sources and 100-150GB for compilation.
You also need at least 12 GB or more to compile on a single core.
There is some method to compile it on 8GB of RAM by using swap space but this is extremely slow so not recommended.
My personal hardware and times:
Intel xeon e5-2680v3 8 core cpu
40 GB ram
Compile time on make -j1: 2 hours

mutt installaiton error on CentOS 6.7

I'm trying to install mutt on CentOS 6.7 and ./configure --prefix=$HOME/local runs fine but at make install step, I run into this error below that I don't know how to solve. I tried with mutt 1.6.1 and 1.6.0 and this same error came up so it's probably some system setting that wasn't correct. How could I fix it?
gcc -std=gnu99 -Wall -pedantic -Wno-long-long -g -O2 -o mutt addrbook.o alias.o attach.o base64.o browser.o buffy.o color.o crypt.o cryptglue.o commands.o complete.o compose.o copy.o curs_lib.o curs_main.o date.o edit.o enter.o flags.o init.o filter.o from.o getdomain.o group.o handler.o hash.o hdrline.o headers.o help.o hook.o keymap.o main.o mbox.o menu.o mh.o mx.o pager.o parse.o pattern.o postpone.o query.o recvattach.o recvcmd.o rfc822.o rfc1524.o rfc2047.o rfc2231.o rfc3676.o score.o send.o sendlib.o signal.o sort.o status.o system.o thread.o charset.o history.o lib.o muttlib.o editmsg.o mbyte.o mutt_idna.o url.o ascii.o crypt-mod.o safe_asprintf.o patchlist.o conststrings.o pgp.o pgpinvoke.o pgpkey.o pgplib.o gnupgparse.o pgpmicalg.o pgppacket.o crypt-mod-pgp-classic.o smime.o crypt-mod-smime-classic.o resize.o -lncursesw -lidn
/opt/gnu/bin/ld: curs_lib.o: undefined reference to symbol 'wtimeout'
/lib64/libtinfo.so.5: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [mutt] Error 1
OK, I somehow fixed it.. not really understand why this fixed it.
After configure, in the Makefile, change the LDFLAGS = line to LDFLAGS = -lncurses -ltinfo, then make install and it solved the issue.
Credit to this post: http://www.pclinuxos.com/forum/index.php?topic=129566.0, Tara-Rain-9.5ß's answer

How to load shared library created in Matlab

I tried to create an OpenModelica model with liquid flow and Media.
And I have a function in Matlab that calculates the PDE (partial differential equation) in pdetool.
I would like to create a shared dynamic library (.so file) in Matlab by MCR and load it in the model.
My platform: OpenModelica used on Linux or Mac OS. MCR on Linux and Mac OS installed.
In Matlab I can generate only DLL (may be it's possible to generate libmyfunc.so?).
When I try to compile the model with extern C function I got an error:
#omc +s test_matlab_so.mo func_mathlab.mo
#make -f test_matlab_so.makefile
/usr/bin/clang -Wimplicit-function-declaration -O0 -falign-functions -march=native -I"/opt/openmodelica/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -c -o test_matlab_so_functions.o test_matlab_so_functions.c
clang: warning: optimization flag '-falign-functions' is not supported
clang: warning: argument unused during compilation: '-falign-functions'
In file included from test_matlab_so_functions.c:7:
In file included from ./test_matlab_so_includes.h:4:
./shared_train/src/lib_summ.c:90:8: warning: implicit declaration of function 'GetModuleFileName' is invalid in C99 [-Wimplicit-function-declaration]
if (!GetModuleFileName(GetModuleHandle("lib_summ"), path_to_dll, _MAX_PATH))
^
./shared_train/src/lib_summ.c:90:26: warning: implicit declaration of function 'GetModuleHandle' is invalid in C99 [-Wimplicit-function-declaration]
if (!GetModuleFileName(GetModuleHandle("lib_summ"), path_to_dll, _MAX_PATH))
^
./shared_train/src/lib_summ.c:90:55: error: use of undeclared identifier 'path_to_dll'
if (!GetModuleFileName(GetModuleHandle("lib_summ"), path_to_dll, _MAX_PATH))
^
./shared_train/src/lib_summ.c:90:68: error: use of undeclared identifier '_MAX_PATH'
if (!GetModuleFileName(GetModuleHandle("lib_summ"), path_to_dll, _MAX_PATH))
^
./shared_train/src/lib_summ.c:94:37: error: use of undeclared identifier 'path_to_dll'
mclGetEmbeddedCtfStream(path_to_dll);
^
test_matlab_so_functions.c:19:16: warning: implicit declaration of function '_mlfSumm' is invalid in C99 [-Wimplicit-function-declaration]
_v_out_ext = _mlfSumm(_v_a_ext, _v_b_ext);
^
3 warnings and 3 errors generated.
make: *** [test_matlab_so_functions.o] Error 1
Can someone help me with integrating OpenModelica and Matlab?
I don't have much experience with Linux but I did the same thing in Windows using MCR. Check this out:
http://de.mathworks.com/matlabcentral/answers/94471-how-do-i-create-a-c-c-shared-library-with-matlab-compiler-that-can-be-used-in-a-microsoft-visual-c
When you do this, you will get a DLL as well as a static library. You need to copy both of them into the folder that your modelica code is located at and then set the library in the "Library" attibute of your modelica function which calls the external function.
Keep in mind that if you are using a 64 or 32 bit dymola, you are supposed to create the DLL using the same version of matlab correspondingly.

Compilation Error: libDAI-0.3.2 in Ubuntu 14.04 with MATLAB

I am trying to install libDAI-0.3.2 in Ubuntu 14.04. I need to use it with MATLAB.
I made following changes :
In Makefile.conf:
CC=g++-4.7
MEXFLAGS:=CXX=#$(CC) CXXFLAGS#'$(CCFLAGS)'
In Makefile.ALL: WITH_MATLAB=true
Since default compiler in Ubuntu 14.04 is gcc 4.8.4, I installed gcc-4.7 and g++4.7.
Still I get the following compilation error:
libDAI-0.3.2$ make
/usr/local/MATLAB/R2015a/bin/mex -Iinclude CXX= -largeArrayDims -lgmpxx -lgmp -output matlab/dai.mexa64 src/matlab/dai.cpp src/matlab/matlab.cpp src/graph.cpp src/dag.cpp src/bipgraph.cpp src/varset.cpp src/daialg.cpp src/alldai.cpp src/clustergraph.cpp src/factor.cpp src/factorgraph.cpp src/properties.cpp src/regiongraph.cpp src/cobwebgraph.cpp src/util.cpp src/weightedgraph.cpp src/exceptions.cpp src/exactinf.cpp src/evidence.cpp src/emalg.cpp src/io.cpp src/bp.cpp src/fbp.cpp src/trwbp.cpp src/mf.cpp src/hak.cpp src/lc.cpp src/treeep.cpp src/jtree.cpp src/mr.cpp src/gibbs.cpp src/bbp.cpp src/cbp.cpp src/bp_dual.cpp src/decmap.cpp src/glc.cpp
Building with 'g++'.
/tmp/mex_11282758003780_5023: -c: not found
make: *** [matlab/dai.mexa64] Error 255
what does this mean? Any idea how to fix this?
Thanks & Regards,
Swagatika
Try replacing
MEXFLAGS:=CXX=#$(CC) CXXFLAGS#'$(CCFLAGS)'
with
MEXFLAGS:=CXX=$(CC) CXXFLAGS='$(CCFLAGS)'
MEXFLAGS:=CXX=$(CC) CXXFLAGS='$(CCFLAGS)' replace this