Select Git revision
-
Luca Tornatore authoredLuca Tornatore authored
init.c 12.74 KiB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "allvars.h"
#include "proto.h"
void init(int index)
{
TAKE_TIME_START(total);
// DAV: the corresponding KernelLen is calculated within the wstack function. It can be anyway hardcoded for optimization
dx = 1.0/(double)param.grid_size_x;
dw = 1.0/(double)param.num_w_planes;
w_supporth = (double)((param.w_support-1)/2)*dx;
// MESH SIZE
int local_grid_size_x;// = 8;
int local_grid_size_y;// = 8;
// set the local size of the image
local_grid_size_x = param.grid_size_x;
nsectors = NUM_OF_SECTORS;
if (nsectors < 0) nsectors = size;
local_grid_size_y = param.grid_size_y/nsectors;
//nsectors = size;
// LOCAL grid size
xaxis = local_grid_size_x;
yaxis = local_grid_size_y;
#ifdef USE_MPI
numa_init( global_rank, size, &MYMPI_COMM_WORLD, &Me );
if(global_rank == 0)
printf("\nTask %d sees %d topology levels\n", global_rank, Me.MAXl);
#endif
TAKE_TIME_START(setup);
// INPUT FILES (only the first ndatasets entries are used)
strcpy(datapath,param.datapath_multi[index]);
sprintf(num_buf, "%d", index);
//Changing the output file names
op_filename();
// Read metadata
fileName(datapath, in.metafile);
readMetaData(filename);
// Local Calculation
metaData_calculation();
// Allocate Data Buffer
allocate_memory();
// Reading Data
readData();
#ifdef USE_MPI
MPI_Barrier(MPI_COMM_WORLD);
#endif
TAKE_TIME_STOP(setup);
}
void op_filename() {
if(global_rank == 0)