Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HPC_Imaging
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Claudio Gheller
HPC_Imaging
Commits
9309a598
Commit
9309a598
authored
2 years ago
by
Claudio Gheller
Browse files
Options
Downloads
Patches
Plain Diff
refactoring of part of main code
parent
484c45b3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
w-stacking-fftw.c
+54
-39
54 additions, 39 deletions
w-stacking-fftw.c
with
54 additions
and
39 deletions
w-stacking-fftw.c
+
54
−
39
View file @
9309a598
...
...
@@ -39,26 +39,23 @@ void Push(struct sectorlist** headRef, long data) {
// Main Code
int
main
(
int
argc
,
char
*
argv
[])
{
// Main MPI parameters
int
rank
;
int
size
;
// Define main filenames
FILE
*
pFile
;
FILE
*
pFile1
;
FILE
*
pFilereal
;
FILE
*
pFileimg
;
// Global filename to be composed
char
filename
[
1000
];
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/old/data/gauss2_t201806301100_SBL180.binMS/";
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/newgauss2noconj_t201806301100_SBL180.binMS/";
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/gauss1_t201806301100_SBL180.binMS/";
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/newgauss4_t201806301100_SBL180.binMS/";
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/gauss4_t201806301100_SBL180.binMS/";
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/hba-8hrs_t201806301100_SBH255i-test.binMS/";
//
//char datapath[900] = "/m100_scratch/userexternal/cgheller/gridding/hba-8hrs_gauss4new.binMS/";
//char datapath[900] = "/m100_scratch/userexternal/cgheller/Lofar/Observations/L798046_SB244_uv.uncorr_130B27932t_146MHz.pre-cal.binMS/";
// MS paths
char
datapath
[
900
];
char
datapath_multi
[
NFILES
][
900
];
// Bin MS files
char
ufile
[
30
]
=
"ucoord.bin"
;
char
vfile
[
30
]
=
"vcoord.bin"
;
char
wfile
[
30
]
=
"wcoord.bin"
;
...
...
@@ -66,6 +63,8 @@ int main(int argc, char * argv[])
char
visrealfile
[
30
]
=
"visibilities_real.bin"
;
char
visimgfile
[
30
]
=
"visibilities_img.bin"
;
char
metafile
[
30
]
=
"meta.txt"
;
// Mesh related files
char
outfile
[
30
]
=
"grid.txt"
;
char
outfile1
[
30
]
=
"coords.txt"
;
char
outfile2
[
30
]
=
"grid_real.bin"
;
...
...
@@ -78,6 +77,7 @@ int main(int argc, char * argv[])
char
srank
[
4
];
char
timingfile
[
30
]
=
"timings.dat"
;
// Visibilities related variables
double
*
uu
;
double
*
vv
;
double
*
ww
;
...
...
@@ -100,31 +100,44 @@ int main(int argc, char * argv[])
double
wmax
,
wmax0
;
double
resolution
;
// MESH SIZE
// Mesh related parameters: global size
int
grid_size_x
=
2048
;
int
grid_size_y
=
2048
;
int
local_grid_size_x
;
// = 8;
int
local_grid_size_y
;
// = 8;
// Split Mesh size (auto-calculated)
int
local_grid_size_x
;
int
local_grid_size_y
;
int
xaxis
;
int
yaxis
;
// Number of planes in the w direction
int
num_w_planes
=
8
;
//
DAV: the corresponding KernelLen is calculated within the wstack function. It can be anyway hardcoded for optimization
//
Size of the convoutional kernel support
int
w_support
=
7
;
int
num_threads
;
// = 4;
// Number of OpenMP threads (input parameter)
int
num_threads
;
// Resolution
double
dx
=
1
.
0
/
(
double
)
grid_size_x
;
double
dw
=
1
.
0
/
(
double
)
num_w_planes
;
// Half support size
double
w_supporth
=
(
double
)((
w_support
-
1
)
/
2
)
*
dx
;
// Internal profiling parameters
clock_t
start
,
end
,
start0
,
startk
,
endk
;
double
setup_time
,
process_time
,
mpi_time
,
fftw_time
,
tot_time
,
kernel_time
,
reduce_time
,
compose_time
,
phase_time
;
double
setup_time1
,
process_time1
,
mpi_time1
,
fftw_time1
,
tot_time1
,
kernel_time1
,
reduce_time1
,
compose_time1
,
phase_time1
;
double
writetime
,
writetime1
;
struct
timespec
begin
,
finish
,
begin0
,
begink
,
finishk
;
double
elapsed
;
long
nsectors
;
/* GT get nymber of threads exit if not given */
// Number of sectors in which the mesh is divided along the v direction
// IF nsectors < 0, nsectors = NUMBER OF MPI RANKS
long
nsectors
=
NUM_OF_SECTORS
;
/* Get number of threads, exit if not given */
if
(
argc
==
1
)
{
fprintf
(
stderr
,
"Usage: %s number_of_OMP_Threads
\n
"
,
argv
[
0
]);
exit
(
1
);
...
...
@@ -132,26 +145,29 @@ int main(int argc, char * argv[])
// Set the number of OpenMP threads
num_threads
=
atoi
(
argv
[
1
]);
if
(
num_
threads
=
=
0
)
{
// Number of
threads
<
= 0
not acceptable
if
(
num_threads
<=
0
)
{
fprintf
(
stderr
,
"Wrong parameter: %s
\n\n
"
,
argv
[
1
]);
fprintf
(
stderr
,
"Usage: %s number_of_OMP_Threads
\n
"
,
argv
[
0
]);
exit
(
1
);
}
// Internal profiling
clock_gettime
(
CLOCK_MONOTONIC
,
&
begin0
);
start0
=
clock
();
// Intialize MPI environment
#ifdef USE_MPI
// Intialize MPI environment
MPI_Init
(
&
argc
,
&
argv
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
size
);
if
(
rank
==
0
)
printf
(
"Running with %d MPI tasks
\n
"
,
size
);
#ifdef USE_FFTW
// Initialize FFTW environment
fftw_mpi_init
();
#endif
#else
// If MPI is not used the two parameters are set for consistency
rank
=
0
;
size
=
1
;
#endif
...
...
@@ -173,7 +189,6 @@ if(rank == 0){
// set the local size of the image
local_grid_size_x
=
grid_size_x
;
nsectors
=
NUM_OF_SECTORS
;
if
(
nsectors
<
0
)
nsectors
=
size
;
local_grid_size_y
=
grid_size_y
/
nsectors
;
//nsectors = size;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment