Questions tagged [mpi]

MPI is the Message Passing Interface, a library for distributed memory parallel programming and the de facto standard method for using distributed memory clusters for high-performance technical computing. Questions about using MPI for parallel programming go under this tag; questions on, eg, installation problems with MPI implementations are best tagged with the appropriate implementation-specific tag, eg MPICH or OpenMPI.

mpi
Filter by
Sorted by
Tagged with
55 votes
2 answers
49k views

sending blocks of 2D array in C using MPI

How do you send blocks of 2-D array to different processors? Suppose the 2D array size is 400x400 an I want to send blocks of sizes 100X100 to different processors. The idea is that each processor ...
Sundevil's user avatar
  • 651
24 votes
3 answers
53k views

Sending and receiving 2D array over MPI

The issue I am trying to resolve is the following: The C++ serial code I have computes across a large 2D matrix. To optimize this process, I wish to split this large 2D matrix and run on 4 nodes (say)...
Ashmohan's user avatar
  • 491
42 votes
4 answers
44k views

struct serialization in C and transfer over MPI

I have defined a custom struct which I need to send over to another MPI process using the MPI_Bsend (or MPI_Send). Here is the struct: struct car{ int shifts; int topSpeed; }myCar; The issue ...
stratis's user avatar
  • 7,860
2 votes
1 answer
877 views

MPI_Recv overwrites parts of memory it should not access

In the following code the value of xysize gets changed, if I do not declare it as a parameter (which I generally cannot do). It happens only with optimizations -O2 and more in gfortran 4.7.2 and ...
Vladimir F Героям слава's user avatar
156 votes
19 answers
121k views

How do I debug an MPI program?

I have an MPI program which compiles and runs, but I would like to step through it to make sure nothing bizarre is happening. Ideally, I would like a simple way to attach GDB to any particular process,...
Jay Conrod's user avatar
  • 29.3k
20 votes
4 answers
21k views

Ordering Output in MPI

in a simple MPI program I have used a column wise division of a large matrix. How can I order the output so that each matrix appears next to the other ordered ? I have tried this simple code the ...
GBBL's user avatar
  • 576
18 votes
1 answer
7k views

MPI_Rank return same process number for all process

I'm trying to run this sample hello world program with openmpi and mpirun on debian 7. #include <stdio.h> #include <mpi/mpi.h> int main (int argc, char **argv) { int nProcId, nProcNo; ...
hamedkh's user avatar
  • 1,029
13 votes
2 answers
15k views

Sending 2D arrays in Fortran with MPI_Gather

I want to send 2d chunks of data using MPI_GATHER. For example: I have 2x3 arrays on each node and I want 8x3 array on root, if I have 4 nodes. For 1d arrays, MPI_GATHER sorts data according to MPI ...
Kaveh01's user avatar
  • 131
10 votes
5 answers
24k views

MPI_Bcast a dynamic 2d array

I am trying to pass a dynamic 2d array with bcast to all ranks. I have the following code. #include <stdlib.h> #include <mpi.h> int main(int argc, char **argv) { float **array; ...
faulpin's user avatar
  • 103
87 votes
5 answers
100k views

MPI: blocking vs non-blocking

I am having trouble understanding the concept of blocking communication and non-blocking communication in MPI. What are the differences between the two? What are the advantages and disadvantages?
lamba's user avatar
  • 1,601
86 votes
2 answers
91k views

Using MPI_Bcast for MPI communication

I'm trying to broadcast a message from the root node to all other nodes using MPI_Bcast. However, whenever I run this program it always hangs at the beginning. Does anybody know what's wrong with it? ...
David's user avatar
  • 2,150
22 votes
1 answer
5k views

Tools to measure MPI communication costs [closed]

I'm using MPI and I want to measure the communication costs, so that I can then compare them to the 'processing' costs, e.g., how much time do I need to scatter a list through n processes and then ...
dx_mrt's user avatar
  • 717
13 votes
1 answer
8k views

Trouble Understanding MPI_Type_create_struct

I'm having trouble understanding the MPI_Type_create_struct method. Say we have a struct: struct foo(){ float value; char rank; } And we want to send this struct to another ...
VMA92's user avatar
  • 479
20 votes
3 answers
15k views

Understanding concurrent file writes from multiple processes

From here : Is file append atomic in UNIX Consider a case where multiple processes open the same file and append to it. O_APPEND guarantees that seeking to the end of file and then beginning the ...
Korizon's user avatar
  • 3,717
6 votes
4 answers
4k views

Creating a counter that stays synchronized across MPI processes

I have quite a bit of experience using the basic comm and group MPI2 methods, and do quite a bit of embarrassingly parallel simulation work using MPI. Up until now, I have structured my code to have ...
MarkD's user avatar
  • 4,924
5 votes
6 answers
14k views

Good profiler for Fortran and MPI

Which profiler do you use for Fortran code base with MPI in it? gprof doesn't seem to be working correctly. Sun Studio Analyzer only returns the timings for the C/C++ system calls and none of the ...
SkypeMeSM's user avatar
  • 3,257
19 votes
2 answers
8k views

Scatter Matrix Blocks of Different Sizes using MPI

(Suppose all the matrices are stored in row-major order.) An example that illustrate the problem is to distribute a 10x10 matrix over a 3x3 grid, so that the size of the sub-matrices in each node ...
Roun's user avatar
  • 1,478
15 votes
1 answer
8k views

Parallel Algorithms for Generating Prime Numbers (possibly using Hadoop's map reduce)

Generating Prime numbers is a toy problem that I often attempt from time to time, especially when experimenting with a new programming language, platform or style. I was thinking of attempting to ...
user1172468's user avatar
  • 5,334
14 votes
1 answer
21k views

MPI partition matrix into blocks

I want to partition matrix into blocks (not stripes) and then distribute this blocks using MPI_Scatter. I came up with solution which works, but I think it is far from "best practice". I have 8x8 ...
Andraz's user avatar
  • 709
12 votes
1 answer
12k views

Sending columns of a matrix using MPI_Scatter

I'm trying to write a matrix-vector multiplication program using MPI. I'm trying to send columns of the matrix to separate processes and locally calculate the result. In the end I do a MPI_Reduce ...
hattenn's user avatar
  • 4,401
10 votes
3 answers
30k views

How to compile an MPI included c program using cmake

I am trying to apply openmp and mpi techniques to an open source C program which requires "cmake . && make" to be built. I already found at How to set linker flags for OpenMP in CMake's ...
user3403765's user avatar
9 votes
1 answer
21k views

MPI Reading from a text file

I am learning to program in MPI and I came across this question. Lets say I have a .txt file with 100,000 rows/lines, how do I chunk them for processing by 4 processors? i.e. I want to let processor 0 ...
user avatar
2 votes
2 answers
998 views

MPI_Gather gives seg fault in the most basic code

I am working on a much bigger program where I struggle with MPI_Gather. I wrote a minimal example code, see below. program test use MPI integer :: ierr, rank, size double precision, ...
Marcel's user avatar
  • 51
11 votes
1 answer
10k views

MPI_Type_create_subarray and MPI_Gather

I have to solve a little mpi problem. I have 4 slaves processes and each of these wants to send a 2d subarray (CHUNK_ROWS X CHUNK_COLUMNS) to master 0. Master 0 collects all chunks in ddd[ROWS][...
Riff's user avatar
  • 205
11 votes
2 answers
4k views

Probe seems to consume the CPU

I've got an MPI program consisting of one master process that hands off commands to a bunch of slave processes. Upon receiving a command, a slave just calls system() to do it. While the slaves are ...
Ben Kovitz's user avatar
  • 4,980
7 votes
1 answer
9k views

writing a matrix into a single txt file with mpi

I have a huge matrix that I divided it into some sub matrices and I make some computation on it. After those computations I have to write that matrix into a single file for post processing. Is it ...
peaceman's user avatar
  • 1,509
4 votes
1 answer
2k views

Can MPI_Publish_name be used for two separately started applications?

I write an OpenMPI application which consists of a server and a client part which are launched separately: me@server1:~> mpirun server and me@server2:~> mpirun client server creates a port ...
zonksoft's user avatar
  • 2,409
3 votes
3 answers
13k views

MPI_Scatter - sending columns of 2D array

I want to send 2D array's columns, each to separate process. I have now one whole 2d array and I am stuck with MPI_Scatter. How to send whole columns as a field? Thanks edit: I have array - float ...
Waypoint's user avatar
  • 17.5k
22 votes
2 answers
7k views

thread safety of MPI send using threads created with std::async

According to this website, the usage of MPI::COMM_WORLD.Send(...) is thread safe. However in my application I often (not always) run into deadlocks or get segmentation faults. Enclosing each call of ...
stefan's user avatar
  • 10.3k
15 votes
1 answer
9k views

MPI Get Processor with Minimum value

In MPI, I am doing a reduce operation(minimum) on a value. This works fine, but how do I grab the processor number that the minimum came from and solicit that processor for more information(or send ...
James Cotter's user avatar
12 votes
3 answers
9k views

Creating an MPI_Datatype for a structure containing pointers

I have the following structure. typedef struct { int *Ai; double *Ax; int nz; }column; I want to transfer this structure using MPI_Send and MPI_Receive. How do I create an MPI_Datatype for this ...
ap040's user avatar
  • 121
8 votes
1 answer
6k views

MPI hangs on MPI_Send for large messages

There is a simple program in c++ / mpi (mpich2), which sends an array of type double. If the size of the array more than 9000, then during the call MPI_Send my programm hangs. If array is smaller than ...
user2240771's user avatar
3 votes
6 answers
15k views

MPI - Printing in an order

I'm trying to write a function in C where every processor prints it's own data. Here is what i have: void print_mesh(int p,int myid,int** U0,int X,int Y){ int i,m,n; for(i=0;i<p;i++){ ...
Κωστας Ιωαννου's user avatar
0 votes
2 answers
342 views

Using MPI, a message appears to have been recieved before it has been sent

In my test program below I am sending a message from one process to another. The trace printfs seem to indicate what the message is being received before it is sent, why is this so? #include <...
user267562's user avatar
48 votes
1 answer
64k views

HPC cluster: select the number of CPUs and threads in SLURM sbatch

The terminology used in the sbatch man page might be a bit confusing. Thus, I want to be sure I am getting the options set right. Suppose I have a task to run on a single node with N threads. Am I ...
Tanash's user avatar
  • 521
17 votes
3 answers
2k views

How do I retain precision for a Fortran MPI program in a portable way?

I have a Fortran program where I specify the kind of the numeric data types in an attempt to retain a minimum level of precision, regardless of what compiler is used to build the program. For example:...
rks171's user avatar
  • 1,020
16 votes
3 answers
17k views

Using valgrind to spot error in mpi code

I have a code which works perfect in serial but with mpirun -n 2 ./out it gives the following error: ./out': malloc(): smallbin double linked list corrupted: 0x00000000024aa090 I tried to use ...
Shibli's user avatar
  • 6,019
15 votes
3 answers
16k views

Deadlock with MPI

I'm experimenting with MPI and was wondering if this code could cause a deadlock. MPI_Comm_rank (comm, &my_rank); if (my_rank == 0) { MPI_Send (sendbuf, count, MPI_INT, 1, tag, comm); ...
Evgenij Reznik's user avatar
12 votes
3 answers
4k views

MPI Fortran code: how to share data on node via openMP?

I am working on an Fortan code that already uses MPI. Now, I am facing a situation, where a set of data grows very large but is same for every process, so I would prefer to store it in memory only ...
chris's user avatar
  • 317
8 votes
2 answers
14k views

How to use MPI_Gatherv for collecting strings of diiferent length from different processor including master node?

I am trying to collect different strings of different length from all processors (including the master node) into a single string (array of characters) at the master node. Here is the prototype for ...
Mitali Srivastava's user avatar
7 votes
1 answer
16k views

Increase of virtual memory without increse of VmSize

I searched for my problem in Google and at this site but i still don't understand the solution. I have piece of MPI program which RECV some data. Program crashes on big arrays with error of ...
vovo's user avatar
  • 407
6 votes
1 answer
4k views

MPI IO Reading and Writing Block Cyclic Matrix

I have a school project to do matrix multiplication on a hpc distributed system. I need to read in a matrix from a parallel IO system and use pblacs to perform the matrix multiplication in parallel ...
James Cotter's user avatar
6 votes
4 answers
15k views

Maximum amount of data that can be sent using MPI::Send

With the syntax for MPI::Isend as MPI::Request MPI::Comm::Isend(const void *buf, int count, const MPI::Datatype& datatype, int dest, int tag) const; is the amount ...
Suman Vajjala's user avatar
3 votes
3 answers
590 views

Openmpi mpmd get communication size

I have two openmpi programs which I start like this mpirun -n 4 ./prog1 : -n 2 ./prog2 Now how do I use MPI_Comm_size(MPI_COMM_WORLD, &size) such that i get size values as prog1 size=4 prog2 ...
Pbd's user avatar
  • 1,249
1 vote
1 answer
2k views

While loop in main thread is getting stuck when using std::thread

I have a simple C++ code to test and understand threading. The code has the main thread + a secondary thread. The secondary updates the value of a variable which the main thread loop depends on. When ...
Lily's user avatar
  • 826
1 vote
2 answers
5k views

Dynamic Memory Allocation in MPI

I am new to MPI. I wrote a simple code to display a matrix using multiple process. Say if I have a matrix of 8x8 and launching the MPI program with 4 processes, the 1st 2 rows will be printed my 1st ...
suraj1291993's user avatar
-2 votes
1 answer
222 views

srun: error: distribution type `em' is not recognized

I wrote a c program for this equation, I am trying to write down a mpi programming for the above formula. #include <stdio.h> #include <math.h> #include<mpi.h> double sum(int n); ...
Encipher's user avatar
  • 1,436
62 votes
11 answers
221k views

fatal error: mpi.h: No such file or directory #include <mpi.h>

when I compile my script with only #include <mpi.h> it tells me that there is no such file or directory. But when i include the path to mpi.h as #include "/usr/include/mpi/mpi.h" (the path ...
user2804865's user avatar
  • 1,004
28 votes
1 answer
35k views

How are MPI_Scatter and MPI_Gather used from C?

So far, my application is reading in a txt file with a list of integers. These integers needs to be stored in an array by the master process i.e. processor with rank 0. This is working fine. Now, ...
Force444's user avatar
  • 3,371
22 votes
4 answers
11k views

How can I pipe stdin from a file to the executable in Xcode 4+?

I have an mpi program and managed to compile and link it via Xcode 4. Now I want to debug it using Xcode 4. How can I pipe the standard input to the program from a file? In terminal I would type ...
sta's user avatar
  • 456

1
2 3 4 5
15