c++ - Unresolved references using IFORT with nvcc and CUSP -
i have program i'm compiling this:
(...) ifort *.f -c nvcc -c src/bicgstab.cu -o bicgstab.o -i/home/ricardo/apps/cusp/cusplibrary (...) more *.for -c ifort *.o -l/usr/local/cuda-5.5/lib64 -lcudart -lcublas -lcusparse -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -o program everything worked fine until added cusp support have wrapper (bicgstab.cu):
#include <cusp/csr_matrix.h> #include <cusp/krylov/bicgstab.h> #if defined(__cplusplus) extern "c" { #endif void bicgstab_(int * device_i, int * device_j, float * device_v, float * device_x, float * device_b, int n, int nnz){ // *note* raw pointers must wrapped thrust::device_ptr! thrust::device_ptr<int> wrapped_device_i(device_i); thrust::device_ptr<int> wrapped_device_j(device_j); thrust::device_ptr<float> wrapped_device_v(device_v); thrust::device_ptr<float> wrapped_device_x(device_x); thrust::device_ptr<float> wrapped_device_b(device_b); // use array1d_view wrap individual arrays typedef typename cusp::array1d_view< thrust::device_ptr<int> > deviceindexarrayview; typedef typename cusp::array1d_view< thrust::device_ptr<float> > devicevaluearrayview; deviceindexarrayview row_indices (wrapped_device_i, wrapped_device_i + (n+1)); deviceindexarrayview column_indices(wrapped_device_j, wrapped_device_j + nnz); devicevaluearrayview values (wrapped_device_v, wrapped_device_v + nnz); devicevaluearrayview x (wrapped_device_x, wrapped_device_x + n); devicevaluearrayview b (wrapped_device_b, wrapped_device_b + n); // combine 3 array1d_views csr_matrix_view typedef cusp::csr_matrix_view<deviceindexarrayview, deviceindexarrayview, devicevaluearrayview> deviceview; // construct csr_matrix_view array1d_views deviceview a(n, n, nnz, row_indices, column_indices, values); // set stopping criteria: // iteration_limit = 100 // relative_tolerance = 1e-5 cusp::verbose_monitor<float> monitor(b, 100, 1e-5); // solve linear system * x = b conjugate gradient method cusp::krylov::bicgstab(a, x, b, monitor); } #if defined(__cplusplus) } #endif nvcc compiles , generate object, in last command when i'm linking bunch of errors because of linking appears:
ipo: warning #11021: unresolved __gxx_personality_v0 referenced in bicgstab.o ipo: warning #11021: unresolved _ztvst9exception referenced in bicgstab.o ipo: warning #11021: unresolved _ztvst9bad_alloc referenced in bicgstab.o ipo: warning #11021: unresolved _zdlpv referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_guard_acquire referenced in bicgstab.o ipo: warning #11021: unresolved _znsaicec1ev referenced in bicgstab.o ipo: warning #11021: unresolved _znssc1epkcrksaice referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_guard_release referenced in bicgstab.o ipo: warning #11021: unresolved _znssd1ev referenced in bicgstab.o ipo: warning #11021: unresolved _znsaiced1ev referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_guard_abort referenced in bicgstab.o ipo: warning #11021: unresolved _znssc1erkss referenced in bicgstab.o ipo: warning #11021: unresolved _znst13runtime_errord2ev referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_call_unexpected referenced in bicgstab.o ipo: warning #11021: unresolved _znst13runtime_errorc2erkss referenced in bicgstab.o ipo: warning #11021: unresolved _znssc1ev referenced in bicgstab.o ipo: warning #11021: unresolved _znkss5emptyev referenced in bicgstab.o ipo: warning #11021: unresolved _znkst13runtime_error4whatev referenced in bicgstab.o ipo: warning #11021: unresolved _znssasepkc referenced in bicgstab.o ipo: warning #11021: unresolved _znssplepkc referenced in bicgstab.o ipo: warning #11021: unresolved _znssplerkss referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_begin_catch referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_end_catch referenced in bicgstab.o ipo: warning #11021: unresolved _znkss5c_strev referenced in bicgstab.o ipo: warning #11021: unresolved _znkst9bad_alloc4whatev referenced in bicgstab.o ipo: warning #11021: unresolved _znst9bad_allocd2ev referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_allocate_exception referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_free_exception referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_throw referenced in bicgstab.o ipo: warning #11021: unresolved _znst9exceptiond2ev referenced in bicgstab.o ipo: warning #11021: unresolved _zst4cout referenced in bicgstab.o ipo: warning #11021: unresolved _zstlsist11char_traitsiceerst13basic_ostreamict_es5_pkc referenced in bicgstab.o ipo: warning #11021: unresolved _znsolsef referenced in bicgstab.o ipo: warning #11021: unresolved _znsolsem referenced in bicgstab.o ipo: warning #11021: unresolved _zst4endlicst11char_traitsiceerst13basic_ostreamit_t0_es6_ referenced in bicgstab.o ipo: warning #11021: unresolved _znsolsepfrsos_e referenced in bicgstab.o ipo: warning #11021: unresolved _zst9terminatev referenced in bicgstab.o ipo: warning #11021: unresolved _zstlsicst11char_traitsiceerst13basic_ostreamit_t0_es6_st5_setw referenced in bicgstab.o ipo: warning #11021: unresolved _znsolsepfrst8ios_bases0_e referenced in bicgstab.o ipo: warning #11021: unresolved _znst9bad_allocd1ev referenced in bicgstab.o ipo: warning #11021: unresolved _ztist9bad_alloc referenced in bicgstab.o ipo: warning #11021: unresolved __cxa_pure_virtual referenced in bicgstab.o ipo: warning #11021: unresolved _ztvn10__cxxabiv120__si_class_type_infoe referenced in bicgstab.o ipo: warning #11021: unresolved _ztist9exception referenced in bicgstab.o ipo: warning #11021: unresolved _ztist13runtime_error referenced in bicgstab.o ipo: warning #11021: unresolved _ztvn10__cxxabiv117__class_type_infoe referenced in bicgstab.o ipo: warning #11021: unresolved _znst8ios_base4initc1ev referenced in bicgstab.o ipo: warning #11021: unresolved _znst8ios_base4initd1ev referenced in bicgstab.o i believe because ifort adding or removing underscores, adding lower/upper cases or else because file compiling write , if generate binary outside program, testing, works great.
thank in advance!
ipo complicated when there multiple files involved. it's rerunning compiler on modules @ link time. i'm not expert on this, sounds difficult wade through.
one possible option might try compile cuda code shared library (.so) , link against that. should prevent intel compiler toolchain trying recompile , optimize against code generated nvcc/gcc. think going limit "single file optimizations". don't know if affect performance or not.
using example here, modify compile commands follows:
$ nvcc -xcompiler="-fpic" -shared bicgstab.cu -o bicgstab.so -i/home-2/robertc/misc/cusp/cusplibrary-master $ ifort -c -fast bic.f90 $ ifort bic.o bicgstab.so -l/shared/apps/cuda/cuda-v6.0.37/lib64 -lcudart -o program ipo: remark #11001: performing single-file optimizations ipo: remark #11006: generating object file /tmp/ipo_ifortxedpin.o $ you don't indicate in compile process adding -fast switch(es). if on ifort compile commands, believe above approach work. if want/need on link command, appears ifort wants build entirely statically linked executable (and intermodule optimization...), won't work using above process.
Comments
Post a Comment