[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Glib and MPI



Hi, 
I am working on an application I'd like to parallellize with MPI. For
the momement only with liblam. The application already makes extensive
use of libglib. It seems that the program crashes when using libglib.
Does anybody have a suggestion how to use properly mpi and libglib?

I am using the current versions of libglib-2.0 and liblam on
Debian/Unstable.

Below a short example that works fine when using the printf() statement,
but crashes when g_message() is enabled.

Thanks,
Gerber



simple.c:

#include <stdio.h>
#include <stdlib.h>
#include <glib-2.0/glib.h>
#include <mpi.h>

/*-----------------------------------------------------------------------------
 * Simple testing program for MPI and libglib
 * Build with:
mpicc `pkg-config --cflags glib-2.0` -I/usr/include/glib-2.0 \
-DENABLE_MPI -g -O2 -c -o simple.o simple.c 

mpicc -Wall   -DENABLE_MPI -g -O2   -o simple  simple.o -lglib-2.0 -lmpi

 * Run with (after invoking lamboot):
mpirun -np 3 ./simple
 */

int main(int argc, char *argv[])
{
  int me = 0, nprocs;
  int namelen;
  char processor_name[MPI_MAX_PROCESSOR_NAME];


  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
  MPI_Comm_rank(MPI_COMM_WORLD, &me);
  MPI_Get_processor_name(processor_name, &namelen);

/*   g_message("Process %d of %d at %s\n", me, nprocs, processor_name);
*/
  printf("Process %d of %d at %s\n", me, nprocs, processor_name);


  printf("%d: Calling MPI_Finalize()\n", me);
  MPI_Finalize();
  exit(0);
}


-- 
developer of Gpiv: software for Particle Image Velocimetry
URL: http:/gpiv.sourceforge.net

GnuPG fingerprint: 
BF0A BBFE 5623 9761 C9E1 7C82 8B08 F586 D39A 2B64 

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: