LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: William Boatin (wboatin_at_[hidden])
Date: 2003-06-23 09:31:06


I am trying to use MPI in some pascal code I am writing using Kylix. I am a
little new to pascal and Linux and totally new to MPI.
That being said, I downloaded the rpm for LAM/MPI-6.5.9 and ran the test,
which gave no errors, so I assume that installation went well.
To use MPI in pascal, i learnt that some header files needed to be
translated from .h files to .pas files. I found a couple of translations
from perusing this list's archives. This is one of the messages I read:
   http://www.lam-mpi.org/MailArchives/lam/msg03876.php

I found another version or something that looks similar. I cant remember
where I copied it from but here it is:

unit mpi;

{$LinkLib mpi++}
{$LinkLib mpio}
{$LinkLib mpi}
{$LinkLib tstdio}
{$LinkLib trillium}
{$LinkLib args}
{$LinkLib t}

interface

const
MPI_MAX_OBJECT_NAME=64;
MPI_ANY_SOURCE= -1;
MPI_ANY_TAG = -1;

type
c_int= longint;
c_int4= longint;
c_int8= record
   low, high: longint;
   end;
c_long= c_int8;

MPI_Group= ^_group;
_group= record
   g_nprocs: c_int;
   g_myrank: c_int;
   g_refcount: c_int;
   g_f77handle: c_int;
   g_procs: pointer {to be completed. see rpisys.h}
   end;

cmp_func= function: c_int;
ah_desc= record
        ah_maxnelem: c_int4;
        ah_nelem: c_int4;
        ah_elemsize: c_int4;
        ah_nullkey: c_int4;
        ah_mode: c_int4;
        ah_lru: ^c_int4;
        ah_table: pointer;
        ah_cmp: cmp_func;
        end;
HASH= ah_desc;

_osdhdr= record
   os_func: c_int;
   os_op: c_int;
   os_count: c_int;
   os_format: c_int;
   os_type: c_int;
   os_blklen: c_int;
   os_stride: c_int;
   os_pad: c_int;
   os_disp: c_int8;
   end;

MPI_Aint= c_long;

MPI_Request= pointer{^_req} {To be completed. See rpisys.h};

errfunc= procedure;
MPI_Errhandler= ^_errhdl;
_errhdl= record
   eh_func: errfunc;
   eh_f77handle: c_int;
   eh_flags: c_int;
   end;

MPI_Comm= ^_comm;
MPI_Win= ^_window;
_window=record
   w_comm: MPI_Comm;
   w_base: pointer;
   w_size: MPI_Aint;
   w_disp_unit: c_int;
   w_flags: c_int;
   w_ngroup: c_int;
   w_ncomplete: c_int;
   w_nfence: c_int;
   w_pstate: ^c_int;
   w_f77handler: c_int;
   w_keys: ^HASH;
   w_req: MPI_Request;
   w_header: _osdhdr;
   w_errhdl: MPI_Errhandler;
   w_reserved: array[1..4] of c_long;
   end;

_comm= record
    c_flags: c_int;
    c_contextid: c_int;
    c_refcount: c_int;
    c_group: MPI_Group;
    c_rgroup: MPI_Group;
    c_keys: ^HASH;
    c_cube_dim: c_int;
    c_topo_type: c_int;
    c_topo_nprocs: c_int;
    c_topo_ndims: c_int;
    c_topo_nedges: c_int;
    c_topo_dims: ^c_int;
    c_topo_coords: ^c_int;
    c_topo_index: ^c_int;
    c_topo_edges: ^c_int;
    c_f77handle: c_int;
    c_window: MPI_Win;
    c_errhdl: MPI_Errhandler;
    c_name: array[1..MPI_MAX_OBJECT_NAME] of char;
    c_shadow: MPI_Comm;
    c_reserved: array[1..4] of c_long;
    end;

MPI_Datatype= ^_dtype;
_dtype= record
   dt_format: c_int;
   dt_flags: c_int;
   dt_commit: c_int;
   dt_refcount: c_int;
   dt_f77handle: c_int;
   dt_label: c_int;
   dt_align: c_int;
   dt_upper: c_int;
   dt_lower: c_int;
   dt_size: c_int;
   dt_dataup: c_int;
   dt_datalow: c_int;
   dt_nelem: c_int;
   dt_count: c_int;
   dt_length: c_int;
   dt_stride: MPI_Aint;
   dt_dtype: MPI_Datatype;
   dt_lengths: ^c_int;
   dt_disps: ^MPI_Aint;
   dt_dtypes: ^MPI_Datatype;
   dt_keys: ^HASH;
   dt_uargs: ^c_int;
   dt_name: array[1..MPI_MAX_OBJECT_NAME] of char;
   dt_reserved: array[1..4] of c_long;
   end;

_status= record
   MPI_SOURCE: c_int;
   MPI_TAG: c_int;
   MPI_ERROR: c_int;
   st_length: c_int;
   end;
MPI_STATUS= _status;

var
lam_mpi_comm_world: _comm; external name 'lam_mpi_comm_world';
lam_mpi_comm_self: _comm; external name 'lam_mpi_comm_self';

lam_mpi_byte: _dtype; external name 'lam_mpi_byte';
lam_mpi_packed: _dtype; external name 'lam_mpi_packed';
lam_mpi_char: _dtype; external name 'lam_mpi_char';
lam_mpi_short: _dtype; external name 'lam_mpi_short';
lam_mpi_int: _dtype; external name 'lam_mpi_int';
lam_mpi_long: _dtype; external name 'lam_mpi_long';
lam_mpi_float: _dtype; external name 'lam_mpi_float';
lam_mpi_double: _dtype; external name 'lam_mpi_double';
lam_mpi_long_double: _dtype; external name 'lam_mpi_long_double';
lam_mpi_unsigned_char: _dtype; external name 'lam_mpi_unsigned_char';
lam_mpi_unsigned_short: _dtype; external name 'lam_mpi_unsigned_short';
lam_mpi_unsigned_long: _dtype; external name 'lam_mpi_unsigned_long';
lam_mpi_unsigned: _dtype; external name 'lam_mpi_unsigned';
lam_mpi_float_int: _dtype; external name 'lam_mpi_float_int';
lam_mpi_double_int: _dtype; external name 'lam_mpi_double_int';
lam_mpi_longdbl_int: _dtype; external name 'lam_mpi_longdbl_int';
lam_mpi_long_int: _dtype; external name 'lam_mpi_long_int';
lam_mpi_short_int: _dtype; external name 'lam_mpi_short_int';
lam_mpi_2int: _dtype; external name 'lam_mpi_2int';
lam_mpi_ub: _dtype; external name 'lam_mpi_ub';
lam_mpi_lb: _dtype; external name 'lam_mpi_lb';
lam_mpi_wchar: _dtype; external name 'lam_mpi_wchar';
lam_mpi_long_long_int: _dtype; external name 'lam_mpi_long_long_int';
lam_mpi_unsigned_long_long: _dtype; external name
'lam_mpi_unsigned_long_long';

const
MPI_COMM_WORLD: MPI_Comm = addr(lam_mpi_comm_world);
MPI_COMM_SELF: MPI_Comm= addr(lam_mpi_comm_self);

MPI_BYTE: MPI_Datatype= addr(lam_mpi_byte);
MPI_PACKED: MPI_Datatype= addr(lam_mpi_packed);
MPI_CHAR: MPI_Datatype= addr(lam_mpi_char);
MPI_SHORT: MPI_Datatype= addr(lam_mpi_short);
MPI_INT: MPI_Datatype= addr(lam_mpi_int);
MPI_LONG: MPI_Datatype= addr(lam_mpi_long);
MPI_FLOAT: MPI_Datatype= addr(lam_mpi_float);
MPI_DOUBLE: MPI_Datatype= addr(lam_mpi_double);
MPI_LONG_DOUBLE: MPI_Datatype= addr(lam_mpi_long_double);
MPI_UNSIGNED_CHAR: MPI_Datatype= addr(lam_mpi_unsigned_char);
MPI_UNSIGNED_SHORT: MPI_Datatype= addr(lam_mpi_unsigned_short);
MPI_UNSIGNED_LONG: MPI_Datatype= addr(lam_mpi_unsigned_long);
MPI_UNSIGNED: MPI_Datatype= addr(lam_mpi_unsigned);
MPI_FLOAT_INT: MPI_Datatype= addr(lam_mpi_float_int);
MPI_DOUBLE_INT: MPI_Datatype= addr(lam_mpi_double_int);
MPI_LONG_DOUBLE_INT: MPI_Datatype= addr(lam_mpi_longdbl_int);
MPI_LONG_INT: MPI_Datatype= addr(lam_mpi_long_int);
MPI_SHORT_INT: MPI_Datatype= addr(lam_mpi_short_int);
MPI_2INT: MPI_Datatype= addr(lam_mpi_2int);
MPI_UB: MPI_Datatype= addr(lam_mpi_ub);
MPI_LB: MPI_Datatype= addr(lam_mpi_lb);
MPI_WCHAR: MPI_Datatype= addr(lam_mpi_wchar);
MPI_LONG_LONG_INT: MPI_Datatype= addr(lam_mpi_long_long_int);
MPI_UNSIGNED_LONG_LONG: MPI_Datatype= addr(lam_mpi_unsigned_long_long);

function MPI_Init(i,j:pointer): c_int; cdecl;
function MPI_Comm_size(comm: MPI_Comm; var size: c_int): c_int; cdecl;
function MPI_Comm_rank(comm: MPI_Comm; var rank: c_int): c_int; cdecl;
function MPI_Send(buff: pointer; buffsize: c_int; MPI_TYPE: MPI_DATATYPE;
     i, j: c_int; comm: MPI_Comm): c_int; cdecl;
function MPI_Recv(buff: pointer; buffsize: c_int; MPI_TYPE: MPI_DATATYPE;
     i, j: c_int; comm: MPI_Comm; var status: MPI_STATUS): c_int; cdecl;
function MPI_Finalize: c_int; cdecl;

implementation

function MPI_Init(i,j:pointer): c_int; cdecl; external;
function MPI_Comm_size(comm: MPI_Comm; var size: c_int): c_int;
   cdecl; external;
function MPI_Comm_rank(comm: MPI_Comm; var rank: c_int): c_int;
   cdecl; external;
function MPI_Send(buff: pointer; buffsize: c_int; MPI_TYPE: MPI_DATATYPE;
     i, j: c_int; comm: MPI_Comm): c_int; cdecl; external;
function MPI_Recv(buff: pointer; buffsize: c_int; MPI_TYPE: MPI_DATATYPE;
     i, j: c_int; comm: MPI_Comm; var status: MPI_STATUS): c_int;
     cdecl; external;
function MPI_Finalize: c_int; cdecl; external;

begin
end.

In both versions, my problem is the same. I cant seem to find the libraries
that need to be included. I downloaded lam-6.5.9.tar.gz, uncompressed it,
ran configure, ran make, and then looked for the .o files which i think are
what the above code is trying to link too. I found mpi++.o, trillium.o but
none of the others. Can anyone help?

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail