[OMPI users] Program abortion at a simple MPI_Get Programm

2014-06-17 Thread Florian Hahner
Hello MPI users,

first of all i want to introduce myself.  My name is Florian Hahner and I'm 
studying applied computer science in Fulda, Germany. In our class 'parallel 
computing' I'm working at a MPI-2 Project to show the benefits and the working 
method of one-sided communications.

I wrote a litte MPI program to demonstrate the mpi_get() function (see 
attachment).

The idea behind the program is that a master process with rank 0 fills an 
integer array with the size of MPI_Comm_size with values. The other processes 
should MPI_GET the value from this shared int array at the index of their rank.

We could compile the code, but execution will raise an error.

We compile and run it with several MPI implementations (LAMMPI, MPICH ) and get 
every time errors. Host system is:  5.10 Generic_150400-10 sun4u sparc 
SUNW,SPARC-Enterprise Solaris

PS: I've some information are missing, please fill free to ask!

Best Regards

Florian Hahner
/*
*   Beispiel Program für RMA mit MPI 2
*   Beispiel Nr. 1
* 
*   Einfuehrung von MPI_Win_create()
*   MPI_Win_fence() und MPI_get()
*
*   Author Florian Hahner
*   Datum 11. Jun 2014
*   Version 1.0
*/

#include 
#include 
#include 
int main(int argc, char** argv)
{
int rank, size, *a, *b, namelen, i, sizereal, flag;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Win win;
MPI_Init(&argc, &argv); /* Initialisiere MPI Umgebung   */
/* Ermittle den aktuellen Rang des Prozesses*/
MPI_Comm_rank(MPI_COMM_WORLD, &rank); 
/* Ermittle die Anzahl aller Prozesse im Communicator   */
MPI_Comm_size(MPI_COMM_WORLD, &size);
/* Ermittle den Prozessornamen auf dem der akt. Prozess läuft  */
MPI_Get_processor_name(processor_name, &namelen);
printf("Guten Tag. Ich bin Prozess %d von %d. Ich werde auf Host %s 
ausgefuehrt\n", rank, size, processor_name);
/* Speicherreservierung für ein int-Arrays der Groesse size */
MPI_Alloc_mem(sizeof(int)*size, MPI_INFO_NULL, &a);
MPI_Alloc_mem(sizeof(int), MPI_INFO_NULL, &b);
if (rank==0)/* Master Prozess */
{
for(i = 0; i < size; i++)
{
a[i] = i * 100;
printf("a[%d]=%d\n", i, a[i]);
}
}
MPI_Win_create(a, size * sizeof(int), sizeof(int), MPI_INFO_NULL, 
MPI_COMM_WORLD, &win);
printf ("ok1\n");
if (rank == 0)
{+
  MPI_Win_get_attr(win, MPI_WIN_SIZE, &sizereal, &flag);
  printf ("ok2\n");
  if (flag == 0)
  {
printf ("MPI_Win_get_attr(): Unknown attribute\n");
exit (EXIT_FAILURE);
  }
  else
  {
printf("Real Size %d\n", sizereal); 
  }
}
else
{
  printf ("Process %d after MPI_Win_create()\n");
}
printf ("ok3\n");

/* Erstellen des lokalen Speicherfensters   */
/* Das Speicherfenster zeigt auf den Adressraum des */
/* int-Arrays a. Es hat die Größe von size*sizeof(int)*/
/* und nutze das Window Objekt win  */

MPI_Win_fence(0, win);
if (rank>0)
  {
MPI_Get(b, 1, MPI_INT, 0, rank, 1, MPI_INT, win);
  }
MPI_Win_fence(0, win);

if (rank>0)
{
  printf("Prozess %d# hat Wert %d von Prozess 0 geholt\n", rank, b);
}

MPI_Win_free(&win);
MPI_Free_mem(a);
MPI_Finalize();
}


Re: [OMPI users] Program abortion at a simple MPI_Get Programm

2014-06-17 Thread Florian Hahner
Thanks for your reply.

I think its the best to give you the versions of the implementations I use

OpenMPI 1.8.2 
MPICH 3.0.2
LAM MPI 7.1.5

As you see in my program code, I use MPI_Win_get_attr to show the size of the 
window. Program crashes here. So I presume something went wrong at the 
WIN_Create call.

I can comment out the MPI_Win_get_attr call, but then MPI_Get reads wrong data. 
I presume It reads somewhere outside the window because printf will show 
something like 2478000

Mit freundlichen Grüßen

Florian Hahner

-Ursprüngliche Nachricht-
Von: users [mailto:users-boun...@open-mpi.org] Im Auftrag von Jeff Squyres 
(jsquyres)
Gesendet: Dienstag, 17. Juni 2014 22:10
An: Open MPI User's List
Betreff: Re: [OMPI users] Program abortion at a simple MPI_Get Programm

I'll let Nathan/others comment on the correctness of your program.

What version of Open MPI are you using?  Be sure to use the latest to get the 
most correct one-sided implementation.

Also, as one of the prior LAM/MPI developers, I must plead with you to stop 
using LAM/MPI.  We abandoned it many years ago in favor of Open MPI.  :-)


On Jun 17, 2014, at 3:59 PM, Florian Hahner  wrote:

> Hello MPI users,
>  
> first of all i want to introduce myself.  My name is Florian Hahner and I'm 
> studying applied computer science in Fulda, Germany. In our class 'parallel 
> computing' I'm working at a MPI-2 Project to show the benefits and the 
> working method of one-sided communications.
>  
> I wrote a litte MPI program to demonstrate the mpi_get() function (see 
> attachment).
>  
> The idea behind the program is that a master process with rank 0 fills an 
> integer array with the size of MPI_Comm_size with values. The other processes 
> should MPI_GET the value from this shared int array at the index of their 
> rank.
>  
> We could compile the code, but execution will raise an error.
>  
> We compile and run it with several MPI implementations (LAMMPI, MPICH ) and 
> get every time errors. Host system is:  5.10 Generic_150400-10 sun4u sparc 
> SUNW,SPARC-Enterprise Solaris
>  
> PS: I've some information are missing, please fill free to ask!
>  
> Best Regards
>  
> Florian Hahner
> ___
> users mailing list
> us...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
> Link to this post: 
> http://www.open-mpi.org/community/lists/users/2014/06/24668.php


-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

___
users mailing list
us...@open-mpi.org
Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
Link to this post: 
http://www.open-mpi.org/community/lists/users/2014/06/24669.php