Example #1
0
int handleLeave( void* firsthandlerarg, uint64_t time, uint32_t statetoken,
		uint32_t cpuid, uint32_t scltoken ) {
        

    uint32_t savedstatetoken;


	nodeT *node = treehash_searchnode(((fcbT*) firsthandlerarg)->p_hashtab,
		cpuid);

	if ( 0 == node ) {

		fprintf( stderr, "otf2vtf WARNING: undefined process %u, record ignored\n",
			cpuid );
			
		return OTF_RETURN_OK;
	}
    
    savedstatetoken = node->stack[node->stackc-1];

    assert(node->stackc);
    --node->stackc;

    if( statetoken == 0 ) {
        statetoken = savedstatetoken;
    }

	FileIOEndQueue_check( &(((fcbT*) firsthandlerarg)->FileIOQueue), time, firsthandlerarg );
	

	return ( 0 == VTF3_WriteUpfrom( ((fcbT*) firsthandlerarg)->fcb, time, statetoken,
		node->processi, scltoken ) )
		? OTF_RETURN_ABORT : OTF_RETURN_OK;
}
Example #2
0
void elg_readcb_EXIT_TRACING(elg_ui4 lid, elg_d8 time,
       elg_ui1 metc, elg_ui8 metv[], void* userdata) {
  lid = locmap[lid];
  wbytes += VTF3_WriteUpfrom(fcb, time*1.0e+10, state_tracing,
                             (unsigned int) lid, VTF3_SCLNONE);
  genWriteCOUNTER(lid, time, metc, metv);
}
Example #3
0
void elg_readcb_OMP_COLLEXIT(elg_ui4 lid, elg_d8 time,
       elg_ui1 metc, elg_ui8 metv[], void* userdata) {
  StackNode *n;

  lid = locmap[lid];
  n = stk_pop(lid);

  if ( genompglop && is_glop(n->reg) ) {
    elg_d8 stime = (n->tim)*1.0e+10+1.0;
    elg_d8 etime = time*1.0e+10-1.0;
    if ( etime <= stime ) {
      stime = (n->tim)*1.0e+10;
      etime = time*1.0e+10;
    }
    wbytes += VTF3_WriteGlobalop(fcb, stime, n->reg,
                       (unsigned int) lid,
                       /*com*/ maxcomm + 1 + loctab[lid].proc->id,
                       /*root*/ -1, /*sent*/ 0, /*recvd*/ 0,
                       etime-stime, VTF3_SCLNONE);
  }
  if ( writeOMP ) {
    wbytes += VTF3_WriteOpenmpleave(fcb, time*1.0e+10, (unsigned int) lid,
                     scl_of_state(n->reg));
  } else {
    wbytes += VTF3_WriteUpfrom(fcb, time*1.0e+10, n->reg, (unsigned int) lid,
                     VTF3_SCLNONE);
  }
  genWriteCOUNTER(lid, time, metc, metv);
}
Example #4
0
void elg_readcb_OMP_JOIN(elg_ui4 lid, elg_d8 time, void* userdata) {
  lid = locmap[lid];
  if ( !writeOMP ) {
    wbytes += VTF3_WriteUpfrom(fcb, time*1.0e+10, state_pregion,
                               (unsigned int) lid, VTF3_SCLNONE);
  }
  lasttime = time;
}
Example #5
0
void elg_readcb_MPI_WINEXIT(elg_ui4 lid, elg_d8 time,
       elg_ui1 metc, elg_ui8 metv[], elg_ui4 wid, elg_ui4 cid, elg_ui1 synex,
       void* userdata) {
  StackNode *n;

  lid = locmap[lid];
  n = stk_pop(lid);
  wbytes += VTF3_WriteUpfrom(fcb, time*1.0e+10, (int) n->reg,
                             (unsigned int) lid, VTF3_SCLNONE);
  genWriteCOUNTER(lid, time, metc, metv);
}
Example #6
0
void elg_readcb_EXIT(elg_ui4 lid, elg_d8 time, elg_ui1 metc, elg_ui8 metv[],
       void* userdata) {
  StackNode *n;

  lid = locmap[lid];
  n = stk_pop(lid);
  if ( writeOMP && statetab[n->reg].act == act_omp
                && statetab[n->reg].type != ELG_FUNCTION ) {
    wbytes += VTF3_WriteOpenmpleave(fcb, time*1.0e+10,
                               (unsigned int) lid, scl_of_state(n->reg));
  } else {
    wbytes += VTF3_WriteUpfrom(fcb, time*1.0e+10, (int) n->reg,
                               (unsigned int) lid, VTF3_SCLNONE);
  }
  genWriteCOUNTER(lid, time, metc, metv);
}
Example #7
0
static void genWriteCOLLLEAVE(int w, elg_ui4 lid, elg_d8 time,
       elg_ui4 rlid, elg_ui4 cid, elg_ui4 sent, elg_ui4 recvd) {
  StackNode *n = stk_pop(lid);

  if ( rlid != ELG_NO_ID ) rlid = locmap[rlid];
  if ( w ) {
    elg_d8 stime = (n->tim)*1.0e+10+1.0;
    elg_d8 etime = time*1.0e+10-1.0;
    if ( etime <= stime ) {
      stime = (n->tim)*1.0e+10;
      etime = time*1.0e+10;
    }
    wbytes += VTF3_WriteGlobalop(fcb, stime, n->reg,
                                 (unsigned int) lid, (int) cid,
                                 (unsigned int) rlid, (int) sent, (int) recvd,
                                 etime-stime, VTF3_SCLNONE);
  }
  wbytes += VTF3_WriteUpfrom(fcb, time*1.0e+10, n->reg, (unsigned int) lid,
                             VTF3_SCLNONE);
}
Example #8
0
int main(int argc, char **argv) {
  char*   infile;
  char*   outfile;
  char*   dot;
  int     ch;
  int     fmt = VTF3_FILEFORMAT_STD_ASCII;
  int     eflag = 0;
  struct stat statbuf;
  elg_ui4 numrec = 0;
  elg_ui4 limrec = 0xFFFFFFFF;
  elg_ui4 limsiz = 0xFFFFFFFF;
  ElgRCB* handle = NULL;
  MYDATA  md = { 0, 0, 0, 0 };

  while ((ch = getopt(argc, argv, "abfghin:r:s:GO")) != EOF) {
    switch (ch) {
    case 'a': fmt = VTF3_FILEFORMAT_STD_ASCII;
              break;
    case 'b': fmt = VTF3_FILEFORMAT_STD_BINARY;
              break;
    case 'f': fmt = VTF3_FILEFORMAT_FST_ASCII;
              break;
    case 'g': genompglop = 0;
              break;
    case 'G': genmpiglop = 0;
              genompglop = 0;
              break;
    case 'i': addidle = 0;
              break;
    case 'n': limrec = atol(optarg);
              break;
    case 'O':
#ifdef VTF3_HAS_OPENMP
	      writeOMP = 1;
              genompglop = 0;
#endif
	      break;
    case 's': limsiz = atol(optarg);
              break;
    case 'r': rmatag = atol(optarg);
              break;
    case 'h':
    case '?': eflag = 1;
              break;
    }
  }

  if ((argc-optind) == 2) {
    infile  = epk_get_elgfilename(argv[optind]);
    outfile = argv[optind+1];
  } else  if ((argc-optind) == 1) {
    infile  = epk_get_elgfilename(argv[optind]);
    outfile = strdup(infile);
    dot = strrchr(outfile, '.');
    *(dot + 1) = 'v';
    *(dot + 2) = 'p';
    *(dot + 3) = 't';
  } else {
    eflag = 1;
  }

  if ( eflag ) {
    fprintf(stderr, "Usage:   %s [-a|-b|-f] [-i] [-g|-G] [-O] [-n #] [-s #]"
                    " [-r #]"
                    " (<infile>.elg | <experiment_archive>) [<outfile>]\n",
                    argv[0]);
    fprintf(stderr, "Options: -a force standard ascii output\n");
    fprintf(stderr, "         -b force binary output\n");
    fprintf(stderr, "         -f force fast ascii output\n");
    fprintf(stderr, "         -g do not generate globalops for OMP barriers\n");
    fprintf(stderr, "         -G do not generate globalops (for MPI + OMP)\n");
    fprintf(stderr, "         -i do not add idle state\n");
    fprintf(stderr, "         -O generate VTF3 OpenMP events\n");
    fprintf(stderr, "         -n stop converting after # records\n");
    fprintf(stderr, "         -s stop converting after # bytes written\n");
    fprintf(stderr, "         -r use # as tag for RMA operations\n");
    fprintf(stderr, "If <outfile> is omitted, <infile>.vpt is used for output\n");
    fflush(stderr);
    exit(EXIT_FAILURE);
  }

  handle = elg_read_open(infile);
  if ( ! handle ) exit(EXIT_FAILURE);
  stat(infile, &statbuf);

  conv_init();
  VTF3_InitTables();
  if ( (fcb = VTF3_OpenFileOutput(outfile, fmt, genmpiglop)) == 0 ) {
    fprintf(stderr, "Can't open output file %s\n", outfile);
    fflush(stderr);
    exit(EXIT_FAILURE);
  }

  wbytes += VTF3_WriteDefversion(fcb, VTF3_GetVersionNumber());
  wbytes += VTF3_WriteDefcreator(fcb, "epilog -> vtf3 converter 1.3");

  while ( elg_read_next(handle, (void*) &md) ) {
    numrec++;

    if ( numrec % 1000 == 0 ) {
      printf("done: %3.0f%%\r", ((double) md.done / statbuf.st_size) * 100.0);
      fflush(stdout);
    }

    if ( numrec > limrec ) {
      printf("Limit of %u records reached.\n", limrec);
      break;
    }
    if ( wbytes > limsiz ) {
      printf("Limit of %ld bytes reached.\n", (long)wbytes);
      break;
    }
  }

  {
  int lid;
  if ( state_idle != -1 && addidle ) {
    for(lid=0; lid<totallocs; lid++) {
      if ( loctab[lid].proc->member[0].id != lid ) {
        wbytes += VTF3_WriteUpfrom(fcb, lasttime*1.0e+10, (int) state_idle,
                                   locmap[lid], VTF3_SCLNONE);
      }
    }
  }
  }

  elg_read_close(handle);
  VTF3_Close(fcb);
  return 0;
}