artdaq  v2_02_03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
transfer_driver_mpi.cc
1 #define MPI_MODE 1
2 
3 #include "artdaq/DAQdata/Globals.hh"
4 #include "test/DAQrate/TransferTest.hh"
5 #include <fhiclcpp/make_ParameterSet.h>
6 #include <mpi.h>
7 #include <cstdlib>
8 
9 #include <sys/types.h>
10 #include <unistd.h>
11 
12 int main(int argc, char* argv[])
13 {
14  artdaq::configureMessageFacility("transfer_driver_mpi");
15  TRACE(TLVL_TRACE, "s_r_handles main enter" );
16  char envvar[] = "MV2_ENABLE_AFFINITY=0";
17  assert(putenv(envvar) == 0);
18  auto const requested_threading = MPI_THREAD_SERIALIZED;
19  int provided_threading = -1;
20  auto rc = MPI_Init_thread(&argc, &argv, requested_threading, &provided_threading);
21  assert(rc == 0);
22  assert(requested_threading == provided_threading);
23  rc = MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
24 
25  assert(rc == 0);
26 
27  if (my_rank == 0)
28  {
29  std::cout << "argc:" << argc << std::endl;
30  for (int i = 0; i < argc; ++i)
31  {
32  std::cout << "argv[" << i << "]: " << argv[i] << std::endl;
33  }
34  }
35 
36  if (argc != 2)
37  {
38  std::cerr << argv[0] << " requires 1 argument, " << argc - 1 << " provided\n";
39  return 1;
40  }
41 
42  cet::filepath_lookup lookup_policy("FHICL_FILE_PATH");
43  fhicl::ParameterSet ps;
44 
45  auto fhicl = std::string(argv[1]);
46  make_ParameterSet(fhicl, lookup_policy, ps);
47 
48  artdaq::TransferTest theTest(ps);
49 
50  //std::cout << "Entering infinite loop to connect debugger. PID=" << std::to_string(getpid()) << std::endl;
51  // volatile bool loopForever = true;
52  // while (loopForever) {
53  // usleep(1000);
54  // }
55 
56  theTest.runTest();
57 
58  rc = MPI_Finalize();
59  assert(rc == 0);
60  TRACE(TLVL_TRACE, "s_r_handles main return" );
61  return 0;
62 }
void configureMessageFacility(char const *progname, bool useConsole=true)
Configure and start the message facility. Provide the program name so that messages will be appropria...
Test a set of TransferInterface plugins.
Definition: TransferTest.hh:17