00001
00002 #include "ampi_funcptr_loader.h"
00003
00004 #include <string>
00005 #include <atomic>
00006
00007 static std::atomic<size_t> rank_count{};
00008
00009 int main(int argc, char ** argv)
00010 {
00011 SharedObject myexe;
00012
00013
00014 {
00015 static const char FUNCPTR_SHIM_SUFFIX[] = ".user";
00016
00017 std::string binary_path{ampi_binary_path};
00018 binary_path += FUNCPTR_SHIM_SUFFIX;
00019
00020 const Lmid_t lmid = rank_count++ == 0 ? LM_ID_BASE : LM_ID_NEWLM;
00021 myexe = dlmopen(lmid, binary_path.c_str(), RTLD_NOW|RTLD_LOCAL);
00022 }
00023
00024 if (myexe == nullptr)
00025 {
00026 CkError("dlmopen error: %s\n", dlerror());
00027 CkAbort("Could not open pipglobals user program!");
00028 }
00029
00030 return AMPI_FuncPtr_Loader(myexe, argc, argv);
00031 }