Using Meroon with MPI

These steps seem to work to run programs that use Meroon with MPI.

  1. Configure and build gambit with mpicc. The following commands will build a gambit and put it in /usr/local/Gambit/current/{bin,include,lib,...}
    1. Change directory to the Gambit source directory; run make mostlyclean if necessary.
    2. ./configure CC=mpicc --enable-single-host --enable-multiple-versions
    3. make
    4. sudo make install
    5. Make sure /usr/local/Gambit/current/bin is in your path.
  2. Make Meroon with the Gambit built with mpicc and install:
    1. Change directory to the Meroon source directory. Remove all files beginning with _meroon if necessary.
    2. ./make_meroon
    3. sudo cp _meroon.o1 /usr/local/Gambit/current/lib/
    4. sudo ln -s /usr/local/Gambit/current/bin/gsi /usr/local/Gambit/current/bin/gsi++
    5. sudo ln -s /usr/local/Gambit/current/bin/gsc /usr/local/Gambit/current/bin/gsc++
    6. Create a file /usr/local/Gambit/current/lib/gambext that contains
      (case (string->symbol (car (##command-line))) ((gsi++ gsc++) (load "~~/lib/_meroon.o1")) (else #f))
    You should now have a working gsc++ and gsi++.
  3. Build and compile your program that uses Meroon.
    1. Here's a file point-test.scm that uses Meroon:
      % cat point-test.scm
      (define-class Point Object
        ((= x)
         (= y)))
      
      (define a (make-Point 1. 2.))
      
      (pp (list (Point-x a) (Point-y a)))
      
    2. Compile it: gsc++ point-test.scm
    3. Run it:
      % mpirun -np 4 gsi++ point-test.o1
      [ Meroon V3 Paques2001+1 $Revision: 1.1 $ ]
      (1. 2.)
      [ Meroon V3 Paques2001+[ Meroon V3 Paques2001+11 $Revision: 1.1 $ ]
      $Revision: 1.1 $ ]
      (1. 2.)
      (1. 2.)
      [ Meroon V3 Paques2001+1 $Revision: 1.1 $ ]
      (1. 2.)
      
  4. To actually use the MPI API, you'll need to use the Gambit Foreign Function Interface (FFI) to map the C constants and routines to Scheme constants and routines. See the Gambit documentation about how to do this.