Giter Site home page Giter Site logo

Comments (13)

akva2 avatar akva2 commented on August 27, 2024

uhm, depends on your mpi implementation. that's all handled by the mpirun command, which is not part of opm.

from opm-common.

Bakh avatar Bakh commented on August 27, 2024

4

Thank you for your reply. I believe that the number '4' in the example above is chosen by the specific user. I thought that, initially, this number is assigned as a parameter in the code (for example, I've seen NUM_PROCS, NP, MPI_PROCS, BASE_MPI_PROCS, TEST_MPI_PROCS, nprocs).

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

yes. I suggest you read some basic MPI tutorial, https://mpitutorial.com/tutorials/mpi-hello-world/ was my first hit on google, no quality control but i'm sure it's on topic.

https://github.com/OPM/opm-simulators/blob/master/opm/simulators/flow/Main.cpp#L125 is the setup code for the flow simulators. the gist of it is;
mpirun parses the command line parameters, launches the specified amount of flow executables, the processes then read out the total number of processes (MPI_Comm_size) and its assigned rank (MPI_Comm_rank) from the MPI library. These mpi calls are wrapped in the Parallel::Communication class, ie. comm.size() and comm.rank();

from opm-common.

Bakh avatar Bakh commented on August 27, 2024

Your comments and suggestions are highly appreciated. I am new in MPI and C++ OOP. My background is Fortran. When I run the Flow executable file, it uses 1 MPI processes with 2 OMP threads on each. Are these numbers set by default in the source code? I would like to continue working with the Flow executable file and I'm interested in implementing the read a number of MPI processes from an input file.

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

threads are set by default in the executable, but that is not an mpi thing, that's an openmp thing, see https://github.com/OPM/opm-simulators/blob/master/opm/simulators/flow/Main.hpp#L669

but it's important to understand that threads and processes are different things. a process is a separate instance of the application, a thread is the number of cores usable by a single instance of the application.

when you run the executable directly only a single instance of the executable is started - it's exactly like running a normal sequential program. which means the world comm will have size 1, and the single instance will have rank 0.

when you run through mpirun -np x, x instances of the application is started. each of these processes will have y threads (defaults to 2).

pointers to read more: threads is 'shared memory parallelism', while mpi/processes are 'distributed memory parallelism'.

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

oh, and you can use both mpi and openmp in fortran applications as well.

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

and no, you cannot implement reading the number of processes from an input file in flow itself. mpirun is necessary to launch applications, and this launches the flow executable. by the time the simulator is launched it's too late. this needs to be done in a frontend script/tool.

from opm-common.

Bakh avatar Bakh commented on August 27, 2024

Thank you for your informative reply. In this case I need to develop a frontend script/tool which reads a number of MPI processes from an input file and launches the Flow executable file according to the input number of MPI processes. Do you think it's possible? If so, I would prefer using C++ for a frontend script/tool development.

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

it's most definitely possible. personally i'd use something more suited for such tasks though, such as python, but to each his own.

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

also maybe https://github.com/OPM/opm-utilities/tree/master/opmrun might be of use

from opm-common.

Bakh avatar Bakh commented on August 27, 2024

I can see that OPMRUN is an excellent tool. When developing a frontend script/tool for my purpose, may there be a need for introducing any change in the OPM Flow source code which is compiled to an executable file?

from opm-common.

akva2 avatar akva2 commented on August 27, 2024

nope.

from opm-common.

Bakh avatar Bakh commented on August 27, 2024

Thanks.

from opm-common.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.