Re: [OMPI devel] Question on MPI_Info

2009-07-22 Thread Jeff Squyres
You need to either initialize the info object that you are passing  
down (with MPI_Info_create, and later free it with MPI_Info_free) to  
MPI_File_open or pass in MPI_INFO_NULL.



On Jul 16, 2009, at 6:25 AM, Prasadcse Perera wrote:


Hi all,
I have been trying some simple code to write a file using Parallel I/ 
O on Open MPI. Here I specify the MPI_Info value as 0 and the  
execution terminates with this messge for any number of processes:


*** An error occurred in MPI_File_open
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_INFO: invalid info object
*** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

The src file is attached here .And im using openmpi-1.3.3a1r21566  
build.

--
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=3489381
___
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel



--
Jeff Squyres
jsquy...@cisco.com



[OMPI devel] Question on MPI_Info

2009-07-16 Thread Prasadcse Perera
Hi all,
I have been trying some simple code to write a file using Parallel I/O on
Open MPI. Here I specify the MPI_Info value as 0 and the execution
terminates with this messge for any number of processes:

*** An error occurred in MPI_File_open
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_INFO: invalid info object
*** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

The src file is attached here .And im using openmpi-1.3.3a1r21566 build.
-- 
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=3489381

#include 
#include 


int main(int args, char* argv[]){
  int size, rank;
  MPI::Init();
  size = MPI::COMM_WORLD.Get_rank();
  size = MPI::COMM_WORLD.Get_size();
  int amode, size_int;

  char *fname, *drep;
  MPI_Datatype etype, filetype;
  MPI_Info info;
  MPI_Status status;
  MPI_Offset disp;
  MPI_File fh;
  fname = "testfile.txt";
  drep = "native";

  amode = MPI_MODE_CREATE | MPI_MODE_WRONLY;

  size_int = sizeof(size_int);
  info = 0;

  MPI_File_open(MPI_COMM_WORLD, fname, amode, info, &fh);
  disp = rank * size_int;
  etype = MPI_INTEGER;
  filetype = MPI_INTEGER;

  MPI_File_set_view(fh, disp, etype, filetype, drep, info);
  MPI_File_write(fh, &rank, 1, MPI_INTEGER, &status);

  MPI_File_close(&fh);
  MPI_Finalize();
}