-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
}
/* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
int PMPI_Init(int *argc, char ***argv)
{
if(already_init == 0){
simgrid::smpi::Process::init(argc, argv);
smpi_process()->mark_as_initialized();
- int rank = smpi_process()->index();
+ int rank = simgrid::s4u::this_actor::getPid();
TRACE_smpi_init(rank);
- TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("init"));
+ TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("init"));
TRACE_smpi_comm_out(rank);
TRACE_smpi_computing_init(rank);
smpi_bench_begin();
int PMPI_Finalize()
{
smpi_bench_end();
- int rank = smpi_process()->index();
- TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("finalize"));
+ int rank = simgrid::s4u::this_actor::getPid();
+ TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("finalize"));
smpi_process()->finalize();
int PMPI_Is_thread_main(int *flag)
{
+ // FIXME: The MPI standard seems to say that fatal errors need to be triggered
+ // if MPI has been finalized or not yet been initialized
if (flag == nullptr) {
return MPI_ERR_ARG;
} else {
- *flag = smpi_process()->index() == 0;
+ *flag = simgrid::s4u::this_actor::getPid() ==
+ 1; // FIXME: I don't think this is correct: This just returns true if the process ID is 1,
+ // regardless of whether this process called MPI_Thread_Init() or not.
return MPI_SUCCESS;
}
}
int PMPI_Keyval_free(int* keyval) {
return simgrid::smpi::Keyval::keyval_free<simgrid::smpi::Comm>(keyval);
}
-
-} // extern "C"