Generic Parallel Test Job

From UGP-Wiki

Jump to: navigation, search

parallel.c is a generic parallel MPI program that can be used to test parallel jobs. It looks like this:

#include <mpi.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    int nprocs, myrank, merror;
    merror = MPI_Init(&argc,&argv);
    if (merror != 0) {
      printf ("Error initializing MPI program. Terminating.\n");
      MPI_Abort(MPI_COMM_WORLD,merror);
    }
    MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
    MPI_Comm_rank(MPI_COMM_WORLD,&myrank);    
    printf ("Number of processors or tasks = %d My rank=  %d\n", 
nprocs,myrank);

                   /******* Add your work here *******/

    MPI_Finalize();
}

To test using this job:

  1. Use the Data Manager to copy it to the cluster on which you will run it.
  2. To compile parallel.c:
    1. Select "Grid Development Environment" under the "Advanced" tab.
    2. Select the target cluster from the cluster drop-down menu.
    3. From the File menu select New/New Project.
    4. In the "Create New Project" dialog box that opens select "MPI C for GigE (mpicc)", enter a name for your project and click "OK".
    5. From the File menu select Import Files...
    6. In the "Import Files" dialog box that open select parallel.c and click "OK".
    7. From the Build menu select Configuration and in the dialog box that opens change a.out in the box labeled Executable Name to parallel.
    8. From the File menu select Save Project.
    9. From the Build menu select Build.
  3. To run it, select "Generic Jobs" under the "Job Services" tab.
  4. Fill in the Generic Job Submission form as follows:
    1. Select the cluster name from the drop down menu labeled "Submit to:".
    2. Job Name is optional.
    3. Either:
      • Click the File Folder symbol to the right of the text input field labeled "Executable:" and use the file selector which opens to select the executable, or
      • Type in the filename of the executable in the text input field. Either provide a full path or a path which is relative to your home directory ($HOME).
      The excutable is in the ucla_workspace directory under the name you gave your project and is named a.out.
    4. Leave the text input field labeled "Arguments:" blank.
    5. Leave the text input field labeled "Directory:" blank.
    6. For "JobType" select MPI Parallel.
    7. Enter 2 or more for the number of processors.
    8. Click the "Submit Job" button.
Personal tools