Hi Jack,
  cplex.importModel(model, problemFile) basically reads the problem from "problemFile" and add its content to "model". So, I do not see
any problem calling that in your code for each process. The best way is just to try it out and let us know how it goes.

With best regards,
-Belaid.

 



From: dtustudy68@hotmail.com
To: users@open-mpi.org
Date: Wed, 9 Mar 2011 23:42:00 -0700
Subject: Re: [OMPI users] Open MPI access the same file in parallel ?

Hi, thanks for your code. 

I have test it with a simple example file. It works well without any conflict of parallel accessing the same file.

Now, I am using CPLEX (an optimization model solver) to load a model data file, which can be 200 MBytes. 

CPLEX.importModel(modelName, dataFileName) ;

I do not know how CPLEX code handle the reading the model data file.

Any suggestions or ideas are welcome.


thanks

Jack 



From: belaid_moa@hotmail.com
To: users@open-mpi.org
Date: Thu, 10 Mar 2011 05:51:31 +0000
Subject: Re: [OMPI users] Open MPI access the same file in parallel ?

Hi,
  You can do that with C++ also. Just for fun of it, I produced a little program for that; each process reads the whole
file and print the content to stdout. I hope this helps:
----
#include <mpi.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main (int argc, char* argv[]) {
  int rank, size;
  string line;
  MPI_Init (&argc, &argv);     
  MPI_Comm_size (MPI_COMM_WORLD, &size);       
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);      
  ifstream txtFile("example.txt");
  if (txtFile.is_open()) {
    while ( txtFile.good() ) {
      getline (txtFile,line);
      cout << line << endl;
    }
    txtFile.close();
  }else {
    cout << "Unable to open file";
  }
  MPI_Finalize(); /*end MPI*/
  return 0;
}
----
With best regards,
-Belaid.




From: dtustudy68@hotmail.com
To: users@open-mpi.org
Date: Wed, 9 Mar 2011 22:08:44 -0700
Subject: Re: [OMPI users] Open MPI access the same file in parallel ?

Thanks, 

I only need to read the file. And, all processes only to read the file only once. 

But, the file is about 200MB. 

But, my code is C++. 

Does Open MPI support this ?

thanks


From: solarbikedz@gmail.com
Date: Wed, 9 Mar 2011 20:57:03 -0800
To: users@open-mpi.org
Subject: Re: [OMPI users] Open MPI access the same file in parallel ?

Under my programming environment, FORTRAN, it is possible to parallel read (using native read function instead of MPI's parallel read function).  Although you'll run into problem when you try to parallel write to the same file.

On Wed, Mar 9, 2011 at 8:45 PM, Jack Bryan <dtustudy68@hotmail.com> wrote:
Hi, 

I have a file, which is located in a system folder, which can be accessed by all parallel processes. 

Does Open MPI allow multi processes to access the same file at the same time ? 

For example, all processes open the file and load data from it at the same time. 

Any help is really appreciated. 

thanks

Jack

Mar 9 2011

 

_______________________________________________
users mailing list
users@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users



--
David Zhang
University of California, San Diego

_______________________________________________ users mailing list users@open-mpi.org http://www.open-mpi.org/mailman/listinfo.cgi/users

_______________________________________________ users mailing list users@open-mpi.org http://www.open-mpi.org/mailman/listinfo.cgi/users
_______________________________________________ users mailing list users@open-mpi.org http://www.open-mpi.org/mailman/listinfo.cgi/users

_______________________________________________ users mailing list users@open-mpi.org http://www.open-mpi.org/mailman/listinfo.cgi/users