{"id":175121,"date":"2013-04-10T08:34:03","date_gmt":"2013-04-10T04:34:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=175121"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=175121","title":{"rendered":"<span class=\"post_title\">\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Intel Threading Building Blocks \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u0441 DLL<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Intel\u00ae Threading Building Blocks (Intel\u00ae TBB).<\/p>\n<p>  \u041c\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u043e\u0441\u0442 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/158263\/\">Windows 8: \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Intel\u00ae Threading Building Blocks<\/a> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows. \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 3 \u0434\u043b\u044f Intel TBB 4.1, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 tbb41_20130314oss \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <b>Blank App (XAML)<\/b>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0448\u0430\u0431\u043b\u043e\u043d <b>Visual C++&gt; Windows Store<\/b>. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <b>tbbSample0321<\/b>. <\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0430\u0440\u0443 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 (tbbSample0321.MainPage class). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f XAML-\u0444\u0430\u0439\u043b \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a<\/p>\n<pre><code class=\"xml\">&lt;Page     x:Class=&quot;tbbSample0321.MainPage&quot;     xmlns=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation&quot;     xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&quot;     xmlns:local=&quot;using:tbbSample0321&quot;     xmlns:d=&quot;http:\/\/schemas.microsoft.com\/expression\/blend\/2008&quot;     xmlns:mc=&quot;http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006&quot;     mc:Ignorable=&quot;d&quot;&gt;     &lt;Grid Background=&quot;{StaticResource ApplicationPageBackgroundThemeBrush}&quot;&gt;         &lt;Button Name=&quot;SR&quot; Margin=&quot;167,262,0,406&quot; Height=&quot;100&quot; Width=&quot;300&quot; Content=&quot;Press to run Simple Reduction&quot; Click=&quot;SR_Click&quot;&gt;&lt;\/Button&gt;         &lt;Button Name=&quot;DR&quot; Margin=&quot;559,262,0,406&quot; Height=&quot;100&quot; Width=&quot;300&quot; Content=&quot;Press to run Determenistic Reduction&quot; Click=&quot;DR_Click&quot;&gt;&lt;\/Button&gt;         &lt;\/Grid&gt; &lt;\/Page&gt; <\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (MainPage.xaml.h) \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438:  <\/p>\n<pre><code class=\"cpp\">#pragma once #include &quot;MainPage.g.h&quot; namespace tbbSample0321 {  public ref class MainPage sealed  {  public:  MainPage();  protected:  virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;  private:  void SR_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);  void DR_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);   }; <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Intel TBB \u0432 \u044d\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0440\u0435\u0434\u0443\u043a\u0446\u0438\u0438 (tbb::parallel_reduce) \u0438 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0434\u0443\u043a\u0446\u0438\u0438 (tbb::parallel_deterministic_reduce). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b MainPage.xaml.cpp:   <\/p>\n<pre><code class=\"cpp\">#include &quot;tbb\/tbb.h&quot; void tbbSample0321::MainPage::SR_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) {     int N=100000000;     float fr = 1.0f\/(float)N;     float sum = tbb::parallel_reduce(         tbb::blocked_range&lt;int&gt;(0,N), 0.0f,         [=](const tbb::blocked_range&lt;int&gt;& r, float sum)-&gt;float {             for( int i=r.begin(); i!=r.end(); ++i )                 sum += fr;             return sum;     },         []( float x, float y )-&gt;float {             return x+y;     }     );      SR-&gt;Content=&quot;Press to run Simple ReductionnThe answer is &quot; + sum.ToString(); }  void tbbSample0321::MainPage::DR_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) {     int N=100000000;     float fr = 1.0f\/(float)N;     float sum = tbb::parallel_deterministic_reduce(         tbb::blocked_range&lt;int&gt;(0,N), 0.0f,         [=](const tbb::blocked_range&lt;int&gt;& r, float sum)-&gt;float {             for( int i=r.begin(); i!=r.end(); ++i )                 sum += fr;             return sum;     },         []( float x, float y )-&gt;float {             return x+y;     }     );      DR-&gt;Content=&quot;Press to run Deterministic ReductionnThe answer is &quot; + sum.ToString(); } <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0439\u0442\u0435 Intel TBB \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<p>  \u0412 Visual Studio, <b>Project &gt; Properties &gt; Intel Performance Libraries<\/b>, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 <b>Use TBB<\/b> \u0432 <b>Yes<\/b>:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/28d\/7df\/883\/28d7df883eb7483b66453c6bd4c0368e.png\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0412\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437, \u0442\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e: \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 &lt;TBB_folder&gt;\/include \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <b>Additional Include Directories<\/b> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 tbb.lib \u0432 <b>Additional Library Directories<\/b>. <\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 tbb.dll \u0438 tbbmalloc.dll \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 <b>Project&gt; Add Existing Item<\/b>\u2026 <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/411\/790\/b6d\/411790b6d00ea1246a8c5f8b004210e6.png\"\/><\/p>\n<p>  \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <b>Content <\/b>\u0432 <b>Yes<\/b>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0439\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (AppX) \u0438 \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u0437\u0436\u0435.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/5fa\/559\/4c5\/5fa5594c5894286d49c138ea049aba14.png\"\/><\/p>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0451! \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows \u0433\u043e\u0442\u043e\u0432\u043e \u0438 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Intel\u00ae Threading Building Blocks.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/175121\/\"> http:\/\/habrahabr.ru\/company\/intel\/blog\/175121\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Intel\u00ae Threading Building Blocks (Intel\u00ae TBB).<\/p>\n<p>  \u041c\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u043e\u0441\u0442 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/158263\/\">Windows 8: \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Intel\u00ae Threading Building Blocks<\/a> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows. \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 3 \u0434\u043b\u044f Intel TBB 4.1, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 tbb41_20130314oss \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-175121","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/175121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=175121"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/175121\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=175121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=175121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=175121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}