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

compilation error in psfcorr when using icpc #378

Closed
tomaszkacprzak opened this issue Mar 29, 2013 · 9 comments
Closed

compilation error in psfcorr when using icpc #378

tomaszkacprzak opened this issue Mar 29, 2013 · 9 comments

Comments

@tomaszkacprzak
Copy link
Member

I am running into this error when compiling with icpc.
gcc installation works fine, and I still get the API warnings.
Does it look familiar to you?

icpc -o pysrc/.obj/Angle.os -c -mkl -fPIC -Iinclude/galsim -Iinclude -I/home/kacprzak/local/include -I/home/kacprzak/local/tmv/include -I/home/kacprzak/local/include/python2.7 -I/home/kacprzak/local/python/2.7.3/lib/python2.7/site-packages/numpy/core/include pysrc/Angle.cpp
/home/kacprzak/local/python/2.7.3/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h(11): warning #1224: #warning directive: "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
  #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
   ^

/usr/include/c++/4.4.6/cmath(528): error: identifier "__builtin_isnan" is undefined
        return __builtin_isnan(__type(__f));
               ^
          detected during:
            instantiation of "__gnu_cxx::__enable_if<std::__is_arithmetic<_Tp>::__value, int>::__type std::isnan(_Tp) [with _Tp=double]" at line 771 of "src/hsm/PSFCorr.cpp"
            instantiation of "void galsim::hsm::find_ellipmom_2(galsim::ConstImageView<T>, galsim::ConstImageView<int>, double &, double &, double &, double &, double &, double &, double &, double, int &) [with T=double]" at line 115 of "src/hsm/PSFCorr.cpp"

compilation aborted for src/hsm/PSFCorr.cpp (code 2)
scons: *** [src/hsm/.obj/PSFCorr.os] Error 2
scons: building terminated because of errors.
@rmjarvis
Copy link
Member

I assume you mean on branch #343? This didn't get the fix from #298 yet. I just merged from master which includes that fix, so I think it should work now. For future reference, you can always check whether some branch has all the updates that are on master with:

git checkout master
git pull
git checkout some_other_branch
git pull
git merge master

If all is up to date, you should get:

$ git merge master
Already up-to-date.

I'm sure there is some git way to just check it it's consistent other than to try the merge, but since I always want to do the merge if it hasn't been done yet, this is my SOP.

@rmandelb
Copy link
Member

rmandelb commented Apr 3, 2013

Hi @tomaszkacprzak - just wanted to check whether this worked for you, in which case we will close this issue?

@tomaszkacprzak
Copy link
Member Author

I tried to do compile it with the fix you mentioned Mike, but I am getting an error of other sort. I am pretty sure I messed up my intel-compiled TMV, Numpy or Boost, so I will start with redoing my intel version of GalSim and dependencies. Then I will report!

@rmandelb
Copy link
Member

Hi @tomaszkacprzak - any update? I just noticed this hasn't been updated in 2 months.

@tomaszkacprzak
Copy link
Member Author

Hi Rachel, sorry about that. I was using the gcc version successfully. I tried to recompile after updating galsim, but I ran into the same problem, but without the Numpy warning. It looks like boost linking errors..

icpc -o pysrc/.obj/Angle.os -c -O2 -msse2 -vec-report0 -fPIC -Iinclude/galsim -Iinclude -I/home/kacprzak/local/python/2.7.3/include -I/home/kacprzak/local/tmv-intel/include -I/home/kacprzak/local/include/python2.7 -I/home/kacprzak/local/python/2.7.3/lib/python2.7/site-packages/numpy/core/include pysrc/Angle.cpp
/usr/include/c++/4.4.6/cmath(528): error: identifier "__builtin_isnan" is undefined
        return __builtin_isnan(__type(__f));
               ^
          detected during:
            instantiation of "__gnu_cxx::__enable_if<std::__is_arithmetic<_Tp>::__value, int>::__type std::isnan(_Tp) [with _Tp=double]" at line 785 of "src/hsm/PSFCorr.cpp"
            instantiation of "void galsim::hsm::find_ellipmom_2(galsim::ConstImageView<T>, galsim::ConstImageView<int>, double &, double &, double &, double &, double &, double &, double &, double, int &, boost::shared_ptr<galsim::hsm::HSMParams>) [with T=double]" at line 130 of "src/hsm/PSFCorr.cpp"

compilation aborted for src/hsm/PSFCorr.cpp (code 2)
scons: *** [src/hsm/.obj/PSFCorr.os] Error 2
scons: building terminated because of errors.

There are errors in config.log:

ImportError: .sconf_temp/conftest_52_mod/check_bp.so: undefined symbol: _ZNK5boost6python7objects21py_function_impl_base9max_arityEv

icpc -o .sconf_temp/conftest_29 -openmp .sconf_temp/conftest_29.o -Llib -L/home/kacprzak/local/python/2.7.3/lib -L/home/kacprzak/local/tmv-intel/lib -lfftw3 -ltmv -lpthread
.sconf_temp/conftest_29.o: In function `tmv::SymMatrix<double, 0>::SymMatrix(long, double const&)':
.sconf_temp/conftest_29.cpp:(.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd[.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd]+0xfc8): undefined reference to `VTT for tmv::GenSymMatrix<double>'
.sconf_temp/conftest_29.cpp:(.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd[.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd]+0xfd5): undefined reference to `VTT for tmv::GenSymMatrix<double>'
.sconf_temp/conftest_29.cpp:(.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd[.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd]+0xfdf): undefined reference to `VTT for tmv::GenSymMatrix<double>'
.sconf_temp/conftest_29.cpp:(.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd[.gnu.linkonce.t._ZN3tmv9SymMatrixIdLi0EEC2ElRKd]+0xfea): undefined reference to `VTT for tmv::GenSymMatrix<double>'
.sconf_temp/conftest_29.o: In function `tmv::GenSymMatrix<double>::~GenSymMatrix()':
.sconf_temp/conftest_29.cpp:(.gnu.linkonce.t._ZN3tmv12GenSymMatrixIdED2Ev[.gnu.linkonce.t._ZN3tmv12GenSymMatrixIdED2Ev]+0x22): undefined reference to `VTT for tmv::GenSymMatrix<double>'
.sconf_temp/conftest_29.o:.sconf_temp/conftest_29.cpp:(.gnu.linkonce.t._ZTv0_n56_N3tmv12GenSymMatrixIdED0Ev[.gnu.linkonce.t._ZTv0_n56_N3tmv12GenSymMatrixIdED0Ev]+0x24): more undefined references to `VTT for tmv::GenSymMatrix<double>' follow
.sconf_temp/conftest_29.o: In function `tmv::SymMatrixView<std::complex<double>, 

And:

ImportError: .sconf_temp/conftest_50_mod/check_bp.so: undefined symbol: _ZNK5boost6python7objects21py_function_impl_base9max_arityEv

I can send the whole config.log if needed.

@rmjarvis
Copy link
Member

I think the problem is that you are using TMV built with g++ rather than icpc. You need to build a version of TMV with icpc.

On my system where I test with both g++ and icpc, I use PREFIX = ~/icpc-install for icpc. (I also store the different gs_scons.conf files as gs_scons.icpc and gs_scons.g++ so I can quickly switch between them.) Anyway, I put the TMV library compiled with icpc in ~/icpc-install/lib.

@rmjarvis
Copy link
Member

Actually, I take back my previous comment. I was basing this on the config.log stuff you posted, but rereading your post, I see that that's not relevant, since you did get past that to the .cpp compiling.

So, on to isnan. This is actually a big problem with the (pre-C++11) C++ standard. There was no standard library isnan function. It was defined as a macro in C99, but that isn't technically part of the standard C++. It's just a common extension that is often implemented by compilers. Sometimes as a macro. Sometimes as a function. So it looks like you've run into a conflict with it. (Now with C++11, they have finally adopted it as part of the standard, but we're not requiring C++11 for GalSim currently.)

For TMV, I rolled my own isnan function to avoid all the platform-dependent issues with it. But since we're using boost anyway, my recommendation is to use boost::math::isnan here. This seems to be the only place we use the isnan function, so it's not a big change.

@rmjarvis
Copy link
Member

I went ahead and made the switch on master. Please see if that works for you.

@tomaszkacprzak
Copy link
Member Author

Thanks! That did the trick, now it compiles and imports.

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

3 participants