+ Reply to Thread
Results 1 to 3 of 3

Thread: Parallelize your Symphony service through openMP

  1. #1
    Young's Avatar
    Young is offline Junior Member
    Join Date
    March 5th, 2008
    Location
    Toronto, Canada
    Posts
    58
    Blog Entries
    1
    Downloads
    7
    Uploads
    0

    Default Parallelize your Symphony service through openMP

    You can use openMP directives to parallelize your service code to be executed efficiently on SMP clusters.

    1. Compiling your service code

    Symphony service written in C++ and openMP can be compiled in Linux with latest ICC (Intel C++ Compiler). Make sure you specify compiler command correctly as follows in the Makefile for your service code.

    Code:
    CC = icc -cxxlib-gcc -gcc-version=343 -openmp_profile
    # for linux2.6-glibc2.3-x86 platforms (RHEL4, SLES9),   set -gcc-version=343
    # for linux2.4-glibc2.3-x86 platforms (RHEL3),          set -gcc-version=323
    # for linux2.4-glibc2.2-x86 platforms (RHEL2.1, SLES8), set -gcc-version=320
    
    To obtain the latest ICC, go to Intel C++ Compiler page.

    2. Simple example of openMP directives

    Here is a very simple openMP directives to parallelize for loop in multiple threads. (Attached package contains full source)

    Code:
     #pragma omp parallel num_threads(2)
        {
            #pragma omp for
            for(i= 0; i<simulations; i++)
            {
                x = static_cast<double>(rand())/RAND_MAX;;
                y = static_cast<double>(rand())/RAND_MAX;;
                if (((x*x)+(y*y))<=1) hit++;
            }
        }
    
    The snippet code is used to estimate PI through Monte Carlo simulation. Note that you can create multiple threads through num_threads directives and let each thread compute the workload of the for loop.

    3. Running your service
    Make sure all you compute host source the environment for openMP executable. Environment configuration file is usually under $INTEL_INSTALLATION_DIR/bin
    Attached Files
    Last edited by Young; March 24th, 2008 at 11:04 PM.

  2. #2
    bala_muthu is offline Junior Member
    Join Date
    June 4th, 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Regarding Resource Utilization

    Hi,

    Can you please explain me how the resource will be utilized when integrating symphony with openMP.

    This is my example.

    Hosts: 25
    Cores / host: 2
    Total slots: 100
    No of tasks: 200

    I have my business logic in the service which uses many independent for loops so I want to use openMP on that.

    At this point of time how symphony will behave?
    I hope this is not the correct place to use both openMP and symphony but I need few suggestion.

  3. #3
    Ajith's Avatar
    Ajith is offline Symphony DE Moderator
    Join Date
    February 28th, 2008
    Location
    Markham, Ontario
    Posts
    104
    Blog Entries
    2
    Downloads
    10
    Uploads
    0

    Default Symphony Resource Utilization

    Symphony will tend to allocate slots on one host until no slots are left before moving on to the next. This behaviour is not very predictable as the SSM 's scheduler will generally give up the slot as soon as there is not enough work for it. Symphony does have a "tiled" allocation mode, but this requires a Symphony code change to enable.

    If you only run one session at a time and the cluster is idle initially, then the above behaviour will hold.

    As OpenMP will allow you to optimize your service code to better utilize multiple cores, you may only want to define one slot per host. Since your service code utilizes multiple threads, the threads can be distributed over the two cores and have no contention with the same code running in another service. This will also guarantee that each service will be started on a different host. The down-side is that your CPU utilization may go down as you eliminate the overlap of running more than one service on a host at one time.

    - Ajith
    Last edited by Ajith; June 19th, 2008 at 03:52 PM.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts