示例#1
0
文件: Comm.cpp 项目: Peita/coolfluid3
void Comm::init(int argc, char** args)
{
  if ( is_finalized() )
    throw SetupError( FromHere(), "Should not call Comm::initialize() after Comm::finalize()" );

  if( !is_initialized() && !is_finalized() ) // then initialize
  {
    MPI_CHECK_RESULT(MPI_Init,(&argc,&args));
    //  CFinfo << "MPI (version " <<  version() << ") -- initiated" << CFendl;
  }

  m_comm = MPI_COMM_WORLD;
}
示例#2
0
文件: Comm.cpp 项目: Peita/coolfluid3
void Comm::finalize()
{
  if( is_initialized() && !is_finalized() ) // then finalized
  {
    MPI_CHECK_RESULT(MPI_Finalize,());
    //  CFinfo << "MPI (version " <<  version() << ") -- finalized" << CFendl;
  }
示例#3
0
static void
verify_checksum (int argc, char *argv[])
{
  void *addr = NULL;
  char *bp, *ep;
  logChecksum *master, *checksums;
  unsigned short mcsum;
  int num_pages;


  if (argc != 1)
    {
      printf ("-ERR usage: vc <file>\n");
      return;
    }
  addr = get_addr (argv[0]);
  if (addr == NULL)
    {
      return;
    }

  /* set up pointers */
  bp = (char *) addr;
  ep = bp + SMR_LOG_FILE_DATA_SIZE;
  master = (logChecksum *) ep;
  checksums = master + 1;

  if (is_finalized (master))
    {
      num_pages = SMR_LOG_NUM_CHECKSUM - 1;
    }
  else
    {
      num_pages = master->off;
    }
  printf ("num_pages:%d\n", num_pages);

  mcsum = crc16 ((char *) checksums, sizeof (logChecksum) * num_pages, 0);
  if (mcsum != master->checksum)
    {
      printf ("master checksum error. expected:0x%4x master:0x%4x\n", mcsum,
	      master->checksum);
    }
  else
    {
      printf ("+OK checksum verified. 0x%4x\n", mcsum);
    }

  if (addr)
    {
      release_addr (addr);
    }
}