add a wrapper that will set the value at each call to get the one from the correct process
This will probably not work for BSD implementations (they have optreset as well that might be needed).
XBT_PUBLIC void smpi_register_static(void* arg, void_f_pvoid_t free_fn);
XBT_PUBLIC void smpi_free_static();
+
+struct option;
+XBT_PUBLIC int smpi_getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index);
+XBT_PUBLIC int smpi_getopt (int argc, char *const *argv, const char *options);
#define SMPI_VARINIT_GLOBAL(name,type) \
type *name = NULL; \
static void __attribute__((constructor)) __preinit_##name(void) { \
size_t offset, size_t buff_size);
std::vector<std::pair<size_t, size_t>> merge_private_blocks(std::vector<std::pair<size_t, size_t>> src,
std::vector<std::pair<size_t, size_t>> dst);
+
+
#endif
#endif
--- /dev/null
+#include <sys/time.h> /* Load it before the define next line to not mess with the system headers */
+
+#define sleep(x) smpi_sleep(x)
+#define usleep(x) smpi_usleep(x)
+#define gettimeofday(x, y) smpi_gettimeofday(x, NULL)
+#if _POSIX_TIMERS > 0
+#define nanosleep(x, y) smpi_nanosleep(x, y)
+#define clock_gettime(x, y) smpi_clock_gettime(x, y)
+#endif
+#if SIMGRID_HAVE_MC
+#undef assert
+#define assert(x) MC_assert(x)
+#endif
+
+#define getopt(x,y,z) smpi_getopt(x,y,z)
+#define getopt_long(x,y,z,a,b) smpi_getopt_long(x,y,z,a,b)
smpi_trace_call_location_t trace_call_loc_;
simgrid::s4u::ActorPtr process_ = nullptr;
smpi_privatization_region_t privatized_region_;
+ int optind=0; /*for getopt replacement */
#if HAVE_PAPI
/** Contains hardware data as read by PAPI **/
int papi_event_set_;
msg_bar_t finalization_barrier();
static void init(int *argc, char ***argv);
simgrid::s4u::ActorPtr process();
+ int get_optind();
+ void set_optind(int optind);
};
#include "src/mc/mc_replay.hpp"
#include "src/simix/ActorImpl.hpp"
#include "xbt/config.hpp"
+#include "getopt.h"
#include <unordered_map>
{
samples.clear();
}
+
+int smpi_getopt_long (int argc, char *const *argv, const char *options,
+ const struct option * long_options, int *opt_index)
+{
+ optind = smpi_process()->get_optind();
+ int ret = getopt_long (argc, argv, options, long_options, opt_index);
+ smpi_process()->set_optind(optind);
+ return ret;
+}
+
+int smpi_getopt (int argc, char *const *argv, const char *options)
+{
+ optind = smpi_process()->get_optind();
+ int ret = getopt (argc, argv, options);
+ smpi_process()->set_optind(optind);
+ return ret;
+}
"Please use MPI_Init(&argc, &argv) as usual instead.");
}
+int Process::get_optind(){
+ return optind;
+}
+void Process::set_optind(int new_optind){
+ optind=new_optind;
+}
+
}
}
list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
list_add LINKARGS "@libdir@\libsimgrid.dll"
elif [ "x@APPLE@" = "x1" ]; then
+ list_add CFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
list_add CFLAGS "-fpic"
if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
list_add LINKARGS "-shared"
fi
list_add LINKARGS "-lsimgrid" "-Wl,-undefined,error"
else
+ list_add CFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
list_add CFLAGS "-fpic"
if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
list_add LINKARGS "-shared"
include/smpi/mpi.h
include/smpi/smpi.h
include/smpi/smpi_main.h
+ include/smpi/smpi_helpers.h
include/smpi/smpi_extended_traces.h
include/smpi/smpi_extended_traces_fortran.h
include/smpi/forward.hpp