示例#1
0
void
do_write(int fd, unsigned name, unsigned code, unsigned seq,
	 off_t pos, off_t len)
{
	off_t done = 0;
	ssize_t ret;
	char *buf;
	const char *namestr;

	namestr = name_get(name);
	buf = data_map(code, seq, len);
	if (lseek(fd, pos, SEEK_SET) == -1) {
		err(1, "%s: lseek to %lld", name_get(name), pos);
	}

	while (done < len) {
		ret = write(fd, buf + done, len - done);
		if (ret == -1) {
			err(1, "%s: write %lld at %lld", name_get(name),
			    len, pos);
		}
		done += ret;
	}

	tprintf("write %s: %lld at %lld\n", namestr, len, pos);
}
示例#2
0
void
do_rename(unsigned from, unsigned to)
{
	const char *fromstr, *tostr;

	fromstr = name_get(from);
	tostr = name_get(to);
	if (rename(fromstr, tostr) == -1) {
		err(1, "rename %s to %s", fromstr, tostr);
	}
	tprintf("rename %s %s\n", fromstr, tostr);
}
示例#3
0
void
do_link(unsigned from, unsigned to)
{
	const char *fromstr, *tostr;

	fromstr = name_get(from);
	tostr = name_get(to);
	if (link(fromstr, tostr) == -1) {
		err(1, "link %s to %s", fromstr, tostr);
	}
	tprintf("link %s %s\n", fromstr, tostr);
}
示例#4
0
void
do_closefile(int fd, unsigned name)
{
	if (close(fd)) {
		warn("%s: close", name_get(name));
	}
}
示例#5
0
void data_file_section::line_print(void)
{
  pprintf("Line %d: Item: %s",name_get());
  if(value_string)
    pprintf("    String: %s",value_string);
  pprintf("    Int: %d",value_int);
  pprintf("    Float: %f",value_float);
}
示例#6
0
void
do_renamexd(unsigned fromdir, unsigned from, unsigned todir, unsigned to)
{
	char frombuf[64];
	char tobuf[64];

	strcpy(frombuf, name_get(fromdir));
	strcat(frombuf, "/");
	strcat(frombuf, name_get(from));

	strcpy(tobuf, name_get(todir));
	strcat(tobuf, "/");
	strcat(tobuf, name_get(to));

	if (rename(frombuf, tobuf) == -1) {
		err(1, "rename %s to %s", frombuf, tobuf);
	}
	tprintf("rename %s %s\n", frombuf, tobuf);
}
示例#7
0
void
do_truncate(int fd, unsigned name, off_t len)
{
	const char *namestr;

	namestr = name_get(name);
	if (ftruncate(fd, len) == -1) {
		err(1, "%s: truncate to %lld", namestr, len);
	}
	tprintf("truncate %s: to %lld\n", namestr, len);
}
示例#8
0
void
do_chdir(unsigned name)
{
	const char *namestr;

	namestr = name_get(name);
	if (chdir(namestr) == -1) {
		err(1, "chdir: %s", namestr);
	}
	tprintf("chdir %s\n", namestr);
}
示例#9
0
void
do_unlink(unsigned name)
{
	const char *namestr;

	namestr = name_get(name);
	if (remove(namestr) == -1) {
		err(1, "%s: remove", namestr);
	}
	tprintf("remove %s\n", namestr);
}
示例#10
0
void
do_rmdir(unsigned name)
{
	const char *namestr;

	namestr = name_get(name);
	if (rmdir(namestr) == -1) {
		err(1, "%s: rmdir", namestr);
	}
	tprintf("rmdir %s\n", namestr);
}
示例#11
0
void
do_mkdir(unsigned name)
{
	const char *namestr;

	namestr = name_get(name);
	if (mkdir(namestr, 0775) == -1) {
		err(1, "%s: mkdir", namestr);
	}
	tprintf("mkdir %s\n", namestr);
}
示例#12
0
int
do_openfile(unsigned name, int dotrunc)
{
	const char *namestr;
	int fd;

	namestr = name_get(name);
	fd = open(namestr, O_WRONLY | (dotrunc ? O_TRUNC : 0), 0664);
	if (fd < 0) {
		err(1, "%s: open", namestr);
	}
	return fd;
}
示例#13
0
int
do_opendir(unsigned name)
{
	const char *namestr;
	int fd;

	namestr = name_get(name);
	fd = open(namestr, O_RDONLY);
	if (fd < 0) {
		err(1, "%s: opendir", namestr);
	}
	return fd;
}
示例#14
0
int
do_createfile(unsigned name)
{
	const char *namestr;
	int fd;

	namestr = name_get(name);
	fd = open(namestr, O_WRONLY|O_CREAT|O_EXCL, 0664);
	if (fd < 0) {
		err(1, "%s: create", namestr);
	}
	tprintf("create %s\n", namestr);
	return fd;
}
示例#15
0
void data_file_section::section_print(int indent)
{
  // Print this section
  pprintf("%*cSection: %s",indent*2,' ',name_get());
  
  // Print child
  DATA_FILE_SECTION *p_tmp = section_child_get();
  if(p_tmp)
    p_tmp->section_print(indent+1);
  
  // Print next section
  p_tmp = section_next();
  if(p_tmp)
    p_tmp->section_print(indent);
}
示例#16
0
文件: node.cpp 项目: Toeplitz/poll
Physics_Rigidbody *Node::physics_rigidbody_create(Scene &scene, bool recursive)
{
  Assets &assets = scene.assets_get();
  Physics_Rigidbody *rigidbody_ptr = nullptr;

  if (!mesh_get()) {
    POLL_ERROR(std::cerr, "Cannot create rigidbody, no mesh for node: " << name_get());
  } else {
    std::unique_ptr<Physics_Rigidbody> rigidbody(new Physics_Rigidbody());
    rigidbody_ptr = rigidbody.get();
    rigidbody_ptr->node_ptr_set(this);
    physics_rigidbody_set(rigidbody_ptr);
    assets.physics_rigidbody_add(std::move(rigidbody));
  }

  return rigidbody_ptr;
}
示例#17
0
void trc_write(struct event *e)
{
  if (e->type != TASK_NAME) {
    trace_common(e->type, e->time, e->task, e->cpu);
  } else {
    const char *name = name_get(e->task, e->cpu);

    if (name) {
      trc_creation(e->task, name, e->cpu, e->time);
    } else {
      fprintf(stderr, "Unknown task %d %d!\n", e->task, e->cpu);
    }
  }
#if 0				//FIXME: handle deadline events!
case TASK_DLINEPOST:
  trace_write_int(e->old_dl);
case TASK_DLINESET:
  trace_write_int(e->new_dl);
#endif
}
示例#18
0
文件: node.cpp 项目: Toeplitz/poll
void Node::link_set(Node *node)
{
  POLL_DEBUG(std::cout, "Setting node: " << name_get() << " to link against: " << node->name_get());
  this->link = node;
}
示例#19
0
int main(int argc, char **argv)
{
  bzero (&arguments, sizeof(struct arguments));
  if (argp_parse (&argp, argc, argv, 0, 0, &arguments) == ARGP_KEY_ERROR){
    fprintf(stderr,
            "[%s] at %s, "
            "error during the parsing of parameters\n",
            PROGRAM, __FUNCTION__);
    return 1;
  }

  if (aky_key_init() == 1){
   fprintf(stderr,
           "[%s] at %s,"
           "error during hash table allocation\n",
           PROGRAM, __FUNCTION__);
    return 1;
  }

  rst_rastro_t rastro;
  bzero (&rastro, sizeof(rst_rastro_t));
  rst_event_t event;
  int i;
  int fail = 0;

  for (i = 0; i < arguments.input_size; i++){
    int ret = rst_open_file(&rastro, 100000,
                            arguments.input[i],
                            arguments.synchronization_file);
    if (ret == -1) {
      fprintf(stderr,
              "[%s] at %s, "
              "trace file %s could not be opened\n",
              PROGRAM, __FUNCTION__, arguments.input[i]);
      return 1;
    }
  }

  name_init();

  if (!arguments.dummy){
    /* start output with comments */
    if (arguments.comment){
      aky_dump_comment (PROGRAM, arguments.comment);
    }
    if (arguments.comment_file){
      if (aky_dump_comment_file (PROGRAM, arguments.comment_file) == 1){
        return 1;
      }
    }

    /* output contents of synchronization file if used */
    if (arguments.synchronization_file){
      if (aky_dump_comment_file (PROGRAM, arguments.synchronization_file) == 1){
        return 1;
      }
    }

    /* output build version, date and conversion for aky in the trace */
    aky_dump_version (PROGRAM, argv, argc);
    poti_header (arguments.basic, 0);
    aky_paje_hierarchy();
  }


  double timestamp = -1;
  while (rst_decode_event(&rastro, &event) && !fail) {
    static int root_created = 0;
    char mpi_process[AKY_DEFAULT_STR_SIZE];
    snprintf(mpi_process, AKY_DEFAULT_STR_SIZE, "rank%"PRIu64"", event.id1);
    timestamp = event.timestamp;
    switch (event.type) {
    case AKY_PTP_SEND:
      if (!arguments.no_links){
        char key[AKY_DEFAULT_STR_SIZE];
        int messageSize = -1;
        int mark = -1;
        if (event.ct.n_uint32 == 2){
          /* has message size */
          messageSize = event.v_uint32[1];
          if (event.ct.n_uint64 == 1){
            /* has message mark */
            mark = event.v_uint64[0];
          }
        }
        aky_put_key(AKY_KEY_PTP, event.id1, event.v_uint32[0], key,
                    AKY_DEFAULT_STR_SIZE);
        if (messageSize != -1 && mark != -1){
          poti_StartLinkSizeMark(timestamp, "root", "LINK",
                                 mpi_process, "PTP", key,
                                 messageSize, mark);
        }else{
          poti_StartLink(timestamp, "root", "LINK", mpi_process, "PTP", key);
        }
      }
      break;
    case AKY_PTP_RECV:
      if (!arguments.no_links){
        char key[AKY_DEFAULT_STR_SIZE];
        char *result = aky_get_key(AKY_KEY_PTP, event.v_uint32[0], event.id1,
            key, AKY_DEFAULT_STR_SIZE);
        if (result == NULL){
          fprintf (stderr,
                   "[aky_converter] at %s, no key to generate a pajeEndLink,\n"
                   "[aky_converter] got a receive at dst = %"PRIu64" from src = %d\n"
                   "[aky_converter] but no send for this receive yet,\n"
                   "[aky_converter] do you synchronize your input traces?\n",
                   __FUNCTION__, event.id1, event.v_uint32[0]);
          if (!arguments.ignore_errors){
            fail = 1;
          }
        }
        poti_EndLink(timestamp, "root", "LINK", mpi_process, "PTP", key);
      }
      break;
    case AKY_1TN_SEND:
      if (!arguments.no_links) {
        char key[AKY_DEFAULT_STR_SIZE];
        int messageSize = -1;
        int mark = -1;
        if (event.ct.n_uint32 == 2){
          messageSize = event.v_uint32[1];
          if (event.ct.n_uint64 == 1)
            mark = event.v_uint64[0];
        }
        u_int32_t rank;
        for (rank = 0; rank < event.v_uint32[0]; rank++) {
        /*                        ^ number of processes in the communicator */
          // TODO register a link to self also?
          if (rank != event.id1) {
            aky_put_key(AKY_KEY_1TN, event.id1, rank, key, AKY_DEFAULT_STR_SIZE);
                /*                   ^ our rank ^ dst */
            if (messageSize != -1 && mark != -1)
              poti_StartLinkSizeMark(timestamp, "root", "LINK", mpi_process,
                  "1TN", key, messageSize, mark);
            else
              poti_StartLink(timestamp, "root", "LINK", mpi_process, "1TN",
                  key);
          }
        }
      }
      break;
    case AKY_1TN_RECV:
      if (!arguments.no_links) {
        char key[AKY_DEFAULT_STR_SIZE];
        char *result = aky_get_key(AKY_KEY_1TN, event.v_uint32[0], event.id1,
            key, AKY_DEFAULT_STR_SIZE);
            /*                                  ^ src              ^ rank */
        if (!result) {
          fprintf (stderr,
                   "[aky_converter] at %s, no key to generate a pajeEndLink,\n"
                   "[aky_converter] got a receive at dst = %"PRIu64" from src = %d\n"
                   "[aky_converter] but no send for this receive yet,\n"
                   "[aky_converter] do you synchronize your input traces?\n",
                   __FUNCTION__, event.id1, event.v_uint32[0]);
          if (!arguments.ignore_errors)
            fail = 1;
        }
        poti_EndLink(timestamp, "root", "LINK", mpi_process, "1TN", key);
      }
      break;
    case MPI_INIT:
      if (root_created == 0){
        poti_CreateContainer (timestamp, "root", "ROOT", "0", "root");
        root_created = 1;
      }
      poti_CreateContainer(timestamp, mpi_process,
                           "PROCESS", "root", mpi_process);
      break;
    case MPI_COMM_SPAWN_IN:
    case MPI_COMM_GET_NAME_IN:
    case MPI_COMM_SET_NAME_IN:
    case MPI_REDUCE_IN:
    case MPI_ALLREDUCE_IN:
    case MPI_REDUCE_SCATTER_IN:
    case MPI_ALLGATHER_IN:
    case MPI_ALLGATHERV_IN:
    case MPI_SCATTER_IN:
    case MPI_SCATTERV_IN:
    case MPI_WAIT_IN:
    case MPI_IRECV_IN:
    case MPI_ISEND_IN:
    case MPI_RECV_IN:
    case MPI_SEND_IN:
    case MPI_BCAST_IN:
    case MPI_BARRIER_IN:
    case MPI_GATHER_IN:
    case MPI_GATHERV_IN:
    case MPI_ALLTOALL_IN:
    case MPI_ALLTOALLV_IN:
    case MPI_OP_CREATE_IN:
    case MPI_OP_FREE_IN:
    case MPI_SCAN_IN:
    case MPI_ATTR_DELETE_IN:
    case MPI_ATTR_GET_IN:
    case MPI_ATTR_PUT_IN:
    case MPI_COMM_COMPARE_IN:
    case MPI_COMM_CREATE_IN:
    case MPI_COMM_DUP_IN:
    case MPI_COMM_FREE_IN:
    case MPI_COMM_GROUP_IN:
    case MPI_COMM_RANK_IN:
    case MPI_COMM_REMOTE_GROUP_IN:
    case MPI_COMM_REMOTE_SIZE_IN:
    case MPI_COMM_SIZE_IN:
    case MPI_COMM_SPLIT_IN:
    case MPI_COMM_TEST_INTER_IN:
    case MPI_GROUP_COMPARE_IN:
    case MPI_GROUP_DIFFERENCE_IN:
    case MPI_GROUP_EXCL_IN:
    case MPI_GROUP_FREE_IN:
    case MPI_GROUP_INCL_IN:
    case MPI_GROUP_INTERSECTION_IN:
    case MPI_GROUP_RANK_IN:
    case MPI_GROUP_RANGE_EXCL_IN:
    case MPI_GROUP_RANGE_INCL_IN:
    case MPI_GROUP_SIZE_IN:
    case MPI_GROUP_TRANSLATE_RANKS_IN:
    case MPI_GROUP_UNION_IN:
    case MPI_INTERCOMM_CREATE_IN:
    case MPI_INTERCOMM_MERGE_IN:
    case MPI_KEYVAL_CREATE_IN:
    case MPI_KEYVAL_FREE_IN:
    case MPI_ABORT_IN:
    case MPI_ERROR_CLASS_IN:
    case MPI_ERRHANDLER_CREATE_IN:
    case MPI_ERRHANDLER_FREE_IN:
    case MPI_ERRHANDLER_GET_IN:
    case MPI_ERROR_STRING_IN:
    case MPI_ERRHANDLER_SET_IN:
    case MPI_GET_PROCESSOR_NAME_IN:
    case MPI_INITIALIZED_IN:
    case MPI_WTICK_IN:
    case MPI_WTIME_IN:
    case MPI_ADDRESS_IN:
    case MPI_BSEND_IN:
    case MPI_BSEND_INIT_IN:
    case MPI_BUFFER_ATTACH_IN:
    case MPI_BUFFER_DETACH_IN:
    case MPI_CANCEL_IN:
    case MPI_REQUEST_FREE_IN:
    case MPI_RECV_INIT_IN:
    case MPI_SEND_INIT_IN:
    case MPI_GET_ELEMENTS_IN:
    case MPI_GET_COUNT_IN:
    case MPI_IBSEND_IN:
    case MPI_IPROBE_IN:
    case MPI_IRSEND_IN:
    case MPI_ISSEND_IN:
    case MPI_PACK_IN:
    case MPI_PACK_SIZE_IN:
    case MPI_PROBE_IN:
    case MPI_RSEND_IN:
    case MPI_RSEND_INIT_IN:
    case MPI_SENDRECV_IN:
    case MPI_SENDRECV_REPLACE_IN:
    case MPI_SSEND_IN:
    case MPI_SSEND_INIT_IN:
    case MPI_START_IN:
    case MPI_STARTALL_IN:
    case MPI_TEST_IN:
    case MPI_TESTALL_IN:
    case MPI_TESTANY_IN:
    case MPI_TEST_CANCELLED_IN:
    case MPI_TESTSOME_IN:
    case MPI_TYPE_COMMIT_IN:
    case MPI_TYPE_CONTIGUOUS_IN:
    case MPI_TYPE_EXTENT_IN:
    case MPI_TYPE_FREE_IN:
    case MPI_TYPE_HINDEXED_IN:
    case MPI_TYPE_HVECTOR_IN:
    case MPI_TYPE_INDEXED_IN:
    case MPI_TYPE_LB_IN:
    case MPI_TYPE_SIZE_IN:
    case MPI_TYPE_STRUCT_IN:
    case MPI_TYPE_UB_IN:
    case MPI_TYPE_VECTOR_IN:
    case MPI_UNPACK_IN:
    case MPI_WAITALL_IN:
    case MPI_WAITANY_IN:
    case MPI_WAITSOME_IN:
    case MPI_CART_COORDS_IN:
    case MPI_CART_CREATE_IN:
    case MPI_CART_GET_IN:
    case MPI_CART_MAP_IN:
    case MPI_CART_SHIFT_IN:
    case MPI_CARTDIM_GET_IN:
    case MPI_DIMS_CREATE_IN:
    case MPI_GRAPH_CREATE_IN:
    case MPI_GRAPH_GET_IN:
    case MPI_GRAPH_MAP_IN:
    case MPI_GRAPH_NEIGHBORS_IN:
    case MPI_GRAPH_NEIGHBORS_COUNT_IN:
    case MPI_GRAPHDIMS_GET_IN:
    case MPI_TOPO_TEST_IN:
    case MPI_RECV_IDLE_IN:
    case MPI_CART_RANK_IN:
    case MPI_CART_SUB_IN:
    case MPI_FINALIZE_IN:
      if (!arguments.no_states){
        char value[AKY_DEFAULT_STR_SIZE];
        snprintf(value, AKY_DEFAULT_STR_SIZE, "%s", name_get(event.type));
        if (event.ct.n_uint64 == 1){
          /* has message mark */
          int mark = event.v_uint64[0];
          poti_PushStateMark(timestamp, mpi_process, "STATE", value, mark);
        }else{
          poti_PushState(timestamp, mpi_process, "STATE", value);
        }
      }
      break;
    case MPI_COMM_SPAWN_OUT:
    case MPI_COMM_GET_NAME_OUT:
    case MPI_COMM_SET_NAME_OUT:
    case MPI_REDUCE_OUT:
    case MPI_ALLREDUCE_OUT:
    case MPI_REDUCE_SCATTER_OUT:
    case MPI_ALLGATHER_OUT:
    case MPI_ALLGATHERV_OUT:
    case MPI_SCATTER_OUT:
    case MPI_SCATTERV_OUT:
    case MPI_WAIT_OUT:
    case MPI_IRECV_OUT:
    case MPI_ISEND_OUT:
    case MPI_RECV_OUT:
    case MPI_SEND_OUT:
    case MPI_BCAST_OUT:
    case MPI_BARRIER_OUT:
    case MPI_GATHER_OUT:
    case MPI_GATHERV_OUT:
    case MPI_ALLTOALL_OUT:
    case MPI_ALLTOALLV_OUT:
    case MPI_OP_CREATE_OUT:
    case MPI_OP_FREE_OUT:
    case MPI_SCAN_OUT:
    case MPI_ATTR_DELETE_OUT:
    case MPI_ATTR_GET_OUT:
    case MPI_ATTR_PUT_OUT:
    case MPI_COMM_COMPARE_OUT:
    case MPI_COMM_CREATE_OUT:
    case MPI_COMM_DUP_OUT:
    case MPI_COMM_FREE_OUT:
    case MPI_COMM_GROUP_OUT:
    case MPI_COMM_RANK_OUT:
    case MPI_COMM_REMOTE_GROUP_OUT:
    case MPI_COMM_REMOTE_SIZE_OUT:
    case MPI_COMM_SIZE_OUT:
    case MPI_COMM_SPLIT_OUT:
    case MPI_COMM_TEST_INTER_OUT:
    case MPI_GROUP_COMPARE_OUT:
    case MPI_GROUP_DIFFERENCE_OUT:
    case MPI_GROUP_EXCL_OUT:
    case MPI_GROUP_FREE_OUT:
    case MPI_GROUP_INCL_OUT:
    case MPI_GROUP_INTERSECTION_OUT:
    case MPI_GROUP_RANK_OUT:
    case MPI_GROUP_RANGE_EXCL_OUT:
    case MPI_GROUP_RANGE_INCL_OUT:
    case MPI_GROUP_SIZE_OUT:
    case MPI_GROUP_TRANSLATE_RANKS_OUT:
    case MPI_GROUP_UNION_OUT:
    case MPI_INTERCOMM_CREATE_OUT:
    case MPI_INTERCOMM_MERGE_OUT:
    case MPI_KEYVAL_CREATE_OUT:
    case MPI_KEYVAL_FREE_OUT:
    case MPI_ABORT_OUT:
    case MPI_ERROR_CLASS_OUT:
    case MPI_ERRHANDLER_CREATE_OUT:
    case MPI_ERRHANDLER_FREE_OUT:
    case MPI_ERRHANDLER_GET_OUT:
    case MPI_ERROR_STRING_OUT:
    case MPI_ERRHANDLER_SET_OUT:
    case MPI_GET_PROCESSOR_NAME_OUT:
    case MPI_INITIALIZED_OUT:
    case MPI_WTICK_OUT:
    case MPI_WTIME_OUT:
    case MPI_ADDRESS_OUT:
    case MPI_BSEND_OUT:
    case MPI_BSEND_INIT_OUT:
    case MPI_BUFFER_ATTACH_OUT:
    case MPI_BUFFER_DETACH_OUT:
    case MPI_CANCEL_OUT:
    case MPI_REQUEST_FREE_OUT:
    case MPI_RECV_INIT_OUT:
    case MPI_SEND_INIT_OUT:
    case MPI_GET_ELEMENTS_OUT:
    case MPI_GET_COUNT_OUT:
    case MPI_IBSEND_OUT:
    case MPI_IPROBE_OUT:
    case MPI_IRSEND_OUT:
    case MPI_ISSEND_OUT:
    case MPI_PACK_OUT:
    case MPI_PACK_SIZE_OUT:
    case MPI_PROBE_OUT:
    case MPI_RSEND_OUT:
    case MPI_RSEND_INIT_OUT:
    case MPI_SENDRECV_OUT:
    case MPI_SENDRECV_REPLACE_OUT:
    case MPI_SSEND_OUT:
    case MPI_SSEND_INIT_OUT:
    case MPI_START_OUT:
    case MPI_STARTALL_OUT:
    case MPI_TEST_OUT:
    case MPI_TESTALL_OUT:
    case MPI_TESTANY_OUT:
    case MPI_TEST_CANCELLED_OUT:
    case MPI_TESTSOME_OUT:
    case MPI_TYPE_COMMIT_OUT:
    case MPI_TYPE_CONTIGUOUS_OUT:
    case MPI_TYPE_EXTENT_OUT:
    case MPI_TYPE_FREE_OUT:
    case MPI_TYPE_HINDEXED_OUT:
    case MPI_TYPE_HVECTOR_OUT:
    case MPI_TYPE_INDEXED_OUT:
    case MPI_TYPE_LB_OUT:
    case MPI_TYPE_SIZE_OUT:
    case MPI_TYPE_STRUCT_OUT:
    case MPI_TYPE_UB_OUT:
    case MPI_TYPE_VECTOR_OUT:
    case MPI_UNPACK_OUT:
    case MPI_WAITALL_OUT:
    case MPI_WAITANY_OUT:
    case MPI_WAITSOME_OUT:
    case MPI_CART_COORDS_OUT:
    case MPI_CART_CREATE_OUT:
    case MPI_CART_GET_OUT:
    case MPI_CART_MAP_OUT:
    case MPI_CART_SHIFT_OUT:
    case MPI_CARTDIM_GET_OUT:
    case MPI_DIMS_CREATE_OUT:
    case MPI_GRAPH_CREATE_OUT:
    case MPI_GRAPH_GET_OUT:
    case MPI_GRAPH_MAP_OUT:
    case MPI_GRAPH_NEIGHBORS_OUT:
    case MPI_GRAPH_NEIGHBORS_COUNT_OUT:
    case MPI_GRAPHDIMS_GET_OUT:
    case MPI_TOPO_TEST_OUT:
    case MPI_RECV_IDLE_OUT:
    case MPI_CART_RANK_OUT:
    case MPI_CART_SUB_OUT:
      if (!arguments.no_states){
        poti_PopState(timestamp, mpi_process, "STATE");
      }
      break;
    case MPI_FINALIZE_OUT:
      if (!arguments.no_states){
        poti_PopState(timestamp, mpi_process, "STATE");
      }
      poti_DestroyContainer(timestamp, "PROCESS", mpi_process);
      break;
    }
  }
  if (timestamp >= 0){
    poti_DestroyContainer(timestamp, "ROOT", "root");
  }

  rst_close (&rastro);
  aky_key_free();
  return 0;
}
示例#20
0
/*
 * Launch this mesh generator
 */
void generator_mesh::run(void)
{
  GENERATOR *p_gen = generator_get();
  
  pprintf("Run generator mesh %s:",name_get());
  
  int i;
  for(i = 0; i < MAX_MODIFICATORS; i++) {
    GENERATOR_MESH_MODIFICATOR_CONFIG *p_conf = config.modificator_get(i);    
    if(!p_conf)
      break;
    
    MODIFICATOR *p_mod = p_gen->modificator_find(p_conf->modificator_name);
    if(!p_mod) {
      generator_loader_error("",0,
                             "Can't find modificator %s",
                             p_conf->modificator_name);
    }
    
    pprintf("  Modificator %s, type %s:",
            p_mod->name_get(), p_mod->modificator_type_name_get());
    
    MODIFICATOR_TARGET_STACK target_stack;
    RECT2DI first_target_size(0); 
    
    int j;
    for(j = 0; j < MAX_MODIFICATOR_TARGETS; j++) {
      GENERATOR_MESH_MODIFICATOR_TARGET_CONFIG *p_tconfig = p_conf->target_config_get(j);
      if(!p_tconfig)
        break;
                
      MODIFICATOR_TARGET *p_target = target_cache.target_get(p_tconfig->target_type,
                                                             p_tconfig->target_name);
      if(j == 0) {
        // Get size of first target
        first_target_size = p_target->target_area_get();
        assert(first_target_size.dx > 0 && first_target_size.dy > 0);
      } else {
        // Set scale to all targets along the first one
        p_target->target_scale_set(first_target_size.size_get());
      }
      
      // Set target mask, if it's active
      if(p_tconfig->mask.mask_active() ||
         p_tconfig->mask.mask_create_active())
      {
        p_target->mask_set(&p_tconfig->mask);
      }
      
      // Add found target to target stack, it's going to be used
      // as a target for this modificator run
      target_stack.push(p_target);
      
      pprintf("    target %s, target name '%s'",
              modificator_target_translate(p_tconfig->target_type),
              p_tconfig->target_name);
    }
    
    // Check if we have any target available. Get a target which was 
    // put to target stack as the firts one
    MODIFICATOR_TARGET *p_target = target_stack.get_first();
    if(!p_target) {
      perror("    Missing target! You have to define at least one.");
    }
    
    // Launch the circus
    MODIFICATOR_PARAMS p;
    RECT2DI pos = p_target->target_area_get();
    p_mod->coordinates_top_set(pos);
    p_mod->init(&target_stack, pos, &p);
    p_mod->apply(&target_stack, &p);
          
    // Reset scale on all targets
    int t, target_num;
    MODIFICATOR_TARGET **p_targets = target_stack.get_all(target_num);
    for(t = 0; t < target_num; t++) {
      p_targets[t]->target_scale_clear();
    }
  }  
}