alt_rng library on random numbers generation from map functions


Problem : 

alt_rng library on random numbers generation from map functions yields the following exception:

Ct Exception:
Error Code: -1
Description:assert failed!!! Location: ../../../src/jit/hlo/lower_map.cpp:1202, expression=(op == CtFacilityOpCode(CT_OP_extract, Sig_1_2, op.getTypeCode())|| op.getGroupKind() == FACILITY_replaceElement|| op.isAssign()|| op.getGroupKind() == SPECIAL_phiNode), info=
Location:
RCALL[0x421930] [v@BOBOBOBOBOBOBOBOBOBOBOBOBOBOBOBRBRBRBR]
Map<0x41bfc0>

terminate called after throwing an instance of 'Ct::Exception'
Abort (core dumped)

Environment : 

Ct Beta 2 for Linux

Root Cause : 

Exceptions in fixed code raise only on O2 and O3 optimization levels (you will not see them from debugging environment: export CT_OPT_LEVEL=O0 && ./opt_intel64/ct2).

Ct User’s Guide provides the following information: “If runtime issues appear with the optimization level O2 or O3, you may try to set CT_OPT_LEVEL=O0. If the level O0 succeeds, the issues possibly is caused by the Intel's Ct Technology stack.”

The feature is not fully supported by Ct for now, but that will change in Beta 3.


Resolution : 

Because of problem with alt_rng library on random numbers generation from map functions you can replace it with another one (randomlib from Ct samples, which uses poisson-solver sample in map function).

Please note that randomlib provided like source, not compiled library.

So, compilation from command line requires:
1) Set up Ct environment by command source <install_dir>/tools/set_env.sh intel64 (or ia32);
2) Enter directory samples/finance/randomlib and run make command to build randomlib;
[root@nntcl06-2qc 1.0.0.009]# cd samples/finance/randomlib/
[root@nntcl06-2qc randomlib]# make
[CC] ct_random_dll.cpp
[CC] ct_random_lcg.cpp
[CC] ct_random_mcg.cpp
[CC] ct_random_mrg.cpp
[CC] ct_random_mt.cpp
[CC] ct_random_r250.cpp
[CC] ct_random_wh.cpp
[CC] ct_random_ncall.cpp
g++ -m64 -shared -g -o ./lib/intel64/libctrandomd.so ./dbg_intel64/ct_random_dll.o ./dbg_intel64/ct_random_lcg.o ./dbg_intel64/ct_random_mcg.o ./dbg_intel64/ct_random_mrg.o ./dbg_intel64/ct_random_mt.o ./dbg_intel64/ct_random_r250.o ./dbg_intel64/ct_random_wh.o ./dbg_intel64/ct_random_ncall.o -L../../../lib/intel64 -lctd
[CC] ct_random_dll.cpp
[CC] ct_random_lcg.cpp
[CC] ct_random_mcg.cpp
[CC] ct_random_mrg.cpp
[CC] ct_random_mt.cpp
[CC] ct_random_r250.cpp
[CC] ct_random_wh.cpp
[CC] ct_random_ncall.cpp
g++ -m64 -shared -o ./lib/intel64/libctrandom.so ./opt_intel64/ct_random_dll.o ./opt_intel64/ct_random_lcg.o ./opt_intel64/ct_random_mcg.o ./opt_intel64/ct_random_mrg.o ./opt_intel64/ct_random_mt.o ./opt_intel64/ct_random_r250.o ./opt_intel64/ct_random_wh.o ./opt_intel64/ct_random_ncall.o -L../../../lib/intel64 -lct
3) Now you may compile fixed source by using the following command line (chose correct way to library according to OS version: ia32 or intel64):
g++ ct2.cpp -o ct2 -I/opt/intel/ct/1.0.0.009/include -L/opt/intel/ct/1.0.0.009/samples/finance/randomlib/lib/intel64/ -lctrandom -lct

But please note that compilation using make files (not command line) is a recommended way to build Ct application according to Ct User’s Guide: “Creating an Intel's Ct Technology Project on Linux* OS” section.

Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.