| 21 | } |
| 22 | |
| 23 | void Initialize () |
| 24 | { |
| 25 | amrex::ignore_unused(s_comm,s_info); |
| 26 | |
| 27 | ParmParse pp("amrex"); |
| 28 | pp.queryAdd("async_out", s_asyncout); |
| 29 | pp.queryAdd("async_out_nfiles", s_noutfiles); |
| 30 | |
| 31 | int nprocs = ParallelDescriptor::NProcs(); |
| 32 | s_noutfiles = std::min(s_noutfiles, nprocs); |
| 33 | |
| 34 | #ifdef AMREX_USE_MPI |
| 35 | if (s_asyncout && s_noutfiles < nprocs) |
| 36 | { |
| 37 | int provided = -1; |
| 38 | MPI_Query_thread(&provided); |
| 39 | if (provided < MPI_THREAD_MULTIPLE) { |
| 40 | amrex::Abort("AsyncOut with " + std::to_string(s_noutfiles) + " and " |
| 41 | + std::to_string(nprocs) + " processes requires " |
| 42 | + "MPI_THREAD_MULTIPLE at runtime, but got " |
| 43 | + ParallelDescriptor::mpi_level_to_string(provided)); |
| 44 | } |
| 45 | int myproc = ParallelDescriptor::MyProc(); |
| 46 | s_info = GetWriteInfo(myproc); |
| 47 | MPI_Comm_split(ParallelDescriptor::Communicator(), s_info.ifile, myproc, &s_comm); |
| 48 | } |
| 49 | #endif |
| 50 | |
| 51 | if (s_asyncout) { |
| 52 | s_thread = std::make_unique<BackgroundThread>(); |
| 53 | } |
| 54 | |
| 55 | ExecOnFinalize(Finalize); |
| 56 | } |
| 57 | |
| 58 | void Finalize () |
| 59 | { |
nothing calls this directly
no test coverage detected