ParGAP: Difference between revisions

From HPCC Wiki
Jump to navigation Jump to search
(Created page with "Since knowledge of MPI is not required for use of this software, we now refer to the package as simply ParGAP. For more information visit the author's ParGAP home page at: http://www.ccs.neu.edu/home/gene/pargap.html. The package is installed on '''penzias''' cluster. Users must load module '''pargap'''. <pre> module load pargap </pre> The example below named '''parlist.g''' is a parallelization of a list. <pre> #WARNING: Read this with Read(), _not_ ParRead()...")
 
m (Text replacement - "[pP][bB][sS]" to "SLURM")
 
Line 56: Line 56:
</pre>
</pre>


The pbs script to run this program  on penzias is as follows:
The SLURM script to run this program  on penzias is as follows:


<pre>
<pre>

Latest revision as of 19:31, 27 October 2022

Since knowledge of MPI is not required for use of this software, we now refer to the package as simply ParGAP. For more information visit the author's ParGAP home page at: http://www.ccs.neu.edu/home/gene/pargap.html. The package is installed on penzias cluster. Users must load module pargap.


module load pargap

The example below named parlist.g is a parallelization of a list.


#WARNING:  Read this with Read(), _not_ ParRead()

#Environment: None
#TaskInput:   elt, where elt is an element of argument, list
#TaskOutput:  fnc(elt), where fnc is argument
#Task:        Compute fnc(elt) from elt [ Hence, DoTask = fnc ]
#UpdateEnvironment:  None

ParInstallTOPCGlobalFunction( "MyParList",
function( list, fnc )
  local result, iter;
  result := [];
  iter := Iterator(list);
  MasterSlave( function() if IsDoneIterator(iter) then return NOTASK;
                          else return NextIterator(iter); fi; end,
               fnc,
               function(input,output) result[input] := output;
                                      return NO_ACTION; end,
               Error
             );
  return result;
end );

ParInstallTOPCGlobalFunction( "MyParListWithAglom",
function( list, fnc, aglomCount )
  local result, iter;
  result := [];
  iter := Iterator(list);
  MasterSlave( function() if IsDoneIterator(iter) then return NOTASK;
                          else return NextIterator(iter); fi; end,
               fnc,
               function(input,output)
                 local i;
                 for i in [1..Length(input)] do
                   result[input[i]] := output[i];
                 od;
                 return NO_ACTION;
               end,
               Error,  # Never called, can specify anything
               aglomCount
             );
  return result;
end );

The SLURM script to run this program on penzias is as follows:

#!/bin/bash
#SBATCH --partition production
#SBATCH --job-name par_list 
#SBATCH --nodes=1
#SBATCH --ntasks=4

cd $SLURM_SUBMIT_DIR

mpirun -np 4  pargap ./parlist.g >> parlist_out

 

This will create a master and 3 slave processes . Further information and detailed manual how to program with parallel GAP can be found in http://www.gap-system.org/Manuals/pkg/pargap/doc/manual.pdf