Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Problem with memory in mpi program
From: Yeni Lora (yenisleidi.lora_at_[hidden])
Date: 2013-12-18 14:37:59

My program it is with MPI and OpenMP, and is a sample program take
much memory, I don't know the memory RAM consume for a mpi program and
I want to know if mpi consume a lot of memory when if used together
openmp or I doing something wrong, for take memory Ram of mi program I
used a file /proc/id_proc/stat, where id_proc if the id of my process.
This is my example program:

#include <stdio.h>
#include "mpi.h"
#include <omp.h>
#include <vector>
#include <algorithm>

int main(int argc, char** argv){

         int my_rank; /* rank of process */
         int p; /* number of processes */
         MPI_Init_thread(&argc, &argv, MPI::THREAD_MULTIPLE,&argc);
         /* find out process rank */
         MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
         /* find out number of processes */
         MPI_Comm_size(MPI_COMM_WORLD, &p);
         char cad[4];
         MPI_Status status;

#pragma omp parallel
                         int h = omp_get_thread_num();

                                 MPI_Send(&cad, 1, MPI::CHAR, my_rank, 11,MPI_COMM_WORLD);
                                 std::vector<bool> all(2,0);
                                MPI_Recv(&cad, 2, MPI::CHAR, MPI::ANY_SOURCE,

        /* shut down MPI */
        return 0;

mpic++ -fopenmp -fno-threadsafe-statics -o sample_program sample_program.c

mpirun sample_program

and the memory consume: 190MB

Please I need help is very important to me get a low memory consume