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; }
void error(int done, const char* msg, ...) { va_list ap; fflush(stderr); fprintf(stderr, "[ERROR] "); va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); fflush(stderr); if (done == 1) { #if defined(MPI) /* go wake up other threads */ calc_forces(NULL, NULL, 1); shutdown_mpi(); #endif // MPI free_allocated_memory(); exit(EXIT_SUCCESS); } }
/// 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; }
int main(int argc, char** argv) { initialize_global_variables(); int ret = init_mpi(&argc, &argv); if (ret != POTFIT_SUCCESS) { shutdown_mpi(); return EXIT_FAILURE; } read_input_files(argc, argv); g_mpi.init_done = 1; ret = broadcast_params_mpi(); switch (ret) { case POTFIT_ERROR_MPI_CLEAN_EXIT: shutdown_mpi(); return EXIT_SUCCESS; case POTFIT_ERROR: shutdown_mpi(); return EXIT_FAILURE; } g_calc.ndim = g_pot.opt_pot.idxlen; g_calc.ndimtot = g_pot.opt_pot.len; // main force vector, all forces, energies, stresses, etc. will be stored here g_calc.force = (double*)Malloc(g_calc.mdim * sizeof(double)); // starting positions for the force vector set_force_vector_pointers(); #if defined(APOT) #if defined(MPI) MPI_Bcast(g_pot.opt_pot.table, g_calc.ndimtot, MPI_DOUBLE, 0, MPI_COMM_WORLD); #endif // MPI update_calc_table(g_pot.opt_pot.table, g_pot.calc_pot.table, 1); #endif // APOT if (g_mpi.myid > 0) { start_mpi_worker(g_calc.force); } else { #if defined(MPI) if (g_mpi.num_cpus > g_config.nconf) { warning("You are using more CPUs than you have configurations!\n"); warning("While this will not do any harm, you are wasting %d CPUs.\n", g_mpi.num_cpus - g_config.nconf); } #endif // MPI time_t start_time; time_t end_time; time(&start_time); if (g_param.opt && g_calc.ndim > 0) { run_optimization(); } else if (g_calc.ndim == 0) { printf( "\nOptimization disabled due to 0 free parameters. Calculating " "errors.\n"); } else { printf("\nOptimization disabled. Calculating errors.\n\n"); } time(&end_time); #if defined(APOT) double tot = calc_forces(g_pot.opt_pot.table, g_calc.force, 0); #else double tot = calc_forces(g_pot.calc_pot.table, g_calc.force, 0); #endif // APOT #if defined(UQ) return uncertainty_quantification(tot,g_files.sloppyfile); #endif //UQ write_pot_table_potfit(g_files.endpot); return 0; { int format = -1; switch (g_pot.format_type) { case POTENTIAL_FORMAT_UNKNOWN: error(1, "Unknown potential format detected! (%s:%d)\n", __FILE__, __LINE__); case POTENTIAL_FORMAT_ANALYTIC: format = 0; break; case POTENTIAL_FORMAT_TABULATED_EQ_DIST: format = 3; break; case POTENTIAL_FORMAT_TABULATED_NON_EQ_DIST: format = 4; break; } printf("\nPotential in format %d written to file \t%s\n", format, g_files.endpot); } if (g_param.writeimd == 1) write_pot_table_imd(g_files.imdpot); if (g_param.plot == 1) write_plotpot_pair(&g_pot.calc_pot, g_files.plotfile); if (g_param.write_lammps == 1) write_pot_table_lammps(); // will not work with MPI #if defined(PDIST) && !defined(MPI) write_pairdist(&g_pot.opt_pot, g_files.distfile); #endif // PDIST && !MPI // write the error files for forces, energies, stresses, ... write_errors(g_calc.force, tot); /* calculate total runtime */ if (g_param.opt && g_mpi.myid == 0 && g_calc.ndim > 0) { printf("\nRuntime: %d hours, %d minutes and %d seconds.\n", (int)difftime(end_time, start_time) / 3600, ((int)difftime(end_time, start_time) % 3600) / 60, (int)difftime(end_time, start_time) % 60); printf("%d force calculations, each took %f seconds\n", g_calc.fcalls, (double)difftime(end_time, start_time) / g_calc.fcalls); } #if defined(MPI) calc_forces(NULL, NULL, 1); /* go wake up other threads */ #endif // MPI } /* myid == 0 */ // do some cleanups before exiting #if defined(MPI) // kill MPI shutdown_mpi(); #endif // MPI free_allocated_memory(); return 0; }
//---------------------------------------------------------------- int main(int argc, char **argv) { init_mpi(argc, argv); printf("start %d %d\n",rank,process_count); int i; if(rank==0) { parse_args(argc, argv); // var_count = read_list_in_file(var_file, &netcdf_var_names); // rank_0_print("Number of variables = %d\n", var_count); // time_step_count = read_list_in_file(netcdf_file_list, &netcdf_file_names); // rank_0_print("Number of timesteps = %d\n", time_step_count); check_args(); } // The command line arguments are shared by all processes #if PIDX_HAVE_MPI MPI_Bcast(global_box_size, 3, MPI_LONG_LONG, 0, MPI_COMM_WORLD); MPI_Bcast(local_box_size, 3, MPI_LONG_LONG, 0, MPI_COMM_WORLD); // MPI_Bcast(&time_step_count, 1, MPI_INT, 0, MPI_COMM_WORLD); MPI_Bcast(&var_file, 512, MPI_CHAR, 0, MPI_COMM_WORLD); MPI_Bcast(&netcdf_file_list, 512, MPI_CHAR, 0, MPI_COMM_WORLD); // MPI_Bcast(&var_count, 1, MPI_INT, 0, MPI_COMM_WORLD); MPI_Bcast(&output_file_name, 512, MPI_CHAR, 0, MPI_COMM_WORLD); #endif //TODO: Only the rank 0 should read the input files and broadcast the data var_count = read_list_in_file(var_file, &netcdf_var_names); rank_0_print("Number of variables = %d\n", var_count); time_step_count = read_list_in_file(netcdf_file_list, &netcdf_file_names); rank_0_print("Number of timesteps = %d\n", time_step_count); calculate_per_process_offsets(); create_pidx_var_names(); PIDX_access pidx_access; create_pidx_access(&pidx_access); PIDX_time_step_caching_ON(); determine_var_types(); create_pidx_vars(); int t = 0,plist_id; for (t = 0; t < time_step_count; ++t) { rank_0_print("Processing time step %d (file %s)\n", t, netcdf_file_names[t]); PIDX_file pidx_file; int ret = PIDX_file_create(output_file_name, PIDX_MODE_CREATE, pidx_access, &pidx_file); if (ret != PIDX_success) terminate_with_error_msg("ERROR: Failed to create PIDX file\n"); set_pidx_params(pidx_file); PIDX_set_current_time_step(pidx_file, t); int file_id = ncmpi_open(MPI_COMM_WORLD,netcdf_file_names[t], NC_NOWRITE, MPI_INFO_NULL, &plist_id); if (file_id !=0) terminate_with_error_msg("ERROR: Failed to open file %s\n", netcdf_file_names[t]); int v = 0; for(v = 0; v < var_count; ++v) { rank_0_print("Processing variable %s\n", netcdf_var_names[v]); var_data = malloc(var_types[v].atomic_type * var_types[v].num_values * local_box_size[0] * local_box_size[1] * local_box_size[2]); read_var_from_netcdf(plist_id, netcdf_var_names[v], var_types[v]); write_var_to_idx(pidx_file, pidx_var_names[v], pidx_vars[v]); if (PIDX_flush(pidx_file) != PIDX_success) terminate_with_error_msg("ERROR: Failed to flush variable %s, time step %d\n", pidx_var_names[v], t); free(var_data); } ncmpi_close(plist_id); PIDX_close(pidx_file); } PIDX_time_step_caching_OFF(); PIDX_close_access(pidx_access); free_memory(); shutdown_mpi(); return 0; }
int main(int argc, char **argv) { double start_time, end_time; start_time = get_time(); int ret = 0; init_mpi(argc, argv); parse_args(argc, argv); rank_0_print("Merge Program\n"); #if 0 comm = MPI_COMM_WORLD; #endif ret = IDX_file_open(output_file_name); if (ret != 0) terminate_with_error_msg("PIDX_file_create"); maxh = strlen(bitSequence); fprintf(stderr, "Partition size :: and count %d %d %d :: %d %d %d\n", idx_count[0], idx_count[1], idx_count[2], idx_size[0], idx_size[1], idx_size[2]); fprintf(stderr, "bitstring %s maxh = %d\n", bitSequence, maxh); // shared_block_level is the level upto which the idx blocks are shared int shared_block_level = (int)log2(idx_count[0] * idx_count[1] * idx_count[2]) + bits_per_block + 1; if (shared_block_level >= maxh) shared_block_level = maxh; int shared_block_count = pow(2, shared_block_level - 1) / samples_per_block; fprintf(stderr, "Shared block level = %d Shared block count = %d\n", shared_block_level, shared_block_count); int level = 0; int ts = 0; // Iteration through all the timesteps for (ts = start_time_step; ts <= end_time_step; ts++) { // Iteration through all the shared blocks //for (level = 0; level < shared_block_level; level = level + 1) { int hz_index = (int)pow(2, level - 1); int file_no = hz_index / (blocks_per_file * samples_per_block); int file_count; char existing_file_name[PIDX_FILE_PATH_LENGTH]; char new_file_name[PIDX_FILE_PATH_LENGTH]; int ic = 0; if (level <= bits_per_block + log2(blocks_per_file) + 1) file_count = 1; else file_count = (int)pow(2, level - (bits_per_block + log2(blocks_per_file) + 1)); // file_no is the index of the file that needs to be opened to read from all the partitions // they contain the shared blocks fprintf(stderr, "Opening file %d\n", file_no); #if 1 // iterate throuh all the files that contains the shared blocks // most likely this will be only the first file of all the partitions // so fc = 1 int fc = 0; for (fc = file_no; fc < file_no + file_count; fc++) { // malloc for the header for the outpur blocks, i.e. the merged blocks uint32_t* write_binheader; int write_binheader_count; write_binheader_count = 10 + 10 * blocks_per_file * variable_count; int write_binheader_length = write_binheader_count * sizeof (*write_binheader); write_binheader = malloc(write_binheader_length); memset(write_binheader, 0, write_binheader_length); //iterate through all the variables/fields int var = 0; off_t var_offset = 0; for (var = 0; var < 1; var++) { unsigned char *write_data_buffer = malloc(samples_per_block * shared_block_count * bpv[var]/8); memset(write_data_buffer, 0, samples_per_block * shared_block_count * bpv[var]/8); //fprintf(stderr, "Write bufer size = %d [%d x %d x %d]\n", samples_per_block * shared_block_count * bpv[var]/8, (int)pow(2, bits_per_block), shared_block_count, bpv[var]/8); // shared block data // doube pointer (number o fpartitions x number of shared blocks) unsigned char **read_data_buffer = malloc(idx_count[0] * idx_count[1] * idx_count[2] * sizeof(*read_data_buffer)); memset(read_data_buffer, 0, idx_count[0] * idx_count[1] * idx_count[2] * sizeof(*read_data_buffer)); // shared block header info uint32_t** read_binheader = malloc(idx_count[0] * idx_count[1] * idx_count[2] * sizeof(*read_binheader)); memset(read_binheader, 0, idx_count[0] * idx_count[1] * idx_count[2] * sizeof(*read_binheader)); file_initialize_time_step(ts, output_file_name, output_file_template); generate_file_name(blocks_per_file, output_file_template, fc, new_file_name, PATH_MAX); //fprintf(stderr, "Merged blocks to be written in %s\n", new_file_name); // iterate through all the parttions for (ic = 0; ic < idx_count[0] * idx_count[1] * idx_count[2]; ic++) { char file_name_skeleton[PIDX_FILE_PATH_LENGTH]; strncpy(file_name_skeleton, output_file_name, strlen(output_file_name) - 4); file_name_skeleton[strlen(output_file_name) - 4] = '\0'; if (idx_count[0] != 1 || idx_count[1] != 1 || idx_count[2] != 1) sprintf(partition_file_name, "%s_%d.idx", file_name_skeleton, ic); else strcpy(partition_file_name, output_file_name); file_initialize_time_step(ts, partition_file_name, partition_file_template); generate_file_name(blocks_per_file, partition_file_template, fc, existing_file_name, PATH_MAX); int read_binheader_count; read_binheader_count = 10 + 10 * blocks_per_file * variable_count; read_binheader[ic] = (uint32_t*) malloc(sizeof (*read_binheader[ic])*(read_binheader_count)); memset(read_binheader[ic], 0, sizeof (*(read_binheader[ic]))*(read_binheader_count)); fprintf(stderr, "[%d] Partition File name %s\n", ic, existing_file_name); // file exists if ( access( partition_file_name, F_OK ) != -1 ) { // contins data from the shared blocks read_data_buffer[ic] = malloc(samples_per_block * shared_block_count * bpv[var]/8); memset(read_data_buffer[ic], 0, samples_per_block * shared_block_count * bpv[var]/8); int fd; fd = open(existing_file_name, O_RDONLY | O_BINARY); if (fd < 0) { fprintf(stderr, "[File : %s] [Line : %d] open\n", __FILE__, __LINE__); continue; return 0; } // reads the header infor from binary file of the partitions ret = read(fd, read_binheader[ic], (sizeof (*(read_binheader[ic])) * read_binheader_count)); if (ret < 0) { fprintf(stderr, "[File : %s] [Line : %d] read\n", __FILE__, __LINE__); return 0; } //assert(ret == (sizeof (*(read_binheader[ic])) * read_binheader_count)); // copy the header from the partition file to the merged output file // do it only for first partition (this gets all info other than block offset nd count) if (ic == 0) memcpy(write_binheader, read_binheader[ic], 10 * sizeof (*write_binheader)); int bpf = 0; size_t data_size = 0; off_t data_offset = 0; for (bpf = 0; bpf < shared_block_count; bpf++) { data_offset = ntohl(read_binheader[ic][(bpf + var * blocks_per_file)*10 + 12]); data_size = ntohl(read_binheader[ic][(bpf + var * blocks_per_file)*10 + 14]); fprintf(stderr, "[%s] [Partition %d Block %d Variable %d] --> Offset %d Count %d\n", partition_file_name, ic, bpf, var, (int)data_offset, (int)data_size); if (data_offset != 0 && data_size != 0) { pread(fd, read_data_buffer[ic] + (bpf * samples_per_block * (bpv[var] / 8)), data_size, data_offset); write_binheader[((bpf + var * blocks_per_file)*10 + 12)] = htonl(write_binheader_length + (bpf * data_size) + var * shared_block_count); write_binheader[((bpf + var * blocks_per_file)*10 + 14)] = htonl(data_size); // Merge happening while the shared block is being read // Hardcoded stupid merge // checks if value is not zero then copies to the write block int m = 0; for (m = 0; m < data_size / (bpv[var] / 8) ; m++) { double temp; memcpy(&temp, read_data_buffer[ic] + (bpf * samples_per_block + m) * sizeof(double), sizeof(double)); if (temp != 0) memcpy(write_data_buffer + ((bpf * samples_per_block) + m) * sizeof(double), &temp, sizeof(double)); } } } close(fd); } else continue; } //Merge after all the reads for (ic = 0; ic < idx_count[0] * idx_count[1] * idx_count[2]; ic++) { //input is read_data_buffer** //output is write_data_buffer* } if ( access( new_file_name, F_OK ) != -1 ) { // file exists int fd; fd = open(new_file_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); { } close(fd); } else { // file doesn't exist /* int r; for (r = 0; r < (shared_block_count * samples_per_block * bpv[var]/8) / sizeof(double); r++) { double dval; memcpy(&dval, write_data_buffer + r * sizeof(double), sizeof(double)); fprintf(stderr, "value at %d = %f\n", r, dval); } */ int fd; fd = open(new_file_name, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); pwrite(fd, write_binheader, sizeof (*write_binheader)*(write_binheader_count), 0); pwrite(fd, write_data_buffer, shared_block_count * samples_per_block * bpv[var]/8, sizeof (*write_binheader)*(write_binheader_count)); close(fd); } } } #endif } } shutdown_mpi(); end_time = get_time(); fprintf(stderr, "Total time taken = %f %f\n", end_time, start_time); return 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; }
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; }