Giter Club home page Giter Club logo

icnc's Introduction

DISCONTINUATION OF PROJECT

This project will no longer be maintained by Intel. Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. Intel no longer accepts patches to this project.

Intel(R) Concurrent Collections for C++

Parallelism without the Pain

The CnC homepage is here: https://icnc.github.io

Prerequisites

Building CnC

You need cmake to prepare building the CnC libraries from source. A python script is provided for your convenience to build the package:

cd <cnc_src_root>
python make_kit.py

It will create a tbz package for you in directory <cnc_src_root>/kit.pkg where you also find an "installation" of CnC under <cnc_src_root>/kit.pkg/cnc/current

You can specify the MPI root/install-dir with "--mpi=<mpiroot>. Also try "python make_kt.py -h" for more options.

Building CnC using CnC directly

You can of course drive cmake yourself. It is recommended to avoid in-source builds and to do something like

cd <cnc_src_root>
mkdir build
cd build
cmake <options> ..

Primary <options> for building the CnC libraries are

  • Build libraries to use MPI (distributed memory): -DBUILD_LIBS_FOR_MPI=TRUE
  • Build libraries for profiling with Intel(R) Trace Analyzer and Collector: -DBUILD_LIBS_FOR_ITAC=TRUE
  • See generic options below

After successfully running cmake you can you use preferred build tool to build the libraries: On Linux, just type 'make', On Windows use the tool according to the generator you selected above.

The libraries will be build in the "build" directory, on Linux in "lib", on Windows you'll find them in "Debug" or "Release".

Building CnC samples

Building samples also requires cmake.

cd <cnc_src_root>
mkdir build
cd build
cmake <options> ..

Primary <options> for building samples are

  • Specify CnC install/root directory: -DCNCROOT=<path_to_cnc>
  • Enable distributed memory: -DDIST_CNC=TRUE
  • Enable hooks for tracing with Intel(R) Trace Analyzer and Collector: -DUSE_ITAC=TRUE
  • See generic options below

After successfully running cmake you can you use your preferred build tool to build the samples: On Linux, just type 'make', On Windows use the tool according to the generator you selected above.

Generic cmake options

  • Linux*: Select optimized or debug build mode: -DCMAKE_BUILD_TYPE=[Release|Debug]
  • Windows*: Select appropriate generator
    • For nmake: -G "NMake Makefiles"
    • For Visual Studio 2010 32bit: -G "Visual Studio 10"
    • For Visual Studio 2010 64bit: -G "Visual Studio 10 Win64"
    • For Visual Studio 2011 32bit: -G "Visual Studio 11"
    • For Visual Studio 2011 64bit: -G "Visual Studio 11 Win64"
    • For Visual Studio 2012 32bit: -G "Visual Studio 12"
    • For Visual Studio 2012 64bit: -G "Visual Studio 12 Win64"
  • Specify TBB install/root directory: -DTBBROOT=<path_to_tbb> (defaults to $TBBROOT)
  • Specify MPI install/root directory: -DMPIROOT=<path_to_mpi> (defaults to $I_MPI_ROOT)
  • Specify ITAC install/root directory: -DITACROOT=<path_to_itac> (defaults to $VT_ROOT)

Testing

See tests/ReadMe.txt.

Code documentation

Most header files start with a description of the functionality of the given module. As this is a template library, most code is actually in header files.

Source structure

All header files which are needed to write a CnC application with pre-compiled libraries reside in the cnc directory. Internal headers are in cnc/internal, internals for distributed memory can be found in cnc/internal/dist. Anything else is in src.

Every class has its own header-file (and sometimes also a cpp file).

Your contribution is welcome!

icnc's People

Contributors

daowen avatar fschlimb avatar ftes avatar junghans avatar moon6pence avatar pelmers avatar rscohn2 avatar sfblackl-intel avatar yvdriess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icnc's Issues

Add support for source installation of TBB

It would be nice to add support for a source installation of TBB. Currently I have to hack CMake.inc to make it compile.

The current version of the script is not aware of the structure of a source-based installation of TBB and is not able to find TBB_LIB, TBBMALLOC_LIB and its debug equivalents.

Similarly, it is not possible to create an installer using the -i flag, it brakes in this stage:

['cp', '-r', '/home/tiago/Work/tbb/lib/intel64', 'tbb/lib/']
cp: cannot stat '/home/tiago/Work/tbb/lib/intel64': No such file or directory
error code: 1

RPM for ia32 arch

Hello all,
I'm trying to run icnc under FreeBSD 10 (with clang).
I tried to compile directly the sources without luck, so I reverted to Linux binary emulation.
On the INTEL site, I have a quite old version (0.5) in rpm format for ia32 architecture. They claims to have also the 0.6 but the link is broken.
Is there any plan to support natively FreeBSD ?

thanks,
Fausto

Scheduler statistics improvements

Scheduler stats currently count steps as created even if they get shipped to another process. Check for consumed_on should probably be done outside the step-instance and steps should get created only if needed locally.

compile warning on uninitialised variable

Potentially dangerous unitialized state, I'm not sure it is portable to refer to yourself in the initialization list.

/home/yvdriess/repo/icnc/src/scheduler_i.cpp:83:56: warning: field 'm_root' is uninitialized when used here [-Wuninitialized]
              m_root( distributor::distributed_env() ? m_root : distributor::myPid() ),

CnC compiler/translator

The release notes states that one can "Write CnC graphs and use them in other CnC programs" but the graph translator is missing. make fib.h gives /opt/intel/cnc/1.0.002/bin/intel64/cnc: Command not found

chunk<T>(arr,len) serialization

Currently, serializing an array with a CnC::chunk object does not serialize the length for the user.

The length argument is passed by copy to the chunk constructor. It is used during packing and used internally when unpacking. However, the user still has to serialize his own length datum separately.

It would be more in line with the rest of the serialization interface to pass a reference or pointer to a length variable. Then, the length datum could be set for the user during unpacking. A small speed benefit is also expected, as it avoid having to pack/unpack the length datum twice.

Now:

           class Your_class : public serializable {
           private:
               double x;
               float  y;
               int    len;
               char*  arr; // array of lenth len
               ...
           public:
               void serialize( CnC::serializer & buf ) {
                   buf & x
                       & y
                       & len;
                   buf & CnC::chunk< char >( arr, len_arr ); // chunk declared below
                   ...
               }
           }

Suggested:

           class Your_class : public serializable {
           private:
               double x;
               float  y;
               int    len;
               char*  arr; // array of lenth len
               ...
           public:
               void serialize( CnC::serializer & buf ) {
                   buf & x
                         & y;
                   buf & CnC::chunk< char >( arr, len ); 
                   ...
               }
           }

Simple suggestion, but I had a nasty bug that I tracked down to the above assumption.

NB. s/len_arr/len in example code above. I copied the code verbatim from https://icnc.github.io/api/group__ser__exp.html

Bad termination after finalizing when using trace analyser

Running the CnC binary distributed using MPI (DIST_CNC=MPI) in conjunction with Intel Trace Analyser results in a bad termination message at the very end of the program. The CnC scheduling statistics get printed and the trace file gets written as usual.
This error does not seem to have any impact on the results of the program, besides the abnormal exit.

Error in question:

[0] [CnC 0] End step call_variants((sample_12,12))
[0] Steps created( [0] 256 )
[0] Steps scheduled( 249 ) inflight( 0, 0 )
[0] Steps requeued( 103 ) resumed( 157 )
[0] Messages sent( 128 ) Messages received( 150 ) Bcasts sent( 133 )
[0] [0] Intel(R) Trace Collector INFO: Writing tracefile traced_pipeline.single.stf in /home/yvdriess/coord/altpl
[0] [0] Intel(R) Trace Collector WARNING: message logging: 442 different messages, 0 (0.0%) sends without receive, 0 (0.0%) receives without send, 37 (8.4%) messages with reversed time stamps (average duration 1.427717e-03s)
[0] Attempting to use an MPI routine after finalizing MPI
[1] Attempting to use an MPI routine after finalizing MPI
[0] [CnC 0] runtimes/cnc_api/src/dist/mpi_comm/MpiCommunicator.cpp:60 assertion 'm_channel == 0' failed.
[1] [CnC 1] runtimes/cnc_api/src/dist/mpi_comm/MpiCommunicator.cpp:60 assertion 'm_channel == 0' failed.

=====================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   EXIT CODE: 6
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
=====================================================================================
APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)

minor warning: abstract class with non-virtual destructor

Observed issue: clang++ compiler (v3.4) throws warnings when constructing item collection objects.

In file included from /home/yvdriess/opt/intel/cnc_1.0.001/include/cnc/cnc.h:44:
/home/yvdriess/opt/intel/cnc_1.0.001/include/cnc/internal/item_collection_base.h:404:17: warning: delete called on
      'CnC::Internal::item_collection_base<std::pair<std::basic_string<char>, int>, File, CnC::hashmap_tuner>::_callback' that is abstract but has
      non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete (*i);

/home/yvdriess/opt/intel/cnc_1.0.001/include/cnc/cnc.h:280:9: note: in instantiation of member function
      'CnC::Internal::item_collection_base<std::pair<std::basic_string<char>, int>, File, CnC::hashmap_tuner>::~item_collection_base' requested
      here
        item_collection( context< Derived > & ctxt, const std::string & name = std::string() );

It doesn't introduce any bugs in this case, but it is easy to fix without any overhead (the object has a vtable already anyway).

Suggested fix:

index 9465a94..29f1dce 100644
--- a/cnc/internal/item_collection_base.h
+++ b/cnc/internal/item_collection_base.h
@@ -180,7 +180,7 @@ namespace CnC {
             item_type * create( const item_type & org ) const;
             void uncreate( item_type * item ) const;

-            typedef struct _callback { virtual void on_put( const T &, const item_type & ) = 0; } callback_type;
+            typedef struct _callback { virtual void on_put( const T &, const item_type & ) = 0;  virtual ~_callback() {}; } callback_type;
             void on_put( callback_type * cb );

             const Tuner & tuner() const { return m_tuner; }
diff --git a/cnc/internal/tag_collection_base.h b/cnc/internal/tag_collection_base.h
index aa92af3..8dbde5b 100644
--- a/cnc/internal/tag_collection_base.h
+++ b/cnc/internal/tag_collection_base.h
@@ -74,7 +74,7 @@ namespace CnC {
             const_iterator end() const { return m_tagTable.end(); }

             /// the callback type for writing re-usable graphs (CnC::graph)
-            typedef struct _callback { virtual void on_put( const Tag & ) = 0; } callback_type;
+            typedef struct _callback { virtual void on_put( const Tag & ) = 0; virtual ~_callback() {}; } callback_type;
             /// register a callback, called whe a tag is put
             /// not thread safe
             void on_put( callback_type * cb );

Startup script for SOCKET distributed execution is not passing command line arguments.

I noticed that using the startup script start.sh for the SOCKET configuration is not passing the command line arguments.
e.g.: ./cnc_exe foo bar
will call start.sh with CNC_SOCKET_HOST_EXECUTABLE=pipeline, resulting in each client being started as:
./cnc_exe

Looking at PAL_GetProgname() in pal_util.cpp, I notice you do read in the entire "./cnc_exe foo bar”, but the file separates the executable name from its arguments with a ‘\0’. As this string (including the arguments) is passed as a null-terminated c-string to create an std::string, it does not ‘see’ the arguments.

I can quickly hack start.sh for my purposes, but perhaps it would be nice to pass the entire call, arguments and all, to CNC_SOCKET_HOST_EXECUTABLE? It should be just a matter of substituting the non-trailing ‘\0’ characters in the buffer just before line pal_util.cpp:220.

undefined reference to symbol when building samples

I build TBB and CNC separately and specify the path to TBB library using the -DTBBROOT variable. When I build the sample programs, I encountered this error:

# Makefile command that raise this error:
g++ -pthread  -std=c++0x -O3  -o jacobi2D jacobi2D.o jacobi2D_cnc.o -L/localdisk/local/lib/intel64 -lcnc -lrt -ltbb -ltbbmalloc
# error message:

/bin/ld: warning: libtbb.so.12, needed by /localdisk/local/lib/intel64/libcnc.so, may conflict with libtbb.so.2
/bin/ld: jacobi2D.o: undefined reference to symbol '_ZN3tbb6detail2r126wait_bounded_queue_monitorEPNS1_18concurrent_monitorEmlRNS0_2d113delegate_baseE'
/bin/ld: /localdisk/local/lib64/libtbb.so.12: error adding symbols: DSO missing from command line

Any ideas?

in-source tests

It is a little bit unusual to have to install CnC first to test it, especially for binary package builds. So it would be useful if the test could be run with the in-source libraries, too.

unexpanded version string error on compilation

The tbbcompat.h header does not report the required versions string, as the #error preprocessor directive does not expand the text that follows.

#error Need TBB version #CNC_REQUIRED_TBB_VERSION_STRING or newer

produces the error:

/home/yvdriess/repo/icnc/cnc/internal/tbbcompat.h:57:2: error: #error Need TBB version #CNC_REQUIRED_TBB_VERSION_STRING or newer

Building tests with docker on MacOS

For tests, I only added fib and cholesky in tests/CMakelists.txt (Comment out other tests).

After running "cmake .." in tests/build, the output seems correct:
"Warning: no $VT_ADD_LIBS env var set.
-- Configuring done
-- Generating done
-- Build files have been written to: /icnc/tests/build"
In folder tests/build/fib, I got the following files/dictionaries: "CMakeFiles CTestTestfile.cmake Makefile cmake_install.cmake"

When running "cmake test", the massage is like this
"CMake Error: The source directory "/icnc/tests/build/test" does not exist.
Specify --help for usage, or press the help button on the CMake GUI."

When running "cmake fib", the massage is like this:
"CMake Error: The source directory "/icnc/tests/build/fib" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI."

When enter /icnc/tests/build/fib and "make", the massage is like this:
"[ 50%] Building CXX object fib/CMakeFiles/distfib.dir/fib.cpp.o
In file included from /icnc/tests/fib/fib.cpp:38:0:
/usr/include/cnc/dist_cnc.h: In instantiation of 'CnC::dist_cnc_init<C1, C2, C3, C4, C5>::dist_cnc_init() [with C1 = fib_context; C2 = CnC::Internal::void_context; C3 = CnC::Internal::void_context; C4 = CnC::Internal::void_context; C5 = CnC::Internal::void_context]':
/icnc/tests/fib/fib.cpp:230:39: required from here
/usr/include/cnc/dist_cnc.h:589:63: error: no matching function for call to 'CnC::Internal::dist_init::dist_init(CnC::dist_cnc_init<fib_context>::mysubscriber)'
dist_cnc_init() : Internal::dist_init( mysubscriber() ) {}
^
/usr/include/cnc/dist_cnc.h:589:63: note: candidates are:
In file included from /usr/include/cnc/dist_cnc.h:502:0,
from /icnc/tests/fib/fib.cpp:38:
/usr/include/cnc/internal/dist/dist_init.h:127:13: note: CnC::Internal::dist_init::dist_init(CnC::Internal::dist_init::subscriber_type, long int, bool)
dist_init( subscriber_type subscriber, long flag = 0, bool dist_env = false )
^
/usr/include/cnc/internal/dist/dist_init.h:127:13: note: no known conversion for argument 1 from 'CnC::dist_cnc_init<fib_context>::mysubscriber' to 'CnC::Internal::dist_init::subscriber_type {aka void (*)()}'
/usr/include/cnc/internal/dist/dist_init.h:123:16: note: constexpr CnC::Internal::dist_init::dist_init(const CnC::Internal::dist_init&)
struct dist_init
^
/usr/include/cnc/internal/dist/dist_init.h:123:16: note: no known conversion for argument 1 from 'CnC::dist_cnc_init<fib_context>::mysubscriber' to 'const CnC::Internal::dist_init&'
make[2]: *** [fib/CMakeFiles/distfib.dir/fib.cpp.o] Error 1
make[1]: *** [fib/CMakeFiles/distfib.dir/all] Error 2
make: *** [all] Error 2"

Am I missing something to running the tests successfully? Thanks!

CnC doesn't build with openmpi

/home/junghans/gentoo/icnc/src/dist/mpi_comm/MpiCommunicator.cpp: In member function ‘virtual int CnC::Internal::MpiCommunicator::init(int, int)’:
/home/junghans/gentoo/icnc/src/dist/mpi_comm/MpiCommunicator.cpp:95:24: error: invalid conversion from ‘int’ to ‘MPI_Comm {aka ompi_communicator_t*}’ [-fpermissive]
                 myComm = thecomm;
                        ^
make[2]: *** [CMakeFiles/cnc_mpi.dir/src/dist/mpi_comm/MpiCommunicator.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/junghans/gentoo/icnc/src/dist/mpi_comm/MpiChannelInterface.cpp: In member function ‘virtual int CnC::Internal::MpiChannelInterface::sendBytes(void*, CnC::Internal::ChannelInterface::size_type, CnC::Internal::ChannelInterface::size_type, int)’:
/home/junghans/gentoo/icnc/src/dist/mpi_comm/MpiChannelInterface.cpp:90:20: error: invalid conversion from ‘MPI_Request {aka ompi_request_t*}’ to ‘int’ [-fpermissive]
             return request;
                    ^
/home/junghans/gentoo/icnc/src/dist/mpi_comm/MpiChannelInterface.cpp: In member function ‘virtual void CnC::Internal::MpiChannelInterface::wait(int*, int)’:
/home/junghans/gentoo/icnc/src/dist/mpi_comm/MpiChannelInterface.cpp:102:60: error: cannot convert ‘int*’ to ‘ompi_request_t**’ for argument ‘2’ to ‘int MPI_Waitall(int, ompi_request_t**, MPI_Status*)’
             MPI_Waitall( cnt, requests, MPI_STATUSES_IGNORE );
                                                            ^
make[2]: *** [CMakeFiles/cnc_mpi.dir/src/dist/mpi_comm/MpiChannelInterface.cpp.o] Error 1
make[1]: *** [CMakeFiles/cnc_mpi.dir/all] Error 2
make: *** [all] Error 2

Step tuner priorities have no effect

I was playing with the step priority tuning support in icnc, and I thought it was strange that I always got basically the same performance, even when I set a priority which should have really hurt the performance in my application.

I put together a very minimal test to see if priorities were doing anything. I figured if I created 10 steps and ran them on a single thread, then they would execute in order of their priority. However, my observation is that they just execute in FIFO order:

[CnC] Bind thread 0 to processor 0
[CnC] Using FIFO_SINGLE scheduler [PRIORITY ON] [PINNING ON]
Step priority is 0
Step priority is 3
Step priority is 6
Step priority is 9
Step priority is 2
Step priority is 5
Step priority is 8
Step priority is 1
Step priority is 4
Step priority is 7
Executing step 0
Executing step 3
Executing step 6
Executing step 9
Executing step 2
Executing step 5
Executing step 8
Executing step 1
Executing step 4
Executing step 7
Steps created( 10 )
Steps scheduled( 10 ) inflight( 0, 0 )
Steps requeued( 0 ) resumed( 0 )

This simple test app is added in PR #32. See the readme included with the example for instructions on how to build and run the app.

I'm using the latest binary distribution (with TBB bundled) on a FC19 x86_64 box.

CnC/ITAC: Attempting to use an MPI routine after finalizing MPI

When running a CnC app with MPI and ITAC enabled, it successfully executes and writes a tracfile, but when shutting down it reports

[0] [0] Intel(R) Trace Collector INFO: Writing tracefile traced_pipeline.single.stf in ...
[0] [0] Intel(R) Trace Collector WARNING: message logging: 442 different messages, 0 (0.0%) sends without receive, 0 (0.0%) receives without send, 37 (8.4%) messages with reversed time stamps (average du
ration 1.427717e-03s)
[0] Attempting to use an MPI routine after finalizing MPI
[1] Attempting to use an MPI routine after finalizing MPI
[0] [CnC 0] runtimes/cnc_api/src/dist/mpi_comm/MpiCommunicator.cpp:60 assertion 'm_channel == 0' failed.
[1] [CnC 1] runtimes/cnc_api/src/dist/mpi_comm/MpiCommunicator.cpp:60 assertion 'm_channel == 0' failed.

APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)

Thread pinning prevents OSX build

The current thread pinning implementation prevents CnC from building on Darwin.

[ 36%] Building CXX object CMakeFiles/cnc.dir/src/simplest_scheduler.cpp.o
In file included from /Users/yvdriess/dev/icnc/src/simplest_scheduler.cpp:36:
/Users/yvdriess/dev/icnc/src/pinning.h:139:38: error: unknown type name 'cpu_set_t'
        inline static int cpu_count( cpu_set_t * s )
                                     ^
/Users/yvdriess/dev/icnc/src/pinning.h:154:13: error: unknown type name 'cpu_set_t'
            cpu_set_t _procmask; CPU_ZERO( &_procmask );
            ^
/Users/yvdriess/dev/icnc/src/pinning.h:158:17: error: unknown type name 'cpu_set_t'
                cpu_set_t _dwProcessAffinity; CPU_ZERO( &_dwProcessAffinity );
                ^

Although Darwin prevents actual thread pinning (security, BSD is paranoid like that), it is perhaps possible to work with the new affinity API to produce a similar effect:
https://developer.apple.com/library/mac/releasenotes/Performance/RN-AffinityAPI/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.