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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Claudio Gheller
HPC_Imaging
Commits
677aac52
Commit
677aac52
authored
Feb 23, 2022
by
Nandhana Sakhtivel
Browse files
Options
Downloads
Patches
Plain Diff
read metadata file
parent
f368adcb
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
allvars.c
+10
-1
10 additions, 1 deletion
allvars.c
allvars.h
+36
-1
36 additions, 1 deletion
allvars.h
init.c
+62
-1
62 additions, 1 deletion
init.c
main.c
+30
-68
30 additions, 68 deletions
main.c
proto.h
+1
-1
1 addition, 1 deletion
proto.h
with
139 additions
and
72 deletions
allvars.c
+
10
−
1
View file @
677aac52
...
...
@@ -11,5 +11,14 @@ struct time timing;
char
filename
[
1000
];
int
num_threads
;
char
datapath_multi
[
NFILES
][
900
];
char
datapath_multi
[
NFILES
][
900
],
datapath
[
900
];
int
xaxis
,
yaxis
;
int
ndatasets
;
int
grid_size_x
=
2048
;
int
grid_size_y
=
2048
;
int
num_w_planes
=
8
;
int
rank
;
int
size
;
clock_t
start
,
end
,
start0
,
startk
,
endk
;
struct
timespec
begin
,
finish
,
begin0
,
begink
,
finishk
;
long
nsectors
;
This diff is collapsed.
Click to expand it.
allvars.h
+
36
−
1
View file @
677aac52
/* file to store global variables*/
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#ifdef USE_MPI
#include
<mpi.h>
#ifdef USE_FFTW
#include
<fftw3-mpi.h>
#endif
#endif
#ifdef ACCOMP
#include
"w-stacking_omp.h"
#else
#include
"w-stacking.h"
#endif
#ifdef NVIDIA
#include
<cuda_runtime.h>
#endif
#define PI 3.14159265359
#define NUM_OF_SECTORS -1
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define NOVERBOSE
#define NFILES 100
#include
<omp.h>
#include
<math.h>
#include
<time.h>
#include
<unistd.h>
extern
struct
io
{
...
...
@@ -68,5 +93,15 @@ extern struct time
extern
char
filename
[
1000
];
extern
int
num_threads
;
extern
char
datapath_multi
[
NFILES
][
900
];
extern
char
datapath_multi
[
NFILES
][
900
],
datapath
[
900
];
extern
int
xaxis
,
yaxis
;
extern
int
ndatasets
;
extern
int
grid_size_x
;
extern
int
grid_size_y
;
extern
int
num_w_planes
;
extern
int
rank
;
extern
int
size
;
extern
long
nsectors
;
extern
clock_t
start
,
end
,
start0
,
startk
,
endk
;
extern
struct
timespec
begin
,
finish
,
begin0
,
begink
,
finishk
;
This diff is collapsed.
Click to expand it.
init.c
+
62
−
1
View file @
677aac52
...
...
@@ -4,9 +4,70 @@
#include
"allvars.h"
#include
"proto.h"
void
init
()
void
init
(
int
argc
,
char
*
argv
[]
)
{
// MESH SIZE
int
local_grid_size_x
;
// = 8;
int
local_grid_size_y
;
// = 8;
read_parameter_file
(
in
.
paramfile
);
if
(
num_threads
==
0
)
{
fprintf
(
stderr
,
"Usage: %s number_of_OMP_Threads
\n
"
,
num_threads
);
exit
(
1
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
begin0
);
start0
=
clock
();
// Intialize MPI environment
#ifdef USE_MPI
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
fftw_mpi_init
();
#endif
#else
rank
=
0
;
size
=
1
;
#endif
if
(
rank
==
0
)
printf
(
"Running with %d threads
\n
"
,
num_threads
);
#ifdef ACCOMP
if
(
rank
==
0
){
if
(
0
==
omp_get_num_devices
())
{
printf
(
"No accelerator found ... exit
\n
"
);
exit
(
255
);
}
printf
(
"Number of available GPUs %d
\n
"
,
omp_get_num_devices
());
#ifdef NVIDIA
prtAccelInfo
();
#endif
}
#endif
// 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;
// LOCAL grid size
xaxis
=
local_grid_size_x
;
yaxis
=
local_grid_size_y
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
begin
);
start
=
clock
();
// INPUT FILES (only the first ndatasets entries are used)
strcpy
(
datapath
,
datapath_multi
[
0
]);
// Read metadata
fileName
(
datapath
,
in
.
metafile
);
readMetaData
(
filename
);
}
...
...
This diff is collapsed.
Click to expand it.
main.c
+
30
−
68
View file @
677aac52
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#ifdef USE_MPI
#include
<mpi.h>
#ifdef USE_FFTW
#include
<fftw3-mpi.h>
#endif
#endif
#include
<omp.h>
#include
<math.h>
#include
<time.h>
#include
<unistd.h>
#include
"allvars.h"
#include
"proto.h"
#ifdef ACCOMP
#include
"w-stacking_omp.h"
#else
#include
"w-stacking.h"
#endif
#define PI 3.14159265359
#define NUM_OF_SECTORS -1
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define NOVERBOSE
// Linked List set-up
struct
sectorlist
{
...
...
@@ -41,10 +20,6 @@ void Push(struct sectorlist** headRef, long data) {
// Main Code
int
main
(
int
argc
,
char
*
argv
[])
{
int
rank
;
int
size
;
char
datapath
[
900
];
char
srank
[
4
];
...
...
@@ -57,31 +32,23 @@ int main(int argc, char * argv[])
double
resolution
;
// MESH SIZE
int
grid_size_x
=
2048
;
int
grid_size_y
=
2048
;
int
local_grid_size_x
;
// = 8;
int
local_grid_size_y
;
// = 8;
int
xaxis
;
int
yaxis
;
int
num_w_planes
=
8
;
// int local_grid_size_x;// = 8;
// int local_grid_size_y;// = 8;
// int xaxis;
// int yaxis;
// DAV: the corresponding KernelLen is calculated within the wstack function. It can be anyway hardcoded for optimization
int
w_support
=
7
;
int
num_threads
;
// = 4;
double
dx
=
1
.
0
/
(
double
)
grid_size_x
;
double
dw
=
1
.
0
/
(
double
)
num_w_planes
;
double
w_supporth
=
(
double
)((
w_support
-
1
)
/
2
)
*
dx
;
clock_t
start
,
end
,
start0
,
startk
,
endk
;
struct
timespec
begin
,
finish
,
begin0
,
begink
,
finishk
;
double
elapsed
;
long
nsectors
;
//
long nsectors;
if
(
argc
>
1
)
{
strcpy
(
in
.
paramfile
,
argv
[
1
]);
printf
(
"parameter file = %s
\n
"
,
in
.
paramfile
);
init
();
}
else
{
...
...
@@ -89,18 +56,8 @@ int main(int argc, char * argv[])
exit
(
1
);
}
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
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
begin0
);
start0
=
clock
();
// Intialize MPI environment
init
(
argc
,
argv
);
/*
#ifdef USE_MPI
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
...
...
@@ -109,7 +66,6 @@ int main(int argc, char * argv[])
#ifdef USE_FFTW
fftw_mpi_init();
#endif
MPI_Barrier
(
MPI_COMM_WORLD
);
#else
rank = 0;
size = 1;
...
...
@@ -130,6 +86,11 @@ if(rank == 0){
}
#endif
// set the local size of the image
local_grid_size_x = grid_size_x;
nsectors = NUM_OF_SECTORS;
...
...
@@ -146,10 +107,11 @@ if(rank == 0){
// INPUT FILES (only the first ndatasets entries are used)
strcpy(datapath,datapath_multi[0]);
// Read metadata
fileName(datapath, in.metafile);
readMetaData(filename);
*/
// WATCH THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
int
nsub
=
1000
;
//int nsub = 10;
...
...
This diff is collapsed.
Click to expand it.
proto.h
+
1
−
1
View file @
677aac52
...
...
@@ -3,7 +3,7 @@
/* init.c */
void
init
();
void
init
(
int
argc
,
char
*
argv
[]
);
void
read_parameter_file
(
char
*
);
void
fileName
(
char
datapath
[
900
],
char
file
[
30
]);
void
readMetaData
(
char
fileLocal
[
1000
]);
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
sign in
to comment