Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: [OMPI devel] 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;

omp_set_num_threads(2);
#pragma omp parallel
{
                         int h = omp_get_thread_num();

                         if(h==0){
                                 MPI_Send(&cad, 1, MPI::CHAR, my_rank, 11,MPI_COMM_WORLD);
                         }
                         else{
                                 std::vector<bool> all(2,0);
                                MPI_Recv(&cad, 2, MPI::CHAR, MPI::ANY_SOURCE,
MPI::ANY_TAG,MPI_COMM_WORLD, &status);
                         }
        }

        /* shut down MPI */
        MPI_Finalize();
        
        return 0;
}

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

Run
mpirun sample_program

and the memory consume: 190MB

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