Intel® Concurrent Collections for C++ Getting Started

Home | FAQ | Documentation and Tutorials | Papers | Discussions and Feedback

Contents

This is Pre-Release Code

Intel® Concurrent Collections for C++ (CnC) is pre-release code, which may not be fully functional and which Intel may substantially modify in producing any final version. Intel can provide no assurance that it will ever produce or make generally available a final version.

The Prerequisite Software for Install and Set-up

  1. Intel® Concurrent Collections for C++ is supported on the Microsoft Windows* OS and Linux* OS running on IA-32 or Intel® 64 architecture systems.
  2. For Microsoft Windows*, you must have Microsoft Visual Studio* 2008, or Microsoft Visual Studio* 2010, or Microsoft Visual Studio* 2012 with the Visual C++* component installed on your system.
  3. For Linux*, you must have GNU g++ version 4.6.4 or greater installed on your system.
  4. Intel® Threading Building Blocks (TBB) 4.1 Update 1 or greater is required. You can download and install it together with the CnC kit (simply chose the approriate package when downloading CnC) or use an existing installation.
    • Use an installation of the following suites (the come with a suitable environment setup)
      • Intel® Cluster Studio XE 2013 (or newer)
      • Intel® Composer 2013 (Intel® C++-Compiler Version 13.0.0) (or newer)
      • Intel® Parallel Studio 2013 (or newer)
    • Use a custom installation of TBB. You can get the latest TBB from http://threadingbuildingblocks.org/download. Please refer to the TBB homepage for proper installation and setup.
  5. For running CnC applications on distributed memory through MPI you also need Intel® MPI 4.1.0 or later (e.g. through Intel® Cluster Studio XE 2013)

Note: With an installation of Intel® Composer 2013, Intel® Parallel Studio 2013, or Intel® Cluster Studio XE 2013 everything required is available on your system (including TBB).
Note: Intel® Concurrent Collections for C++ is designed to run with either the Microsoft* or Intel® C++ compilers on Microsoft Windows*, and either the GNU g++ or Intel® C++ compilers on Linux*.
Note: Some of the sample codes require Intel® C++ compiler 12.1 or later, or Microsoft* Visual Studio* 2010 or later

Downloading and Installing the Intel® Concurrent Collections for C++

For Windows*

Simply download the install exe from the CnC homepage, and run it. If you do not have TBB installed on your system (see Intel® Threading Building Blocks Library) , please chose the appropriate package which contains TBB.

The install process creates an environment variable named CNCROOT, which points to the full path name of the Intel® Concurrent Collections for C++ installation. If you want to use another version of CnC, you must manually set CNCROOT to point to that location. Installing the package which contains TBB will also set the environment variable TBBROOT to the new installation of TBB.

For Linux*

Simply download the kit from the CnC homepage, extract it and run the provided install.sh script. For example:

  1. tar -xzf "l_cnc_b_0.*.*.tgz"
  2. cd l_cnc_b_0.*.*
  3. ./install.sh
  4. and follow the instructions. The installer will prompt you for installing TBB. Please accept if you do not have TBB installed on your system (see Intel® Threading Building Blocks Library).

Building the Samples

Sample programs using the Intel® Concurrent Collections for C++ product are available in $CNCROOT/samples/. When working with the samples, you may wish to work in a copy of the samples directory. Ensure that the working samples directory is write permitted before building the samples.

The build environment must be set up properly (see Installing CnC).

For Windows*

The Intel® Concurrent Collections for C++ package comes with solution files for different versions of Microsoft Visual Studio*. For each version there is one “master” solution file including all samples and individual project/solutions files in the sub-directories. Please use

  • *.vc11.sln for Microsoft Visual Studio* 2012
  • *.vc10.sln for Microsoft Visual Studio* 2010
  • *.vc9.sln for Microsoft Visual Studio* 2008

The solution and project files might need conversion, which is done automatically by Visual Studio*, but it might take a while to complete. Just follow the instructions on the screen.

Make sure you select the right “solution platform” when building the samples (“Win32” for ia32 and “X86” for intel64).

For Linux*

Type “make” in the samples directory, or to build individual samples, type “make <sample_name>”.


For Intel Xeon Phi(TM) (MIC)

Type
make ARCH=mic OPTS="-mmic -L$TBBROOT/lib/mic" CXX=icpc
in the samples directory, or to build individual samples, type
make ARCH=mic OPTS="-mmic -L$TBBROOT/lib/mic" CXX=icpc <sample_name>.

Building the samples with the Intel® C++ Compiler:

For Windows*

  1. In the Solution Explorer window, select the project you want to modify.
  2. Right-click on the project name and select Use Intel C++. After converting, the Intel C++ Compiler becomes the default compiler for your project.

For Linux*

Set up the Intel C++ environment variables, and launch the sample Makefile specifying icpc as the build compiler. For example:

source /opt/intel/Compiler/11.1/046/bin/iccvars.sh intel64
cd $CNCROOT/samples/fib
make CXX=icpc

Building CnC applications

Compiling with Intel® Concurrent Collections for C++ requires that the compiler finds the Intel® Threading Building Blocks libraries and the CnC libraries.

For Windows*

The installer sets the environment variable CNCROOT to point to the right directory. You might need to re-launch you shell or Microsoft Visual Studio* to make them known. It is recommended that you simply copy a project file from the samples directory and start your own project from there.

If you want to do it the hard way here is what you need to do:

  • Add include directory $(CNCROOT)\include
    (right-click on the project -> Properties -> C/C++ -> General -> Additional Include Directories).
  • Add CnC library (where <arch> must be replaced by your CPU architecture: ia32 or intel64)
    (right-click on the project -> Properties -> Linker -> Input -> Additional Dependencies):
    • “$(CNCROOT)\lib\<arch>\cnc_vc11.lib” (when using Microsoft Visual Studio* 2012)
    • “$(CNCROOT)\lib\<arch>\cnc_vc10.lib” (when using Microsoft Visual Studio* 2010)
    • “$(CNCROOT)\lib\<arch>\cnc_vc9.lib” (when using Microsoft Visual Studio* 2008)
  • When building a debug version, it is recommended to
    • Define Preprocessor macro CNC_USE_ASSERT
      (right-click on the project -> Properties -> C/C++ ->Preprocessor -> Preprocessor Definitions)
    • Link against the respective debug version (“$(CNCROOT)\lib\<arch>\cnc_debug_vc*.lib”)
If you are not using a tbbvars.bat script to set up the TBB environment or if you do not build within an Intel® Composer, Intel® Parallel Studio, or Intel® Cluster Studio environment, you also need to provide similar flags for TBB:

  • Add include directory $(TBBROOT)\include
    (right-click on the project -> Properties -> C/C++ -> General -> Additional Include Directories).
  • Add CnC library (where <arch> must be replaced by your CPU architecture: ia32 or intel64)
    (right-click on the project -> Properties -> Linker -> Input -> Additional Dependencies):
    • “$(TBBROOT)\lib\<arch>\vc11\tbb.lib $(TBBROOT)\lib\<arch>\vc11\tbbmalloc.lib” (when using Microsoft Visual Studio* 2012)
    • “$(TBBROOT)\lib\<arch>\vc10\tbb.lib $(TBBROOT)\lib\<arch>\vc10\tbbmalloc.lib” (when using Microsoft Visual Studio* 2010)
    • “$(TBBROOT)\lib\<arch>\vc9\tbb.lib $(TBBROOT)\lib\<arch>\vc9\tbbmalloc.lib” (when using Microsoft Visual Studio* 2008)
  • When building a debug version, it is recommended to
    • Define Preprocessor macro TBB_USE_ASSERT
      (right-click on the project -> Properties -> C/C++ ->Preprocessor -> Preprocessor Definitions)
    • Link against the respective debug version (“$(TBBROOT)\lib\<arch>\vc*\tbb_debug.lib $(TBBROOT)\lib\<arch>\vc*\tbbmalloc_debug.lib”)

For Linux*

The provided shell scripts <installdir>/bin/cncvars.[c]sh sets the environment variable CNCROOT to the appropriate path and extends the shell’s LD_LIBRARY_PATH. We recommend that you source cncvars.sh (bash) or cncvars.csh ([t]csh) and do the same with tbbvars.[c]sh before building/running CnC applications. It is recommended that you copy a Makefile from the samples directory and start your own project from there.

If you want to do it the hard way here is what you need to do:

  • At compile time add –I$CNCROOT/include
  • At link time add –L$CNCROOT/lib/intel64 -lcnc -lrt -pthread
  • When building a debug version, it is recommended to
    • At compile time add –DCNC_USE_ASSERT
    • At link time use –lcnc_debug instead of –lcnc

If you are not using a tbbvars.[c]sh script to set up the TBB environment, you also need to provide similar flags for TBB:

  • At compile time add –I$TBBROOT/include
  • At link time add –L$TBBROOT/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21 –ltbb -lttbmalloc
  • When building a debug version, it is recommended to
    • At compile time add –DTBB_USE_ASSERT
    • At link time use –ltbb_debug –ltbbmalloc_debug instead of –lcnc –ltbbmalloc

For Intel Xeon Phi(TM) (MIC)

See above for Linux but when sourcing cncvars.[c]sh pass "mic" as its argument (source CNCROOT/bin/cncvars.sh mic). Note: The TBB vars files might not support this, so if you use the TBB provided with CnC you might get a warning message. In this case you need to go the hard way for the TBB part (see above).


For the hard way, replace "intel64/intel64/cc4.1.0_libc2.4_kernel2.6.16.21" with "mic".

Of course you need to use the usual compile flags for MIC, e.g. "-mmic".

Running CnC applications

If the build environment is set up properly then launching CnC applications from within the development evnironment (shell or from Microsoft Visual Studio*) will just work fine.

Running CnC applications on Windows* outside of Microsoft Visual Studio*

Nothing needs to be done for Intel® Concurrent Collections for C++ itself. The installer extends the PATH (environment variable) so that Windows* find the necessary dlls. You might need to re-launch you shell or Microsoft Visual Studio* to make them known.

If you installed CnC for 32bit (ia32) and 64bit (intel64) the installer adds the path to 32bit dlls and to 64bit dlls. The order defines which one is tried to be loaded. Hence we recommend to copy the CnC dlls from $CNCROOT/bin/<arch>/ next to your executable.

If you are not using a tbbvars.bat script to set up the TBB environment or if you do not build within an Intel® Composer or Intel® Parallel Studio environment, you need to do one of the following

  • execute the tbbvars.bat script (in the same shell as you are executing the application)
    %TBBROOT%/bin/tbbvars.bat [arch] [vsver]
    where [arch] is intel64 or ia32 and [vsver] is vs2008, vs2010 or vs2012 depending on your current setup
  • copy the respective TBB libraries next to your executable

Running CnC applications on Linux*

We recommend that you source cncvars.sh (bash) or cncvars.csh ([t]csh) and do the same with tbbvars.[c]sh before building/running CnC applications. This will set up your LD_LIBRARY_PATH so that the CnC and TBB libraries are found.

If that’s not possible, you must add the following paths to your LD_LIBRARY_PATH:

  • $CNCROOT/lib/intel64
  • $TBBROOT/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21

Running CnC applications on Intel Xeon Phi(TM) (MIC)

See above for Linux; just replace "intel64[/intel64/cc4.1.0_libc2.4_kernel2.6.16.21]" with "mic".

To run an application across host and MIC (or several MICs) build a "normal" distributed CnC applicaion for all platforms (e.g. intel64 and mic; no MIC specific programming needed) and use Intel(R) MPI (or SOCKETS) to start processes on MICs and CPUs. More detailed instructions can be found here

Documentation and Tutorials

Changing, Updating and Removing the Product

(For Windows* only)

If you want to add or remove components from an installation, open the Add or Remove Programs applet in the Windows Control Panel, select "Intel® Concurrent Collections for C++ Prototype Edition, version 0.*.*" and click Change. To remove the product, select Remove instead of Change. If you have installed Intel® Concurrent Collections for C++ for 32bit (ia32) and 64bit (intel64) into the same directory, de-installing one will remove all common files.

When installing an updated version of the product, you do not need to remove the older version first.

Report Problems or Leave Feedback

To report a problem or leave feedback on this product, please visit:
http://softwarecommunity.intel.com/articles/eng/3862.htm

or visit the "Whatif Alpha Forum" to participate in forum discussions about Intel® Concurrent Collections:
http://software.intel.com/en-us/forums/whatif-alpha-software/

Then click on "Search Forum" and search for "Concurrent Collections"

Disclaimer and Legal Information

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL(R) PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.

Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.

The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.

Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or by visiting Intel's Web Site.

Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processor family, not across different processor families. See http://www.intel.com/products/processor_number for details.

Intel, Intel Atom, Intel Xeon Phi, and Intel Core are trademarks of Intel Corporation in the U.S. and/or other countries.

* Other names and brands may be claimed as the property of others.

Copyright (C) 2008-2013, Intel Corporation. All rights reserved.

有关编译器优化的更完整信息,请参阅优化通知