<?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 It turned out so the TBB in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/TBB-s-Dynamic-Memory-Interface-Replacement-in-offloaded-code/m-p/970265#M23743</link>
    <description>&lt;P&gt;It turned out so that the TBB proxy overload approach works only on Windows and Linux but not in offload. Thus you cannot replace standard allocator with TBB allocator via TBB proxy overload in offload. I am not familiar to the offload execution model very much but the root cause is that by the moment offload module starts (and TBB proxy library is loaded) a standard allocator is already loaded and it is too late to overload malloc/free symbols.&lt;/P&gt;

&lt;P&gt;The most reliable way to enable TBB allocator in your offload application is replacing malloc/free with scalable_malloc/scalable_free in your code. E.g.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#define malloc(size) scalable_malloc(size)
&lt;SPAN style="font-family: Consolas, 'Lucida Console', Menlo, Monaco, 'DejaVu Sans Mono', monospace, sans-serif;"&gt;#define free(ptr) scalable_free(ptr)&lt;/SPAN&gt;&lt;/PRE&gt;

&lt;P&gt;Regards,&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Alex&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Apr 2014 08:50:25 GMT</pubDate>
    <dc:creator>Alexei_K_Intel</dc:creator>
    <dc:date>2014-04-28T08:50:25Z</dc:date>
    <item>
      <title>TBB's Dynamic Memory Interface Replacement in offloaded code</title>
      <link>https://community.intel.com/t5/Software-Archive/TBB-s-Dynamic-Memory-Interface-Replacement-in-offloaded-code/m-p/970264#M23742</link>
      <description>&lt;P&gt;I would like to try replacing the memory allocator with TBB's scalable memory allocator as detailed here:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Automically_Replacing_malloc.htm" target="_blank"&gt;http://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Automically_Replacing_malloc.htm&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I would like to do this for allocations in offload regions. &amp;nbsp;This is on windows. &amp;nbsp;What I've tried:&lt;/P&gt;

&lt;P&gt;1) Adding&amp;nbsp;&lt;/P&gt;

&lt;UL style="margin-bottom: 1em; line-height: 13.333333015441895px; list-style-image: url(http://www.threadingbuildingblocks.org/docs/help/intel_css_styles.css); color: rgb(51, 51, 51); font-family: Verdana, Arial, sans-serif;" type="disc"&gt;
	&lt;LI style="font-size: inherit; line-height: 17.333332061767578px;"&gt;
		&lt;PRE style="background-color: rgb(238, 238, 238); font-size: 10pt; font-family: 'Courier New', Courier, monospace; line-height: 14.666666030883789px; margin-bottom: 0px; margin-top: 0px;"&gt;tbbmalloc_proxy.lib /INCLUDE:"__TBB_malloc_proxy"&lt;/PRE&gt;
	&lt;/LI&gt;
&lt;/UL&gt;

&lt;P style="font-size: inherit; line-height: 17.333332061767578px;"&gt;to the link line. &amp;nbsp;This clearly only affects the host allocations&lt;/P&gt;

&lt;P style="font-size: inherit; line-height: 17.333332061767578px;"&gt;2) Adding&lt;/P&gt;

&lt;PRE style="background-color: rgb(238, 238, 238); font-size: 13px; font-family: 'Courier New', Courier, monospace; line-height: 14.666666030883789px; margin-bottom: 0px; margin-top: 0px; color: rgb(51, 51, 51);"&gt;-ltbbmalloc_proxy -ltbbmalloc&lt;/PRE&gt;

&lt;P&gt;to the offload linker options. I also had to copy the .so's to the MIC and put them in /usr/lib64.&lt;/P&gt;

&lt;P&gt;Memory allocation still seems to be slow, although I'm not sure how to definitively tell if I'm actually using the TBB allocator. &amp;nbsp;Is there anything else that I need to do?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2014 15:16:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/TBB-s-Dynamic-Memory-Interface-Replacement-in-offloaded-code/m-p/970264#M23742</guid>
      <dc:creator>John_F_1</dc:creator>
      <dc:date>2014-04-03T15:16:10Z</dc:date>
    </item>
    <item>
      <title>It turned out so the TBB</title>
      <link>https://community.intel.com/t5/Software-Archive/TBB-s-Dynamic-Memory-Interface-Replacement-in-offloaded-code/m-p/970265#M23743</link>
      <description>&lt;P&gt;It turned out so that the TBB proxy overload approach works only on Windows and Linux but not in offload. Thus you cannot replace standard allocator with TBB allocator via TBB proxy overload in offload. I am not familiar to the offload execution model very much but the root cause is that by the moment offload module starts (and TBB proxy library is loaded) a standard allocator is already loaded and it is too late to overload malloc/free symbols.&lt;/P&gt;

&lt;P&gt;The most reliable way to enable TBB allocator in your offload application is replacing malloc/free with scalable_malloc/scalable_free in your code. E.g.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#define malloc(size) scalable_malloc(size)
&lt;SPAN style="font-family: Consolas, 'Lucida Console', Menlo, Monaco, 'DejaVu Sans Mono', monospace, sans-serif;"&gt;#define free(ptr) scalable_free(ptr)&lt;/SPAN&gt;&lt;/PRE&gt;

&lt;P&gt;Regards,&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Alex&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2014 08:50:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/TBB-s-Dynamic-Memory-Interface-Replacement-in-offloaded-code/m-p/970265#M23743</guid>
      <dc:creator>Alexei_K_Intel</dc:creator>
      <dc:date>2014-04-28T08:50:25Z</dc:date>
    </item>
  </channel>
</rss>

