Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Adios2 Variable Problem
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Thoennes
Adios2 Variable Problem
Commits
802c8f26
Commit
802c8f26
authored
1 year ago
by
Dominik Thoennes
Browse files
Options
Downloads
Patches
Plain Diff
add minimal example
parent
0e5132cf
No related branches found
No related tags found
No related merge requests found
Pipeline
#56186
failed
1 year ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+11
-0
11 additions, 0 deletions
.gitlab-ci.yml
CMakeLists.txt
+8
-0
8 additions, 0 deletions
CMakeLists.txt
adios2-variable-problem.cpp
+75
-0
75 additions, 0 deletions
adios2-variable-problem.cpp
with
94 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
11
−
0
View file @
802c8f26
test
image
:
i10git.cs.fau.de:5005/walberla/buildenvs/gcc-12
script
:
-
spack env activate /opt/spack-environment/
-
spack load adios2
-
mkdir build
-
cd build
-
cmake ..
-
make
-
mpirun --oversubscribe -n 8 ./adios2mini
20000
-
bpls checkpoint.bp | wc -l
This diff is collapsed.
Click to expand it.
CMakeLists.txt
0 → 100644
+
8
−
0
View file @
802c8f26
cmake_minimum_required
(
VERSION 3.12
)
project
(
Adios2Minimal CXX C
)
find_package
(
MPI REQUIRED
)
find_package
(
ADIOS2 REQUIRED
)
add_executable
(
adios2mini adios2-variable-problem.cpp
)
target_link_libraries
(
adios2mini PRIVATE adios2::cxx11_mpi
)
This diff is collapsed.
Click to expand it.
adios2-variable-problem.cpp
0 → 100644
+
75
−
0
View file @
802c8f26
#include
<iostream>
#include
<iomanip>
#include
<mpi.h>
#include
<adios2.h>
std
::
string
createVariable
(
adios2
::
IO
&
io
,
int
counter
,
int
rank
,
long
unsigned
int
bufferSize
)
{
std
::
stringstream
sStream
;
sStream
<<
"Var-"
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
3
)
<<
counter
<<
std
::
setw
(
3
)
<<
"_Rank-"
<<
rank
;
adios2
::
Variable
<
double
>
var
=
io
.
DefineVariable
<
double
>
(
sStream
.
str
(),
{},
{},
{
bufferSize
}
);
return
sStream
.
str
();
}
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
outFile
=
"./checkpoint.bp"
;
// -----------
// MPI setup
// -----------
MPI_Init
(
&
argc
,
&
argv
);
int
commSize
;
int
commRank
;
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
commSize
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
commRank
);
if
(
commRank
==
0
)
{
std
::
cout
<<
"Executing test with "
<<
commSize
<<
" MPI processes"
<<
std
::
endl
;
}
// determine number of variables to create
if
(
argc
!=
2
)
{
MPI_Abort
(
MPI_COMM_WORLD
,
-
1
);
}
int
numVarTotal
=
atoi
(
argv
[
1
]
);
int
numVarLocal
=
numVarTotal
/
commSize
;
if
(
commRank
==
0
)
{
std
::
cout
<<
"Total variables asked for = "
<<
numVarTotal
<<
std
::
endl
;
std
::
cout
<<
"Local variables to create = "
<<
numVarLocal
<<
std
::
endl
;
numVarLocal
+=
numVarTotal
-
numVarLocal
*
commSize
;
}
// -------------
// ADIOS setup
// -------------
adios2
::
ADIOS
adios
(
MPI_COMM_WORLD
);
adios2
::
IO
output
=
adios
.
DeclareIO
(
"Writer"
);
output
.
SetEngine
(
"BP5"
);
adios2
::
Engine
writer
=
output
.
Open
(
outFile
,
adios2
::
Mode
::
Write
);
int
counter
=
0
;
unsigned
long
int
bufferSize
=
100u
;
std
::
vector
<
double
>
buffer
(
bufferSize
,
2.0
);
for
(
int
k
=
1
;
k
<=
numVarLocal
;
++
k
)
{
double
*
address
=
buffer
.
data
();
std
::
string
var
=
createVariable
(
output
,
counter
++
,
commRank
,
bufferSize
);
writer
.
Put
<
double
>
(
var
,
address
);
}
int
numVariables
=
counter
;
MPI_Reduce
(
&
counter
,
&
numVariables
,
1
,
MPI_INT
,
MPI_SUM
,
0
,
MPI_COMM_WORLD
);
if
(
commRank
==
0
)
{
std
::
cout
<<
"Total variables created = "
<<
numVariables
<<
std
::
endl
;
}
// ----------
// Shutdown
// ----------
writer
.
Close
();
MPI_Finalize
();
}
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