Exemplo n.º 1
0
int main(int argc, char **argv)
{
  int ts = 0, var = 0;
  init_mpi(argc, argv);
  parse_args(argc, argv);
  check_args();
  calculate_per_process_offsets();
  create_synthetic_simulation_data();

  rank_0_print("Simulation Data Created\n");

  create_pidx_var_point_and_access();
  for (ts = 0; ts < time_step_count; ts++)
  {
    set_pidx_file(ts);
    for (var = 0; var < variable_count; var++)
      set_pidx_variable(var);
    PIDX_close(file);
  }
  destroy_pidx_var_point_and_access();

  destroy_synthetic_simulation_data();
  shutdown_mpi();

  return 0;
}
Exemplo n.º 2
0
/// main
int main(int argc, char **argv)
{
  init_mpi(argc, argv);
  parse_args(argc, argv);
  check_args();
  calculate_per_process_offsets();
  create_synthetic_simulation_data();

  int var, p;
  PIDX_point global_bounding_box, **local_offset_point, **local_box_count_point;

  local_offset_point = malloc(sizeof(PIDX_point*) * variable_count);
  local_box_count_point = malloc(sizeof(PIDX_point*) * variable_count);

  for(var = 0; var < variable_count; var++)
  {
    local_offset_point[var] = malloc(sizeof(PIDX_point) * patch_count);
    local_box_count_point[var] = malloc(sizeof(PIDX_point) * patch_count);
    for(p = 0 ; p < patch_count ; p++)
    {
      PIDX_set_point_5D(local_offset_point[var][p], (int64_t)var_offset[var][p][0], (int64_t)var_offset[var][p][1], (int64_t)var_offset[var][p][2], 0, 0);
      PIDX_set_point_5D(local_box_count_point[var][p], (int64_t)var_count[var][p][0], (int64_t)var_count[var][p][1], (int64_t)var_count[var][p][2], 1, 1);
    }
  }
  PIDX_file file;            // IDX file descriptor
  PIDX_variable* variable;   // variable descriptor

  variable = malloc(sizeof(*variable) * variable_count);
  memset(variable, 0, sizeof(*variable) * variable_count);

  PIDX_set_point_5D(global_bounding_box, (int64_t)global_box_size[0], (int64_t)global_box_size[1], (int64_t)global_box_size[2], 1, 1);

  PIDX_access access;
  PIDX_create_access(&access);

#if PIDX_HAVE_MPI
  PIDX_set_mpi_access(access, MPI_COMM_WORLD);
#endif

  int ts;
  for (ts = 0; ts < time_step_count; ts++)
  {
    PIDX_file_create(output_file_name, PIDX_MODE_CREATE, access, &file);
    PIDX_set_dims(file, global_bounding_box);
    PIDX_set_current_time_step(file, ts);
    PIDX_set_variable_count(file, variable_count);

    PIDX_debug_rst(file, 1);
    PIDX_debug_hz(file, 1);

    for (var = 0; var < variable_count; var++)
    {
      char variable_name[512];
      sprintf(variable_name, "variable_%d", var);
      PIDX_variable_create(variable_name, sizeof(double) * 8, FLOAT64, &variable[var]);

      for (p = 0 ; p < patch_count ; p++)
        PIDX_variable_write_data_layout(variable[var], local_offset_point[var][p], local_box_count_point[var][p], double_data[var][p], PIDX_row_major);

      PIDX_append_and_write_variable(file, variable[var]/*, local_offset_point[var][p], local_box_count_point[var][p], double_data[var][p], PIDX_row_major*/);
    }

    PIDX_close(file);
  }
  PIDX_close_access(access);

  destroy_synthetic_simulation_data();

  for(var = 0; var < variable_count; var++)
  {
    free(local_offset_point[var]);
    free(local_box_count_point[var]);
  }
  free(local_offset_point);
  free(local_box_count_point);

  free(variable);
  variable = 0;

  shutdown_mpi();

  return 0;
}
Exemplo n.º 3
0
int main(int argc, char **argv)
{
  init_mpi(argc, argv);
  parse_args(argc, argv);
  check_args();
  calculate_per_process_offsets();
  create_synthetic_simulation_data();

  rank_0_print("Simulation Data Created\n");

  int ret;
  int var;
  int ts;
  PIDX_file file;            // IDX file descriptor
  PIDX_variable* variable;   // variable descriptor

  variable = malloc(sizeof(*variable) * variable_count);
  memset(variable, 0, sizeof(*variable) * variable_count);

  PIDX_point global_size, local_offset, local_size;
  PIDX_set_point_5D(global_size, global_box_size[0], global_box_size[1], global_box_size[2], 1, 1);
  PIDX_set_point_5D(local_offset, local_box_offset[0], local_box_offset[1], local_box_offset[2], 0, 0);
  PIDX_set_point_5D(local_size, local_box_size[0], local_box_size[1], local_box_size[2], 1, 1);

  //  Creating access
  PIDX_access access;
  PIDX_create_access(&access);
#if PIDX_HAVE_MPI
  PIDX_set_mpi_access(access, MPI_COMM_WORLD);
#endif

  for (ts = 0; ts < time_step_count; ts++)
  {
    //  PIDX mandatory calls
    ret = PIDX_file_create(output_file_name, PIDX_MODE_CREATE, access, global_size, &file);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_file_create");

    ret = PIDX_set_current_time_step(file, ts);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_current_time_step");
    ret = PIDX_set_variable_count(file, variable_count);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_variable_count");

    ret = PIDX_set_resolution(file, 0, reduced_resolution);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_resolution");

    char var_name[512];
    for (var = 0; var < variable_count; var++)
    {
      sprintf(var_name, "variable_%d", var);

      ret = PIDX_variable_create(var_name, sizeof(unsigned long long) * 8, FLOAT64, &variable[var]);
      if (ret != PIDX_success)  terminate_with_error_msg("PIDX_variable_create");

      ret = PIDX_variable_write_data_layout(variable[var], local_offset, local_size, data[var], PIDX_row_major);
      if (ret != PIDX_success)  terminate_with_error_msg("PIDX_variable_data_layout");

      ret = PIDX_append_and_write_variable(file, variable[var]);
      if (ret != PIDX_success)  terminate_with_error_msg("PIDX_append_and_write_variable");
    }

    ret = PIDX_close(file);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_close");
  }

  ret = PIDX_close_access(access);
  if (ret != PIDX_success)  terminate_with_error_msg("PIDX_close_access");

  free(variable);
  variable = 0;

  destroy_synthetic_simulation_data();
  shutdown_mpi();

  return 0;
}
Exemplo n.º 4
0
int main(int argc, char **argv)
{
  init_mpi(argc, argv);
  parse_args(argc, argv);
  check_args();
  calculate_per_process_offsets();
  create_synthetic_simulation_data();

  rank_0_print("Simulation Data Created\n");

  int ret, var, ts;
  PIDX_file file;            // IDX file descriptor
  PIDX_variable* variable;   // variable descriptor

  variable = (PIDX_variable*)malloc(sizeof(*variable) * variable_count);
  memset(variable, 0, sizeof(*variable) * variable_count);

  PIDX_point global_size, local_offset, local_size;
  PIDX_set_point_5D(global_size, global_box_size[0], global_box_size[1], global_box_size[2], 1, 1);
  PIDX_set_point_5D(local_offset, local_box_offset[0], local_box_offset[1], local_box_offset[2], 0, 0);
  PIDX_set_point_5D(local_size, local_box_size[0], local_box_size[1], local_box_size[2], 1, 1);

  //  Creating access
  PIDX_access access;
  PIDX_create_access(&access);
#if PIDX_HAVE_MPI
  PIDX_set_mpi_access(access, MPI_COMM_WORLD);
#endif

  for (ts = 0; ts < time_step_count; ts++)
  {
    //  PIDX mandatory calls
    ret = PIDX_file_create(output_file_name, PIDX_MODE_CREATE, access, global_size, &file);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_file_create");

    ret = PIDX_set_current_time_step(file, ts);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_current_time_step");
    ret = PIDX_set_variable_count(file, variable_count);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_variable_count");

    PIDX_disable_agg(file);

    PIDX_save_big_endian(file);

    //PIDX_dump_rst_info(file, 1);

    //PIDX_debug_rst(file, 1);
    //PIDX_debug_hz(file, 1);

    PIDX_point reg_patch_size;
    PIDX_set_point_5D(reg_patch_size, 128, 128, 128, 1, 1);
    PIDX_set_restructuring_box(file, reg_patch_size);
    //PIDX_GLOBAL_PARTITION_IDX_IO
    //PIDX_IDX_IO
    ret = PIDX_set_io_mode(file, PIDX_RAW_IO);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_variable_count");

    ret = PIDX_set_partition_size(file, partition_size[0], partition_size[1], partition_size[2]);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_partition_size");

    PIDX_set_block_count(file, 128);

    //ret = PIDX_set_aggregator_multiplier(file, aggregator_multiplier);
    //if (ret != PIDX_success)  terminate_with_error_msg("PIDX_set_partition_size");

    /*
    int io_type = PIDX_IDX_IO;
    switch (io_type)
    {
      case PIDX_GLOBAL_PARTITION_IDX_IO:
        PIDX_set_block_count(file,blocks_per_file);
        PIDX_set_block_size(file, 13);
        break;

      case PIDX_IDX_IO:
        PIDX_set_block_count(file,blocks_per_file);
        break;

      case PIDX_RAW_IO:
        PIDX_raw_io_pipe_length(file, 2);
        PIDX_point reg_patch_size;
        PIDX_set_point_5D(reg_patch_size, 128, 128, 128, 1, 1);
        PIDX_set_restructuring_box(file, reg_patch_size);
        break;
    }
    */

    //ret = PIDX_debug_disable_agg(file);
    //if (ret != PIDX_success)  terminate_with_error_msg("PIDX_debug_output");

    //ret = PIDX_debug_disable_io(file);
    //if (ret != PIDX_success)  terminate_with_error_msg("PIDX_debug_output");

    //ret = PIDX_debug_disable_hz(file);
    //if (ret != PIDX_success)  terminate_with_error_msg("PIDX_debug_output");

    for (var = 0; var < variable_count; var++)
    {
      if (bpv[var] == 32)
      {
        ret = PIDX_variable_create(var_name[var],  bpv[var], FLOAT32 , &variable[var]);
        if (ret != PIDX_success)  terminate_with_error_msg("PIDX_variable_create");
      }
      else if (bpv[var] == 192)
      {
        ret = PIDX_variable_create(var_name[var],  bpv[var], FLOAT64_RGB , &variable[var]);
        if (ret != PIDX_success)  terminate_with_error_msg("PIDX_variable_create");
      }
      else if (bpv[var] == 64)
      {
        ret = PIDX_variable_create(var_name[var],  bpv[var], FLOAT64 , &variable[var]);
        if (ret != PIDX_success)  terminate_with_error_msg("PIDX_variable_create");
      }

      ret = PIDX_variable_write_data_layout(variable[var], local_offset, local_size, data[var], PIDX_row_major);
      if (ret != PIDX_success)  terminate_with_error_msg("PIDX_variable_data_layout");

      ret = PIDX_append_and_write_variable(file, variable[var]);
      if (ret != PIDX_success)  terminate_with_error_msg("PIDX_append_and_write_variable");

      //PIDX_flush(file);
    }

    ret = PIDX_close(file);
    if (ret != PIDX_success)  terminate_with_error_msg("PIDX_close");
  }

  ret = PIDX_close_access(access);
  if (ret != PIDX_success)  terminate_with_error_msg("PIDX_close_access");

  free(variable);
  variable = 0;

  destroy_synthetic_simulation_data();
  shutdown_mpi();

  return 0;
}