<?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 Most likely the address a in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117917#M74822</link>
    <description>&lt;P&gt;Most likely the address a+iter_db+a_disp&lt;J&gt; is not 64-byte aligned.&lt;/J&gt;&lt;/P&gt;

&lt;P&gt;That expression probably assumes that some variables on MIC are aligned. I suspect the corresponding variables on the CPU are not 64-byte aligned, else the compiler would have aligned the MIC variables also on a 64-byte boundary.&lt;/P&gt;

&lt;P&gt;One way to force alignment on MIC is to add&amp;nbsp;the "align(64)"modifier whenever you use the ALLOC modifier (which I assume does alloc_if(1) free_if(0)).&lt;/P&gt;

&lt;P&gt;However, since the CPU data does not have matching alignment, the CPU and MIC variables will not have the same offset within a 64-byte boundary, and data transfer will be slightly slower.&lt;/P&gt;

&lt;P&gt;The best thing to do is to &lt;STRONG&gt;align the CPU variable on a 64-byte boundary &lt;/STRONG&gt;and to not use the "align(64)" modifier. Then, the MIC variable will also be 64-byte aligned, you should not get an alignment fault, and the mutual alignment within 64 bytes of CPU and MIC variables will make data transfer optimal.&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2016 17:11:05 GMT</pubDate>
    <dc:creator>Rajiv_D_Intel</dc:creator>
    <dc:date>2016-05-05T17:11:05Z</dc:date>
    <item>
      <title>Offload into MIC (Xeon Phi) error iterating over loaded array</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117916#M74821</link>
      <description>&lt;TABLE&gt;
	&lt;TBODY&gt;
		&lt;TR&gt;
			&lt;TD class="votecell"&gt;
				&lt;DIV class="vote"&gt;
					&lt;DIV class="favoritecount"&gt;&amp;nbsp;&lt;/DIV&gt;
				&lt;/DIV&gt;
			&lt;/TD&gt;
			&lt;TD class="postcell"&gt;
				&lt;DIV&gt;
					&lt;DIV class="post-text" itemprop="text"&gt;
						&lt;P&gt;I have problems when offloading some data structures to my MIC.&lt;/P&gt;

						&lt;P&gt;I am offloading into MIC with the following directives:&lt;/P&gt;

						&lt;PRE class="lang-c prettyprint prettyprinted" style=""&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;    &lt;/SPAN&gt;&lt;SPAN class="com"&gt;#pragma&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; offload target&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;mic&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;mic_no&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;\
    inout&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;is_selected &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; length&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;query_sequences_count&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;ALLOC&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;\
    in&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;length&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a_size&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; ALLOC&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;\
    in&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a_disp&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;length&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;offload_db_count&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;ALLOC&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;

						&lt;P&gt;However if I try to execute inside the offloaded region:&lt;/P&gt;

						&lt;PRE class="lang-c prettyprint prettyprinted" style=""&gt;&lt;CODE&gt;&lt;SPAN class="com"&gt;//loads next 64 characters of a into datadb&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
__m512i datadb __attribute__ &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;((&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;aligned&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;64&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)));&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
datadb &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; _mm512_load_epi32&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;iter_db&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a_disp&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;j&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]);&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;

						&lt;P&gt;This causes the following error:&lt;/P&gt;

						&lt;PRE class="lang-c prettyprint prettyprinted" style=""&gt;&lt;CODE&gt;&lt;SPAN class="typ"&gt;Offload&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; error&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;process on the device &lt;/SPAN&gt;&lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; was terminated by signal &lt;/SPAN&gt;&lt;SPAN class="lit"&gt;11&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;SIGSEGV&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;

						&lt;P&gt;But if I instead copy the content of a into another array like this:&lt;/P&gt;

						&lt;PRE class="lang-c prettyprint prettyprinted" style=""&gt;&lt;CODE&gt;&lt;SPAN class="kwd"&gt;char&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; db&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;64&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;];&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;window_db_iter &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; window_db_iter &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit"&gt;64&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; window_db_iter&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;++)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
    db&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;window_db_iter&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;*(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;iter_db&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;a_disp&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;j&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;window_db_iter&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;);&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;

&lt;/SPAN&gt;&lt;SPAN class="com"&gt;//Now this works fine&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
datadb &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; _mm512_load_epi32&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;db&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;);&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;

						&lt;P&gt;I have checked that a offloads with the correct length, a_size is the size of a and that a_disp is correct as well. Also &lt;CODE&gt;a+iter_db+a_disp&lt;J&gt;&lt;/J&gt;&lt;/CODE&gt; remains always inside the bounds of memory. My guess is that it has to do with the process of copying the memory onto the MIC. Any ideas?&lt;/P&gt;

						&lt;P&gt;Thanks!&lt;/P&gt;
					&lt;/DIV&gt;
				&lt;/DIV&gt;
			&lt;/TD&gt;
		&lt;/TR&gt;
	&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 05 May 2016 14:37:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117916#M74821</guid>
      <dc:creator>Felipe_S_</dc:creator>
      <dc:date>2016-05-05T14:37:50Z</dc:date>
    </item>
    <item>
      <title>Most likely the address a</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117917#M74822</link>
      <description>&lt;P&gt;Most likely the address a+iter_db+a_disp&lt;J&gt; is not 64-byte aligned.&lt;/J&gt;&lt;/P&gt;

&lt;P&gt;That expression probably assumes that some variables on MIC are aligned. I suspect the corresponding variables on the CPU are not 64-byte aligned, else the compiler would have aligned the MIC variables also on a 64-byte boundary.&lt;/P&gt;

&lt;P&gt;One way to force alignment on MIC is to add&amp;nbsp;the "align(64)"modifier whenever you use the ALLOC modifier (which I assume does alloc_if(1) free_if(0)).&lt;/P&gt;

&lt;P&gt;However, since the CPU data does not have matching alignment, the CPU and MIC variables will not have the same offset within a 64-byte boundary, and data transfer will be slightly slower.&lt;/P&gt;

&lt;P&gt;The best thing to do is to &lt;STRONG&gt;align the CPU variable on a 64-byte boundary &lt;/STRONG&gt;and to not use the "align(64)" modifier. Then, the MIC variable will also be 64-byte aligned, you should not get an alignment fault, and the mutual alignment within 64 bytes of CPU and MIC variables will make data transfer optimal.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 17:11:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117917#M74822</guid>
      <dc:creator>Rajiv_D_Intel</dc:creator>
      <dc:date>2016-05-05T17:11:05Z</dc:date>
    </item>
    <item>
      <title>Thanks, you were right. It</title>
      <link>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117918#M74823</link>
      <description>&lt;P&gt;Thanks, you were right. It works now when using the align(64) modifier.&lt;BR /&gt;
	I'll try to align myself the CPU variable now so that the data transfer will be faster.&lt;/P&gt;

&lt;P&gt;Thanks again!&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 07:10:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offload-into-MIC-Xeon-Phi-error-iterating-over-loaded-array/m-p/1117918#M74823</guid>
      <dc:creator>Felipe_S_</dc:creator>
      <dc:date>2016-05-06T07:10:14Z</dc:date>
    </item>
  </channel>
</rss>

