<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated on Wed, 25 Nov 2009 05:56:58 -0800 -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <atom:link href="http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-kb/type/sample-code/feed/" rel="self" type="application/rss+xml" />
    <title>Intel Software Network articles feed</title>
    <link>http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-kb/sample-code/</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Unable to read and write using C++ file stream </title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><b>Problem : </b><br />For years in Fortran95, I've been reading and writing files into various directories of my choice, thus keeping our data files in an orderly fashion. However, now I am shocked to find that you can't do anything like that in C++. <br /><br />Please tell me if there is a way, and give me an example.<br /><br /><b>Environment : </b><br />Intel C++ compiler for Linux*<br /><br /><b>Resolution : </b><br /><br />This is not a compiler issue. You need to have suitable access rights to the file. You can take help from system administrator to get suitable access rights for the file. I am providing a sample test case that I tried at my end in FC11 box. It works without issue.<br /><br />
<pre name="code" class="cpp">// file_rw.cpp
//

#include &lt;fstream&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{
    char str[2000] ;
    fstream fs( "/testdir/prt1.txt", ios::in ) ;

    if(!fs) {
        cout &lt;&lt; "Cannot open input file.\n";
        return 1;
    }

    fstream ft( "/testdir/prt2.txt", ios::out | ios::in ) ;
    if(!ft) {
        cout &lt;&lt; "Cannot open output file.\n";
        return 1;
    }

    while ( !fs.eof() )
    {
        fs.getline(str, 2000 ) ;
        ft &lt;&lt; str &lt;&lt; endl;
    }
    fs.close () ;
    ft.close ();
    return 0;
}</pre>
</div> ]]></description>
      <link>http://software.intel.com/en-us/articles/unable-to-read-and-write-using-c-file-stream</link>
      <pubDate>Sun, 23 Aug 2009 23:36:07 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/unable-to-read-and-write-using-c-file-stream#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/unable-to-read-and-write-using-c-file-stream</guid>
      <category>Intel® Parallel Composer</category>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
      <category>Intel® Parallel Composer Knowledge Base</category>
    </item>
    <item>
      <title>Samples changes in Intel® IPP 6.1</title>
      <description><![CDATA[ <p><strong>Intel® IPP 6.1 Samples changes</strong><br /><br /><strong>DMIP:</strong> This sample code package is available only on Intel IPP for Windows* and not on Linux and contains headers and prebuilt binary modules for DMIP layer which statically linked with IPP libraries, DMIP users manual, sources for .NET interface for DMIP layer and sources for GUI application which demonstrates implementation of harmonization filter with DMIP API and sources for simple command line application which also show how to use DMIP API in some image processing tasks.<br /><br />The changes in IPP 6.1 DMIP are <br /><br />• New operations:<br />      oFiltering<br />          FFT<br />          DFT <br />          Basic morphology operations<br />• Erosion<br />• Dilation <br />     o Pixelwise <br />          Weighted addition<br />• C# interface extension<br />     o New operations<br />     o Threading control<br />• Compiled graph serialization/deserialization for real deferred execution.<br />• Sepia toner workload example<br />• System API threading instead of OpenMP threading.<br />• Thread affinity.<br />     o Best configuration for system is chosen.<br />• Four graph execution models:<br />     o Debug<br />     o Light <br />     o Middle<br />     o Aggressive<br /><br /><strong>UIC Sample Code:</strong> The Unified Image Codec samples demonstrate how to use UIC interface in image processing application. There are two demo applications, the first one is simple command line image transcoder and the second one is GUI application which demonstrates implementation of computer vision algorithms with functions provided by Intel ® IPP and basic content based image retrieval (CBIR) functionality based on MPEG7 image feature descriptors. The set of functions used in the this sample includes functions for JPEG/JPEG2000/RLE/DDS/PNG/PNM/BMP encoding/decoding, DICOM decoding, image filtering and computer vision algorithms like face detection, inpainting and image segmentation. <br /><br />PNG/PNM/BMP support has been added in Intel IPP 6.1 UIC samples.<br /><br /><br /><strong>Legacy Samples:</strong> The following samples which were available in previous versions of the main Intel IPP samples package are now became legacy samples and available as a separate download. This sample package will be updated less frequently than our other sample code. <br /><br />• image-codecs: jpeg2000, jpeg-ijl, jpegview samples (this is the old image codec implementation)<br />• language-interface: Delphi &amp; dotnet-vb samples <br />• speech-recognition<br /><br /><br /><strong>IPP Samples:</strong> The main ipp samples packages include the following:<br /><br />• advanced-usage<br />• audio-video-codecs <br />• data-compression<br />• image-codecs <br />• image-processing<br />• language-interface<br />• realistic-rendering<br />• signal-processing<br />• speech-codecs<br />• string-processing<br /><br />Face detection samples are added as part of image-processing sample in Intel IPP 6.1<br /><br /><strong>Intel® IPP 6.1 on Windows standalone, Intel® Parallel Studio, Intel® Parallel Composer<br /></strong><br />The samples included are designed to illustrate Intel IPP function usages in Image Processing, Signal Processing, String Processing and language support for C++ and C#. All samples are provided as Visual Studio solutions and also contain command-line build instructions in the sources or in a *.bat file.<br /><br />• Image Processing (ipp-samples-image): Illustrates how to call Intel IPP image processing, color coverstiona dn computer vision fuctions in Vistual Studio. <br />• Signal Processing (ipp-samples-signal): Illustrates how to call Intel IPP Signal Processing functions and some string processing functions. <br />• String Processing (ipp-samples-string): The ippgrep sample demonstrates how to use functions that perform matching operations with the Perl-compatible regular expression patterns provided by Intel IPP String Processing Functions<br />• Language Interface Support (ipp-samples-language): Illustrate Intel IPP usage in Microsoft* C# .NET and C++ Applications.</p> ]]></description>
      <link>http://software.intel.com/en-us/articles/sample-changes-in-intel-ipp</link>
      <pubDate>Mon, 22 Jun 2009 23:58:00 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/sample-changes-in-intel-ipp#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/sample-changes-in-intel-ipp</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
      <category>Intel® Integrated Performance Primitives Knowledge Base</category>
      <category>Intel® Parallel Composer Knowledge Base</category>
    </item>
    <item>
      <title>Intel® IPP sample code</title>
      <description><![CDATA[ <!--CTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dt-->
<table border="0" cellpadding="0" cellspacing="15">
<tbody>
<tr>
<td class="bodycopy">
<p>There are 3 types of Intel® IPP sample code that are available for developers to learn how to use the Intel Integrated Performance Primitives. Each type is designed to demonstrate how to build software with Intel IPP functions. Each link in the table below contains information on downloading the sample files.<br /><strong class="sectionBody"><br />
<table border="1" cellpadding="0" cellspacing="1">
<tbody>
<tr>
<td>
<p>Type</p>
</td>
<td>
<p>Description</p>
</td>
</tr>
<tr>
<td>
<p><a href="http://developer.intel.com/software/products/ipp/samples.htm">Application-level Samples</a></p>
</td>
<td>
<p>These sample code illustrate how to build a wide variety of applications such as:</p>
<p align="left">•   Audio/Video/Image/Speech encoding/decoding (H.264, MPEG-4, MP3, JPEG, JPEG2000, G.729, more)</p>
<p align="left">•   Data Compression libraries to suport zlib, gzip and bzip2</p>
<p align="left">•   Image/Signal Processing</p>
<p align="left">•   Product linkage usage models</p>
<p align="left">•    Multiple programming language support (C#, C++, VB, Java, FORTRAN, Delphi, etc)</p>
<p align="left">•    Cryptography usage to support OpenSSL</p>
<p align="left">•    More.</p>
<p>Instructions on how to build the samples are described in a Readme file contained in the sample installation package.<br /><br />These samples are updated via each product release with new features and bug fixes. Please find more information from <a href="http://www.intel.com/software/products/ipp/samples.htm">Intel IPP sample page</a>.</p>
</td>
</tr>
<tr>
<td>
<p><a href="http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-intel-ipp-source-code-examples">Source Code Files</a></p>
</td>
<td>
<p>These platform independent examples show basic techniques for using Intel IPP functions to perform operations including:</p>
<p align="left">•    performance measurement</p>
<p align="left">•    time-domain filtering</p>
<p align="left">•    affine transformation</p>
<p align="left">•    canny edge detection</p>
<p>and more. Each example consists of 1-3 source code files (.cpp). The complete examples are included in <a href="http://www.intel.com/intelpress/sum_ipp2.htm">Intel IPP book</a></p>
</td>
</tr>
<tr>
<td>
<p><a href="http://developer.intel.com/software/products/ipp/docs/manuals.htm">Code Snippets</a></p>
</td>
<td>
<p>Code snippets are very short programs which demonstrate how to call a particular Intel IPP function. Numerous code snippets are contained in the Intel IPP Manuals (.pdf) as part of the documentation text.   They can be also found at the <a href="http://www3.intel.com/cd/software/products/asmo-na/eng/346532.htm">Intel IPP Document web site</a>.</p>
</td>
</tr>
<tr>
<td>
<p>Examples for Hot Functions</p>
</td>
<td>
<p>Intel IPP<a href="http://software.intel.com/en-us/articles/intel-ipp-kb/all/1/"> knowledge base</a> includes several examples for hot Intel IPP functions:</p>
<p align="left">•     Learning Media Processing Samples: <br />      <a href=" http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/">Getting Started with Intel® IPP Unified Media Classes Sample</a></p>
<p>•    Using image border processing for filer functions</p>
<p>      <a href="http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-processing-an-image-from-edge-to-edge/">Processing an Image from Edge to Edge</a><br />•     Using image resize function:</p>
<p>      <a href="http://software.intel.com/en-us/articles/resize-function-ippiresizesqrpixel-crashed-for-small-image/">Resize function ippiResizeSqrPixel</a> </p>
</td>
</tr>
</tbody>
</table>
<br />Note:</strong> Intel® IPP sample code is intended only as an example of how to use the APIs and to build applications in different development environments. Please submit problems with:</p>
<ul>
<li>installation</li>
<li>compiling</li>
<li>linking</li>
<li>runtime errors</li>
<li>incorrect output</li>
</ul>
<p>to either <a href="http://software.intel.com/en-us/forums/intel-integrated-performance-primitives">Intel IPP User Forum</a> or <a href="https://premier.intel.com/">Intel Premier Support</a>.</p>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td><img width="388" src="http://software.intel.com/file/6324" height="5" /></td>
</tr>
<tr>
<td height="10"> </td>
</tr>
</tbody>
</table> ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-intel-ipp-sample-code</link>
      <pubDate>Thu, 11 Jun 2009 19:55:25 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-intel-ipp-sample-code#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-intel-ipp-sample-code</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
      <category>Intel® Integrated Performance Primitives Knowledge Base</category>
      <category>Intel® Parallel Composer Knowledge Base</category>
    </item>
    <item>
      <title>Inline Assembly, use-msasm and fasm-blocks</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><strong>Problem : </strong><br /><br />I was looking for "fasm-blocks" decription in "Intel C++ Compiler User &amp; Reference Guide" (304968-022US) which seems to be the latest document with release of ICC-v11.0. The agnostic about it is "fasm-blocks" works with ICC-11.0 on Linux x86_64 but the descriptions about "fasm-blocks" is missing.<br /><br />Could Intel describe it's meaning, uses, also demonstrate with an example currently and latter incorporate in it's feature forthcoming ICC documents.<br /><br />Can I have Intel Assembler latest documents or it's links to download w.r.t Intel 64 on Linux x86_64 where one can understand and analyze Intel Assembly language?<br /><br /><br /><strong>Environment :  <br /></strong><br />Linux* and MacOS X*<br /><br /><strong>Resolution : </strong><br /><br /><br />Intel C++ compiler uses gcc development environment on Linux and MAC. It supports GNU inline style assembly. <br /><br />Intel C++ compiler also supports Microsoft style inline assembly format in Linux. You can use -use-msasm to tell the compiler. The -fasm-blocks is also seems to be working.<br /><br />The -fasm-blocks option is provided on MAC for Microsoft style inline assembly.<br /><br />These options are described in Intel C++ compiler documentation, Document number: 304968-022US. There is small description of the inline assembly implementation in Intel C++ compiler in "Inline Assembly" topic. <br /><br />I am providing the code sample from the Intel C++ compiler documentation below for easy reference:<br /><br />---------------------------------------- gnu style inline assembly ------------------<br />$ cat tstcase_gnu.cpp<br />// inline assembly<br />// tstcase_gnu.cpp<br /><br />#ifdef _WIN64<br />#define INT64_PRINTF_FORMAT "I64"<br />#else<br />#define __int64 long long<br />#define INT64_PRINTF_FORMAT "L"<br />#endif<br />#include &lt;stdio.h&gt;<br />typedef struct {<br />__int64 lo64;<br />__int64 hi64;<br />} my_i128;<br />#define ADD128(out, in1, in2) \<br />__asm__("addq %2, %0; adcq %3, %1" :\<br />"=r"(out.lo64), "=r"(out.hi64) : \<br />"emr" (in2.lo64), "emr"(in2.hi64), \<br />"0" (in1.lo64), "1" (in1.hi64));<br />extern int main()<br />{<br />my_i128 val1, val2, result;<br />val1.lo64 = ~0;<br />val1.hi64 = 0;<br />val2.hi64 = 65;<br />ADD128(result, val1, val2);<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val1.hi64, val1.lo64);<br />printf("+0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val2.hi64, val2.lo64);<br />printf("------------------------------------\n");<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />result.hi64, result.lo64);<br />return 0;<br />}<br /><br /><br />---------------------------------------- Microsoft style inline assembly ------------------<br /><br />$ cat tstcase_msasm.cpp<br />// inline assembly<br />// tstcase_msasm.cpp<br /><br />#ifdef _WIN64<br />#define INT64_PRINTF_FORMAT "I64"<br />#else<br />#define __int64 long long<br />#define INT64_PRINTF_FORMAT "L"<br />#endif<br />#include &lt;stdio.h&gt;<br />typedef struct {<br />__int64 lo64;<br />__int64 hi64;<br />} my_i128;<br />#define ADD128(out, in1, in2) \<br />{ \<br />__asm mov rax, in1.lo64 \<br />__asm mov rdx, in1.hi64 \<br />__asm add rax, in2.lo64 \<br />__asm adc rdx, in2.hi64 \<br />__asm mov out.lo64, rax \<br />__asm mov out.hi64, rdx \<br />}<br /><br />extern int main()<br />{<br />my_i128 val1, val2, result;<br />val1.lo64 = ~0;<br />val1.hi64 = 0;<br />val2.hi64 = 65;<br />ADD128(result, val1, val2);<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val1.hi64, val1.lo64);<br />printf("+0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val2.hi64, val2.lo64);<br />printf("------------------------------------\n");<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />result.hi64, result.lo64);<br />return 0;<br />}<br /><br />You would need -use-msasm compiler option to compile tstcase_msasm.cpp. The -fasm-blocks is also seems to be working on Linux but this is intended for MAC OS.<br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/inline-assemblty-use-msasm-and-fasm-blocks</link>
      <pubDate>Tue, 19 May 2009 01:28:36 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/inline-assemblty-use-msasm-and-fasm-blocks#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/inline-assemblty-use-msasm-and-fasm-blocks</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
    </item>
  </channel></rss>