$treeview $search $mathjax $extrastylesheet
artdaq_mpich_plugin
v1_00_06
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #define MPI_MODE 1 00002 00003 #define TRAVE_NAME "TransferDriverMPI" 00004 #include "artdaq/DAQdata/Globals.hh" 00005 #include "artdaq/DAQrate/TransferTest.hh" 00006 #include "fhiclcpp/make_ParameterSet.h" 00007 #include <mpi.h> 00008 #include <cstdlib> 00009 00010 #include <sys/types.h> 00011 #include <unistd.h> 00012 00013 int main(int argc, char* argv[]) 00014 { 00015 artdaq::configureMessageFacility("transfer_driver_mpi"); 00016 TLOG(TLVL_TRACE) << "BEGIN" ; 00017 char envvar[] = "MV2_ENABLE_AFFINITY=0"; 00018 if (putenv(envvar) != 0) 00019 { 00020 std::cerr << "Unable to set MV2_ENABLE_AFFINITY environment variable!"; 00021 return 1; 00022 } 00023 auto const requested_threading = MPI_THREAD_SERIALIZED; 00024 int provided_threading = -1; 00025 auto rc = MPI_Init_thread(&argc, &argv, requested_threading, &provided_threading); 00026 assert(rc == 0); 00027 assert(requested_threading == provided_threading); 00028 TLOG(TLVL_TRACE) << "MPI_Init_thread rc=" << rc ; 00029 rc = MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); 00030 assert(rc == 0); 00031 TLOG(TLVL_TRACE)<< "MPI_Comm_rank rc=" << rc ; 00032 00033 00034 if (my_rank == 0) 00035 { 00036 std::cout << "argc:" << argc << std::endl; 00037 for (int i = 0; i < argc; ++i) 00038 { 00039 std::cout << "argv[" << i << "]: " << argv[i] << std::endl; 00040 } 00041 } 00042 00043 if (argc != 2) 00044 { 00045 std::cerr << argv[0] << " requires 1 argument, " << argc - 1 << " provided\n"; 00046 return 1; 00047 } 00048 00049 cet::filepath_lookup lookup_policy("FHICL_FILE_PATH"); 00050 fhicl::ParameterSet ps; 00051 00052 auto fhicl = std::string(argv[1]); 00053 make_ParameterSet(fhicl, lookup_policy, ps); 00054 00055 artdaq::TransferTest theTest(ps); 00056 00057 //std::cout << "Entering infinite loop to connect debugger. PID=" << std::to_string(getpid()) << std::endl; 00058 //volatile bool loopForever = true; 00059 //while (loopForever) { 00060 // usleep(1000); 00061 //} 00062 00063 theTest.runTest(); 00064 00065 rc = MPI_Finalize(); 00066 assert(rc == 0); 00067 TLOG(TLVL_TRACE) << "END" ; 00068 return 0; 00069 }