Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.

QuantLib compilatoin with icx

Niko_
Employee
1,130 Views

.I’ve been trying to compile the Quantlib library with the icx compiler in order to provide a comparison of the efficiency between it and classic compilers. While I’ve managed to do it with g++ it seems that icx gives me compilation errors (found in the attached txt) in the form of undefined references. to me it seems the problem might lie with the boost distribution so I’ve followed the instructions found here https://www.boost.org/doc/libs/1_77_0/more/getting_started/unix-variants.html to make sure that the build binaries are made for the intel toolset. 

 

The built process for QauntLib is described here https://www.quantlib.org/install/linux.shtml. One can specify the build compiler using the ./configure file.

I'm using the 2021.3.0 version of icx.

0 Kudos
1 Solution
VidyalathaB_Intel
Moderator
753 Views

Hi,

 

>>What gcc version was used in your successful attempt?t

 

I've used gcc 11.1.0 version.

 

>>Was boost installed using the process mentioned before

 

I've followed the same steps which you have mentioned for building boost library.

 

I did not get any such errors that you have mentioned in your previous post while doing "make" step.

 

>>If instead I use gcc 5.3.0 it passes the compilation but the previous problem when the test-suite is not compiled persists.

 

Could you please confirm if you have seen any warnings (as mentioned below) while configuring the QuantLib?

 

"checking for Boost.Test... no

configure: WARNING: Boost unit-test framework not found.

configure: WARNING: The test suite will be disabled."

 

If this has occurred then the test-suite will not get compiled.

 

Please specify the path of boost linker libraries that are located in /stage/lib folder while configuring QuantLib library (we see that you have given --with-boost-lib=~/quant-icx .)

 

This is already mentioned in the boost installation page from where you have followed the steps to build.

 

"Building the special stage target places Boost library binaries in the stage/lib/ subdirectory of the Boost tree"

 

By following the above, I'm able to compile the QuantLib library including test-suite successfully.

 

Hope the provided information helped and do let us know if the issue still persists.

 

Regards,

Vidya.

 

 

 

View solution in original post

8 Replies
VidyalathaB_Intel
Moderator
1,055 Views

Hi,


Thanks for reaching out to us.


>>While I’ve managed to do it with g++ it seems that icx gives me compilation errors


From the attached file, we see that there are undefined references to standard C++ functions, this is because icx will not use the standard C++ libraries automatically

Instead of using icx compiler, you can try compiling the QuantLib using icpx which allows the compiler to use standard C++ libraries automatically.

 

Please refer to the following link under the NOTE section

https://software.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-gui...


>>I'm using the 2021.3.0 version


The latest version 2021.4 is also available for download, you can update and check with the latest version as well.


So please try using icpx and do let us know if it resolves the issue.


Regards,

Vidya.


Niko_
Employee
990 Views

The compilation error does no longer appear. However, the tests for the library do not compile, instead code from the makefile being spitted out:

Making all in test-suite
make[1]: Entering directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23/test-suite'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23/test-suite'
make[1]: Entering directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23'
if test 'emacs' != no; then \
  am__dir=. am__subdir_includes=''; \
  case quantlib.elc in */*) \
    am__dir=`echo 'quantlib.elc' | sed 's,/[^/]*$,,'`; \
    am__subdir_includes="-L $am__dir -L ./$am__dir"; \
  esac; \
  test -d "$am__dir" || /usr/bin/mkdir -p "$am__dir" || exit 1; \
  emacs --batch \
      \
    $am__subdir_includes -L . -L . \
    --eval '(if (boundp (quote byte-compile-dest-file-function)) (setq byte-compile-dest-file-function (lambda (_) "quantlib.elc")) (defun byte-compile-dest-file (_) "quantlib.elc") )' \
    -f batch-byte-compile 'quantlib.el'; \
else :; fi
Loading /usr/share/emacs/site-lisp/site-start.d/cmake3-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/systemtap-init.el (source)...
Wrote quantlib.elc
make[1]: Leaving directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23'
VidyalathaB_Intel
Moderator
944 Views

Hi,

 

Thanks for trying with icpx and providing the error log.

 

>>the tests for the library do not compile, instead code from the makefile being spitted out:

 

We tried compiling the Quantlib with icpx and the compilation is successful. We also tried running the test-suite for verification and it is working fine, no errors are detected.

 

Here are the steps that we followed (please follow the below steps after doing make clean to avoid any errors)

 

 > ./configure CXX=icpx CXXFLAGS='-fp-model=precise'

 

Without -fp-model=precise option we observed some errors ( divide by zero conditions which leads to NaN's), by using this precise option we can avoid such conditions which are not value safe.

 https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-an...

 

 > make

VidyalathaB_Intel_0-1634553505837.png

 > make install

 

 > sudo ldconfig

 

 > ./quantlib-test-suite

VidyalathaB_Intel_1-1634553557895.png

Please do let us know if it resolves the issue.

 

 Regards,

 Vidya.

 

Niko_
Employee
920 Views

What version of boost was used? I've tried with boost 1.77 built as follows :

tar xvf boost_1_77_0.tar.gz
cd ./boost_1_77_0/tools/build
./bootstrap.sh
./b2 install --prefix=~/ toolset=intel
export PATH=~/bin:$PATH
cd ../../
b2 --build-dir=~/quant-icx toolset=intel stage

Which follows the build instructions found on the boost site.

 

the the configuration is run as :

./configure --with-boost-include=~/boost_1_77_0 --with-boost-lib=~/quant-icx CXX=icpx CXXFLAGS='-fp-model=precise'

 

This however gives the following error: 

In file included from gaussianlhplossmodel.cpp:21:
In file included from ../../../ql/experimental/credit/gaussianlhplossmodel.hpp:33:
In file included from ../../../ql/experimental/math/latentmodel.hpp:29:
In file included from ../../../ql/experimental/math/tcopulapolicy.hpp:27:
In file included from /nfs/home2/nradulov/boost_1_77_0/boost/math/distributions/students_t.hpp:16:
In file included from /nfs/home2/nradulov/boost_1_77_0/boost/math/special_functions/beta.hpp:15:
In file included from /nfs/home2/nradulov/boost_1_77_0/boost/math/special_functions/gamma.hpp:30:
In file included from /nfs/home2/nradulov/boost_1_77_0/boost/math/special_functions/lanczos.hpp:2705:
In file included from /nfs/home2/nradulov/boost_1_77_0/boost/math/special_functions/detail/lanczos_sse2.hpp:13:
In file included from /nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/emmintrin.h:31:
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:54:3: error: argument to '__builtin_prefetch' must be a constant integer
  __builtin_prefetch (__P, (__I & 0x4) >> 2, __I & 0x3);
  ^                        ~~~~~~~~~~~~~~~~
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:130:19: error: use of undeclared identifier '__builtin_ia32_addss'
  return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:136:19: error: use of undeclared identifier '__builtin_ia32_subss'
  return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:142:19: error: use of undeclared identifier '__builtin_ia32_mulss'
  return (__m128) __builtin_ia32_mulss ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:148:19: error: use of undeclared identifier '__builtin_ia32_divss'; did you mean '__builtin_ia32_minss'?
  return (__m128) __builtin_ia32_divss ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:142:19: note: '__builtin_ia32_minss' declared here
  return (__m128) __builtin_ia32_mulss ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:242:10: error: use of undeclared identifier '__builtin_ia32_andps'; did you mean '__builtin_ia32_haddps'?
  return __builtin_ia32_andps (__A, __B);
         ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:242:10: note: '__builtin_ia32_haddps' declared here
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:248:10: error: use of undeclared identifier '__builtin_ia32_andnps'
  return __builtin_ia32_andnps (__A, __B);
         ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:254:10: error: use of undeclared identifier '__builtin_ia32_orps'
  return __builtin_ia32_orps (__A, __B);
         ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:260:10: error: use of undeclared identifier '__builtin_ia32_xorps'
  return __builtin_ia32_xorps (__A, __B);
         ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:288:19: error: use of undeclared identifier '__builtin_ia32_movss'
  return (__m128) __builtin_ia32_movss ((__v4sf) __A,
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:298:19: error: use of undeclared identifier '__builtin_ia32_movss'
  return (__m128) __builtin_ia32_movss ((__v4sf) __A,
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:326:19: error: use of undeclared identifier '__builtin_ia32_movss'
  return (__m128) __builtin_ia32_movss ((__v4sf) __A,
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:336:19: error: use of undeclared identifier '__builtin_ia32_movss'
  return (__m128) __builtin_ia32_movss ((__v4sf) __A,
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:380:19: error: use of undeclared identifier '__builtin_ia32_cmpgtps'; did you mean '__builtin_ia32_cmpltps'?
  return (__m128) __builtin_ia32_cmpgtps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:368:19: note: '__builtin_ia32_cmpltps' declared here
  return (__m128) __builtin_ia32_cmpltps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:386:19: error: use of undeclared identifier '__builtin_ia32_cmpgeps'; did you mean '__builtin_ia32_cmpleps'?
  return (__m128) __builtin_ia32_cmpgeps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:374:19: note: '__builtin_ia32_cmpleps' declared here
  return (__m128) __builtin_ia32_cmpleps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:410:19: error: use of undeclared identifier '__builtin_ia32_cmpngtps'; did you mean '__builtin_ia32_cmpnltps'?
  return (__m128) __builtin_ia32_cmpngtps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:380:19: note: '__builtin_ia32_cmpnltps' declared here
  return (__m128) __builtin_ia32_cmpgtps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:416:19: error: use of undeclared identifier '__builtin_ia32_cmpngeps'; did you mean '__builtin_ia32_cmpnleps'?
  return (__m128) __builtin_ia32_cmpngeps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:386:19: note: '__builtin_ia32_cmpnleps' declared here
  return (__m128) __builtin_ia32_cmpgeps ((__v4sf)__A, (__v4sf)__B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:602:19: error: use of undeclared identifier '__builtin_ia32_cvtsi2ss'; did you mean '__builtin_ia32_cvtsd2ss'?
  return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B);
                  ^
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:602:19: note: '__builtin_ia32_cvtsd2ss' declared here
/nfs/home/tools/gcc/11.2.0/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/xmmintrin.h:602:58: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(double)))) double' (vector of 2 'double' values) with an lvalue of type 'int'
  return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B);
                                                         ^~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[4]: *** [gaussianlhplossmodel.lo] Error 1
make[4]: Leaving directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23/ql/experimental/credit'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23/ql/experimental'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23/ql'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/nfs/home2/nradulov/quant-icx/QuantLib-1.23/ql'
make: *** [all-recursive] Error 1

 

If instead I use gcc 5.3.0 it passes the compilation but the previous problem when the test-suite is not compiled persists.  My guess is that this has to be a problem with the way I have built boost but I cannot figure out what  have done wrong. 

VidyalathaB_Intel
Moderator
815 Views

Hi,

 

>>What version of boost was used?

 

I've tried with the boost 1.77 version. Could you please try adding -xHost option while configuring the QuantLib library?

 

Regards,

Vidya.

 

Niko_
Employee
781 Views

I have added -xHost as follows to the Quantlib configuration;

./configure --with-boost-include=~/boost_1_77_0 --with-boost-lib=~/quant-icx CXX=icpx CXXFLAGS='-fp-model=precise -xHost'

 

But this however does not fix the issues mentioned before.

What gcc version was used in your successful attempt? 

Was boost installed using the process mentioned before, or was it installed with root access? 

i have tried with both oneapi 2021.3.0 and oneapi 2021.4.0 and both fail. 

VidyalathaB_Intel
Moderator
754 Views

Hi,

 

>>What gcc version was used in your successful attempt?t

 

I've used gcc 11.1.0 version.

 

>>Was boost installed using the process mentioned before

 

I've followed the same steps which you have mentioned for building boost library.

 

I did not get any such errors that you have mentioned in your previous post while doing "make" step.

 

>>If instead I use gcc 5.3.0 it passes the compilation but the previous problem when the test-suite is not compiled persists.

 

Could you please confirm if you have seen any warnings (as mentioned below) while configuring the QuantLib?

 

"checking for Boost.Test... no

configure: WARNING: Boost unit-test framework not found.

configure: WARNING: The test suite will be disabled."

 

If this has occurred then the test-suite will not get compiled.

 

Please specify the path of boost linker libraries that are located in /stage/lib folder while configuring QuantLib library (we see that you have given --with-boost-lib=~/quant-icx .)

 

This is already mentioned in the boost installation page from where you have followed the steps to build.

 

"Building the special stage target places Boost library binaries in the stage/lib/ subdirectory of the Boost tree"

 

By following the above, I'm able to compile the QuantLib library including test-suite successfully.

 

Hope the provided information helped and do let us know if the issue still persists.

 

Regards,

Vidya.

 

 

 

VidyalathaB_Intel
Moderator
680 Views

Hi,


Thanks for accepting our solution.

As the issue is resolved we are closing this thread. Please post a new question if you need any additional information from Intel as this thread will no longer be monitored.


Have a Nice Day!


Regards,

Vidya.


Reply