Skip to content

How to use pfd‐parallel

Janko Boehm edited this page Aug 7, 2024 · 3 revisions

Setup Spack and load pfd-parallel

If you start in a new terminal session (and did not configure your terminal to do this automatically) make sure to set software_ROOT and run the setup-env.sh script. Make also sure to load the pfd-parallel package in Spack. As discussed above this can be done by:

export software_ROOT=~/singular-gpispace
. $software_ROOT/spack/share/spack/setup-env.sh
spack load pfd-parallel

Setup directories and example files

We create directories which will used for input and output:

mkdir -p $software_ROOT/input
mkdir -p $software_ROOT/results

To execute an example, we will use rational function data, which is provided with the installation and is copied by the following command to the input directory.

cp $PFD_INSTALL_DIR/example_data/* $software_ROOT/input

We create a nodefile, which contains the names of the nodes used for computations with our framework. In our example, it just contains the result of hostname.

hostname > $software_ROOT/nodefile

Moreover, we need a directory for temporary files, which should be accessible from all machines involved in the computation:

mkdir -p $software_ROOT/tempdir

Start the monitor

Optionally, but recommended: We start the GPI-Space Monitor to display computations in form of a Gantt diagram (to do so, you need an X-Server running). In case you do not want to use the monitor, you should not set in Singular the fields options.loghostfile and options.logport of the GPI-Space configuration token (see below). In order to use the GPI-Space Monitor, we need a loghostfile with the name of the machine running the monitor.

hostname > $software_ROOT/loghostfile

On this machine, start the monitor, specifying a port number where the monitor will receive information from GPI-Space. The same port has to be specified in Singular in the field options.logport.

$PFD_INSTALL_DIR/libexec/bundle/gpispace/bin/gspc-monitor --port 6439 &

Start Singular

We start Singular in the directory where it will have direct access to all relevant directories we just created, telling it also where to find the libraries for our framework:

cd $software_ROOT
SINGULARPATH="$PFD_INSTALL_DIR/LIB"  $SINGULAR_INSTALL_DIR/bin/Singular

Configure and run computation in Singular

In Singular, now do what follows below.

This

  • loads the library giving access to pfd-parallel,

  • creates a configuration token for the Singular/GPI-Space framework,

    • adds information where to store temporary data (in the field options.tmpdir),
    • where to find the nodefile (in the field options.nodefile), and
    • sets how many processes per node should be started (in the field options.procspernode, usually one process per core, not taking hyper-threading into account; you may have to adjust according to your hardware),
  • creates a configuration token for pfd-parallel, adds information on

    • the base file name (in the field pfdconfig.filename),
    • the input directory (in the field pfdconfig.inputdir)
    • the output directory (in the field pfdconfig.outputdir)
    • the output format(s) (in the field pfdconfig.outputformat)
    • the choice of parallelization strategy (in the field pfdconfig.parallelism)
    • the choice of algorithmic strategy (in the field pfdconfig.algorithm).
  • creates a polynomial ring containing the numerators and denominators

  • creates a list with the indices of the array entries to be decomposed (referencing the base file name)

  • and starts the computation.

Note that in more fancy environments like a cluster, one should specify absolute paths to the nodefile and the temp directory.

LIB "pfd_gspc.lib";

// configuration for gpispace
configToken gspcconfig = configure_gspc();

gspcconfig.options.tempdir = "tempdir";
gspcconfig.options.nodefile = "nodefile";
gspcconfig.options.procspernode = 8;

// Should the user want to run withouth the gspc-monitor
// the following two lines may be commented out.
gspcconfig.options.loghostfile = "loghostfile";
gspcconfig.options.logport = 6439;

// configuration for the problem to be computed.
configToken pfdconfig = configure_pfd();
pfdconfig.options.filename = "xb_deg5";
pfdconfig.options.inputdir = "input";
pfdconfig.options.outputdir = "results";
pfdconfig.options.outputformat = "ssi,cleartext,listnumden,indexed_denominator";
pfdconfig.options.parallelism = "intertwined";
pfdconfig.options.algorithm = "Leinartas";

ring r = 0, x, lp;

list entries = list( list(1, 1), list(1, 2), list(1, 3), list(1, 4)
                   , list(1, 5), list(1, 6), list(1, 7), list(1, 8)
                   , list(1, 9), list(1, 10)
                   );

parallel_pfd( entries
            , gspcconfig
            , pfdconfig
            );

The results can then be found in the directory $software_ROOT/results. Note that if an output file already exist, the respective computation will not be repeated to allow for restartability. The Singular command returns a list of strings providing information about whether the computation was successful, or was skipped since the result file is already there. After the above run, the output directory contains for each individual computation output files in the requested formats.

Configuration options for pfd-parallel

  • Output formats (to be specified in the field pfdconfig.options.outputformat as list of strings allowing for multiple output formats):

    • ssi
      binary Singular serialization format (also used internally for serialization, consistent between input and output)
      Note that the ssi format also contains the information about the basering, so if you read it in in Singular, you get both the ring and the answer
      Naming convention: result_filename_i_j.ssi
    • listnumden
      semi-human readable, list (interpreted as a sum) of lists of numerators and factored denominators
      Note that to read this format into Singular, you have to first create the appropriate basering
      Naming convention: result_filename_i_j_input.txt
    • indexed_denominator
      human readable form, indexing of denominator factors, creates two files, one with the pfd and one with the indexed factors
      Naming convention: result_indexed_denominator_filename_i_j.txt, result_factors_denominator_filename_i_j.txt
    • indexed_numerator_denominator
      human readable form, indexing of numerator and denominator factors, creates two files, one with the pfd and one with the indexed factors
      Naming convention: result_indexed_filename_i_j.txt, result_factors_filename_i_j.txt
    • cleartext
      human readable form, no indexing
      Naming convention: result_filename_i_j.txt

    The computation also creates for each rational function a log file giving information about the the individual steps of the algorithm and their time and memory usage.
    Naming convention: resources_filename_i_j.txt

  • Input formats (to be specified in the field pfdconfig.options.suffix as a string):

    • ssi binary Singular serialization format, compatible to output format.
    • txt for accepting the listnumden format
      semi-human readable format, list of lists of numerators and denominators
      Note that to read this format into Singular, you have to first create the appropriate basering

    Note that if ssi is specified the program assumes that the data is available in the high-performance Singular serialization format ssi, while if txt is specified, and the respective ssi file is not present in the input folder, the program automatically converts the text format listnumden to ssi, and continues with the ssi format.

  • parallelization strategy (to be specified in the field pfdconfig.options.parallelism)

    • intertwined
      internal parallelism on each function, intertwined with the parallelism over the different functions
    • waitAll
      parallelism over the different functions, no internal parallelism on individual functions
    • size_strategy
      handling the functions serially or in parallel depending on the size of the input function pfdconfig.options.percentage then has to be set to an integer p between 0 and 100 to specify that the p/100 largest of all input functions should be processed with parallelism per individual function (with choice of algorithm specified in pfdconfig.options.algorithm)
  • algorithmic strategy for sequential processing of functions (to be specified in the field pfdconfig.options.algorithm)
    Note that parallel processing of individual functions always uses the Leinartas strategy.

    • Leinartas
    • MultivariateApart
Clone this wiki locally