<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic The static library containing in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029124#M41292</link>
    <description>&lt;P&gt;The static library containing routines with offload must be built with &lt;STRONG&gt;xiar &lt;/STRONG&gt;and the &lt;STRONG&gt;-qoffload-build&lt;/STRONG&gt; option.&amp;nbsp; The makefile details do not show how the static archive is built.&lt;/P&gt;

&lt;P&gt;If you have not already see this, the User guide section &lt;A href="https://software.intel.com/en-us/node/522513" target="_blank"&gt;&lt;STRONG&gt;About Creating Offload Libraries with xiar and xild&lt;/STRONG&gt;&lt;/A&gt; may help.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Dec 2014 13:09:03 GMT</pubDate>
    <dc:creator>Kevin_D_Intel</dc:creator>
    <dc:date>2014-12-19T13:09:03Z</dc:date>
    <item>
      <title>Offload static library problem (error 20)</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029123#M41291</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm having trouble running some offload code. The code compiled fine and appeared to execute until it needed some functions that were defined as MIC only and threw the following error:&lt;/P&gt;

&lt;P&gt;[Offload] [HOST]&amp;nbsp; [State]&amp;nbsp;&amp;nbsp; Initialize logical card 0 = physical card 0&lt;BR /&gt;
	On the remote process, dlopen() failed. The error message sent back from the sink is /var/volatile/tmp/coi_procs/1/7016/load_lib/iccoutyjfaoE: undefined symbol: bfgsfit_visibilities_mic&lt;BR /&gt;
	offload error: cannot load library to the device 0 (error code 20)&lt;BR /&gt;
	On the sink, dlopen() returned NULL. The result of dlerror() is "/var/volatile/tmp/coi_procs/1/7016/load_lib/iccoutyjfaoE: undefined symbol: bfgsfit_visibilities_mic"&lt;BR /&gt;
	[Offload] [HOST]&amp;nbsp; [State]&amp;nbsp;&amp;nbsp; Unregister data tables&lt;/P&gt;

&lt;P&gt;I read about some similar issues on the forum and it seems to me that there is some kind of linking problem. A library made with xiar (and containing the MIC code) should be linked by the following makefile:&lt;/P&gt;

&lt;P&gt;OUTPUT=&lt;BR /&gt;
	CXX=icpc&lt;/P&gt;

&lt;P&gt;$MKLROOT=/opt/intel/composer_xe_2013.5.192/mkl&lt;BR /&gt;
	IFACE_LIB=mkl_intel_lp64&lt;BR /&gt;
	THREADING_LIB=mkl_intel_thread&lt;BR /&gt;
	CORE_LIB=mkl_core&lt;/P&gt;

&lt;P&gt;LDFLAGS=-L$(MKLROOT)/lib/intel64 -l$(IFACE_LIB) -l$(THREADING_LIB) -l$(CORE_LIB) -lpthread&lt;BR /&gt;
	MIC_LDFLAGS=-L$(MKLROOT)/lib/mic -l$(IFACE_LIB) -l$(THREADING_LIB) -l$(CORE_LIB) -L$(MIC_LD_LIBRARY_PATH)&lt;/P&gt;

&lt;P&gt;#MICFLAGS =-offload-option,mic,compiler,"-DUSE_MIC -vec-report1 -g -O0 -Wall"&lt;BR /&gt;
	MICFLAGS =-offload-option,mic,compiler,"-DUSE_MIC -vec-report1 -O3 -openmp -Wall"&lt;BR /&gt;
	#MICFLAGS =-offload-option,mic,compiler,"-DUSE_MIC -O1 -profile-functions -profile-loops=all -profile-loops-report=2 -openmp"&lt;BR /&gt;
	MICLDFLAGS=-offload-option,mic,ld,"$(MIC_LDFLAGS)"&lt;/P&gt;

&lt;P&gt;CXXFLAGS +=-DUSE_MIC -g -O3 -Wall -openmp -vec-report=1 $(MICFLAGS)&lt;BR /&gt;
	#CXXFLAGS +=-DUSE_MIC&amp;nbsp; -O1 -profile-functions -profile-loops=all -profile-loops-report=2 -openmp -vec-report=1 $(MICFLAGS)&lt;/P&gt;

&lt;P&gt;CASA_LIBDIR=/home/coughlan/phi_stuff/lofar_software_install/lib&lt;BR /&gt;
	CASA_INCDIR=/home/coughlan/phi_stuff/lofar_software_install/include/casacore&lt;BR /&gt;
	CASA_LIBS=-lcasa_casa -lcasa_tables -lcasa_measures -lcasa_ms -lcfitsio&lt;/P&gt;

&lt;P&gt;#LDFLAGS=-Wl,-t,--rpath,/software/users/lofareor/SW/lib64&lt;BR /&gt;
	# -Wl,--hash-style=both&lt;/P&gt;

&lt;P&gt;# with multithread FFTW&lt;BR /&gt;
	MY_LIBS=-lsagecal&lt;BR /&gt;
	INCLUDES=-I. -I./lib -I$(CASA_INCDIR) -I/usr/include&lt;BR /&gt;
	LIBPATH=-L$(CASA_LIBDIR) -L./lib&lt;/P&gt;

&lt;P&gt;#### glib&lt;BR /&gt;
	GLIBI=-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include/&lt;BR /&gt;
	GLIBL=-lglib-2.0&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	OBJECTS=main.o data.o&lt;BR /&gt;
	default:sagecal&lt;BR /&gt;
	main.o:main.cpp&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CXX) $(CXXFLAGS) $(INCLUDES) $(GLIBI) -c $&amp;lt;&lt;BR /&gt;
	data.o:data.cpp data.h&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CXX) $(CXXFLAGS) $(INCLUDES) $(GLIBI) -c $&amp;lt;&lt;BR /&gt;
	sagecal:$(OBJECTS) ./lib/libsagecal.a&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CXX) $(CXXFLAGS) $(LDFLAGS) $(MICFLAGS) $(MICLDFLAGS) $(INCLUDES) $(GLIBI) $(LIBPATH)&amp;nbsp; -o $@&amp;nbsp; $(OBJECTS) $(MY_LIBS) $(CASA_LIBS)&amp;nbsp; $(GLIBL)&lt;BR /&gt;
	clean:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;rm *.o *.tmp *.fits&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;When I look at the library with nm I get&lt;/P&gt;

&lt;P&gt;bash-4.1$ nm -C ./lib/libsagecal.a| grep vis&lt;BR /&gt;
	0000000000002080 T predict_visibilities&lt;BR /&gt;
	0000000000003fc0 T bfgsfit_visibilities&lt;BR /&gt;
	0000000000005e30 T bfgsfit_visibilities_mic&lt;BR /&gt;
	00000000000026c0 T sagefit_visibilities&lt;BR /&gt;
	00000000000047a0 T sagefit_visibilities_mic&lt;BR /&gt;
	0000000000005220 T predict_visibilities_multifreq&lt;BR /&gt;
	0000000000004a50 t visibilities_threadfn_multifreq&lt;BR /&gt;
	bash-4.1$ nm -C sagecal| grep vis&lt;BR /&gt;
	000000000043b1e0 T predict_visibilities&lt;BR /&gt;
	0000000000443110 T predict_visibilities_multifreq&lt;BR /&gt;
	0000000000442940 t visibilities_threadfn_multifreq&lt;/P&gt;

&lt;P&gt;The function mentioned in the error (bfgsfit_visibilities_mic) is missing from the final executable. Is this the source of the problem (or is the compiled code somehow located elsewhere like the MIC.o files). If not, could you give me some pointers as to what might be the issue?&lt;/P&gt;

&lt;P&gt;Thanks for your help,&lt;/P&gt;

&lt;P&gt;Colm&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 12:27:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029123#M41291</guid>
      <dc:creator>Colm_C_</dc:creator>
      <dc:date>2014-12-19T12:27:21Z</dc:date>
    </item>
    <item>
      <title>The static library containing</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029124#M41292</link>
      <description>&lt;P&gt;The static library containing routines with offload must be built with &lt;STRONG&gt;xiar &lt;/STRONG&gt;and the &lt;STRONG&gt;-qoffload-build&lt;/STRONG&gt; option.&amp;nbsp; The makefile details do not show how the static archive is built.&lt;/P&gt;

&lt;P&gt;If you have not already see this, the User guide section &lt;A href="https://software.intel.com/en-us/node/522513" target="_blank"&gt;&lt;STRONG&gt;About Creating Offload Libraries with xiar and xild&lt;/STRONG&gt;&lt;/A&gt; may help.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 13:09:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029124#M41292</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-12-19T13:09:03Z</dc:date>
    </item>
    <item>
      <title>Thanks for the quick response</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029125#M41293</link>
      <description>&lt;P&gt;Thanks for the quick response. The library was build with those options as far as I can see. here is the makefile for the library - the MIC version of the library is also generated and the libsagecal.a file has the right MIC functions in it according to nm.&lt;/P&gt;

&lt;P&gt;CC=icc&lt;BR /&gt;
	CXX=icpc&lt;BR /&gt;
	LD=icc&lt;/P&gt;

&lt;P&gt;# MKL&lt;BR /&gt;
	#MKLROOT=/opt/intel/composer_xe_2013.5.192/mkl&lt;BR /&gt;
	IFACE_LIB=mkl_intel_lp64&lt;BR /&gt;
	THREADING_LIB=mkl_intel_thread&lt;BR /&gt;
	CORE_LIB=mkl_core&lt;/P&gt;

&lt;P&gt;LDFLAGS=-L$(MKLROOT)/lib/intel64 -l$(IFACE_LIB) -l$(THREADING_LIB) -l$(CORE_LIB) -lpthread -lm&lt;BR /&gt;
	MIC_LDFLAGS=-L$(MKLROOT)/lib/mic -l$(IFACE_LIB) -l$(THREADING_LIB) -l$(CORE_LIB)&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	##CFLAGS +=-DUSE_MIC -Wall -DDEBUG -g -O0 -openmp -vec-report=1&lt;BR /&gt;
	#CFLAGS +=-DUSE_MIC -Wall -O1 -profile-functions -profile-loops=all -profile-loops-report=2 -openmp&lt;BR /&gt;
	CFLAGS +=-DUSE_MIC -Wall -O3 -openmp -vec-report=1&lt;BR /&gt;
	#MICFLAGS =-offload-option,mic,compiler,"-DUSE_MIC -vec-report1 -g -O0 -Wall"&lt;BR /&gt;
	MICFLAGS =-offload-option,mic,compiler,"-DUSE_MIC -vec-report1 -O3 -openmp -Wall"&lt;BR /&gt;
	#MICFLAGS =-offload-option,mic,compiler,"-DUSE_MIC -O1 -profile-functions -profile-loops=all -profile-loops-report=2 -openmp"&lt;BR /&gt;
	MICLDFLAGS=-offload-option,mic,ld,"$(MIC_LDFLAGS)"&lt;/P&gt;

&lt;P&gt;#LAPACK=-L/usr/lib/atlas/sse -llapack -lblas&lt;BR /&gt;
	#LAPACK=-L/usr/local/GotoBLAS2/lib -lgoto2 -lpthread -lgfortran&lt;BR /&gt;
	LAPACK=-L/usr/local/OpenBLAS/lib/ -lopenblas -lgfortran -lpthread&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	INCLUDES= -I.&lt;BR /&gt;
	LIBPATH=&lt;/P&gt;

&lt;P&gt;#### glib&lt;BR /&gt;
	GLIBI=-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include/&lt;BR /&gt;
	GLIBL=-lglib-2.0&lt;/P&gt;

&lt;P&gt;OBJECTS=readsky.o dataio.o predict.o lmfit_nocuda.o clmfit_nocuda.o lbfgs_nocuda.o myblas.o residual.o robustlm.o updatenu.o robust_lbfgs_nocuda.o&lt;BR /&gt;
	#&amp;nbsp; clmfit_nocudaMIC.o lmfit_nocudaMIC.o robust_lbfgs_nocudaMIC.o updatenuMIC.o\&lt;BR /&gt;
	lbfgs_nocudaMIC.o myblasMIC.o robustlmMIC.o&lt;/P&gt;

&lt;P&gt;default:libsagecal.a&lt;BR /&gt;
	readsky.o:readsky.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	dataio.o:dataio.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	predict.o:predict.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	lmfit_nocuda.o:lmfit_nocuda.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	clmfit_nocuda.o:clmfit_nocuda.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	lbfgs_nocuda.o:lbfgs_nocuda.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	myblas.o:myblas.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	residual.o:residual.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	robustlm.o:robustlm.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	updatenu.o:updatenu.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;BR /&gt;
	robust_lbfgs_nocuda.o:robust_lbfgs_nocuda.c&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(CC) $(CFLAGS) $(INCLUDES) $(GLIBI)&amp;nbsp; -c $&amp;lt;&lt;/P&gt;

&lt;P&gt;RANLIB=ranlib&lt;BR /&gt;
	libsagecal.a:$(OBJECTS) sagecal.h&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;xiar -qoffload-build rcs $@ $(OBJECTS); \&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;$(RANLIB) $@;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 13:26:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029125#M41293</guid>
      <dc:creator>Colm_C_</dc:creator>
      <dc:date>2014-12-19T13:26:49Z</dc:date>
    </item>
    <item>
      <title>As the library did not seem</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029126#M41294</link>
      <description>&lt;P&gt;As the library did not seem to be linking properly I just moved all the object and MIC object files into the directory with the source code and changed the makefile to link them directly. Running nm on the executable shows that the missing MIC functions are now present and the code works as expect. I'm still not sure what I was doing wrong (the library was being built with the options mentioned), but at least it works. Thanks for your help - if you've any idea why the library doesn't work I'd still be interested to know.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 15:41:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-static-library-problem-error-20/m-p/1029126#M41294</guid>
      <dc:creator>Colm_C_</dc:creator>
      <dc:date>2014-12-19T15:41:07Z</dc:date>
    </item>
  </channel>
</rss>

