Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
yaxt
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
Container Registry
Model registry
Operate
Environments
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
dkrz-sw
yaxt
Commits
f778cd7f
Commit
f778cd7f
authored
3 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Use data in text segment and initialization at declaration.
parent
b7523abb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/idxsection_examples.c
+21
-21
21 additions, 21 deletions
examples/idxsection_examples.c
examples/rrobin.c
+9
-15
9 additions, 15 deletions
examples/rrobin.c
examples/tr_gp2fs.c
+11
-16
11 additions, 16 deletions
examples/tr_gp2fs.c
with
41 additions
and
52 deletions
examples/idxsection_examples.c
+
21
−
21
View file @
f778cd7f
...
...
@@ -54,18 +54,18 @@ int main(void) {
for
(
int
i
=
0
;
i
<
16
;
++
i
)
{
Xt_idxlist
idxsection
;
Xt_int
start
=
0
;
int
num_dimensions
=
2
;
Xt_int
global_size
[
4
][
2
]
=
{{
5
,
10
},{
5
,
-
10
},{
-
5
,
10
},{
-
5
,
-
10
}};
int
local_size
[
4
][
2
]
=
{{
3
,
4
},{
3
,
-
4
},{
-
3
,
4
},{
-
3
,
-
4
}};
Xt_int
local_start
[
2
]
=
{
1
,
2
};
enum
{
num_dimensions
=
2
}
;
static
const
Xt_int
global_size
[
4
][
2
]
=
{{
5
,
10
},{
5
,
-
10
},{
-
5
,
10
},{
-
5
,
-
10
}};
static
const
int
local_size
[
4
][
2
]
=
{{
3
,
4
},{
3
,
-
4
},{
-
3
,
4
},{
-
3
,
-
4
}};
static
const
Xt_int
local_start
[
2
]
=
{
1
,
2
};
// create index section
idxsection
=
xt_idxsection_new
(
start
,
num_dimensions
,
global_size
[
i
>>
2
],
local_size
[
i
&
3
],
local_start
);
Xt_idxlist
idxsection
=
xt_idxsection_new
(
start
,
num_dimensions
,
global_size
[
i
>>
2
],
local_size
[
i
&
3
],
local_start
);
// testing
...
...
@@ -83,18 +83,18 @@ int main(void) {
{
// test 2D section with stride in x
//! [custom stride in x]
Xt_idxlist
idxsection
;
Xt_int
start
=
0
;
int
num_dimensions
=
3
;
Xt_int
global_size
[
3
]
=
{
5
,
5
,
2
};
int
local_size
[
3
]
=
{
3
,
4
,
1
};
Xt_int
local_start
[
3
]
=
{
2
,
0
,
1
};
enum
{
num_dimensions
=
3
}
;
static
const
Xt_int
global_size
[
3
]
=
{
5
,
5
,
2
};
static
const
int
local_size
[
3
]
=
{
3
,
4
,
1
};
static
const
Xt_int
local_start
[
3
]
=
{
2
,
0
,
1
};
// create index section
idxsection
=
xt_idxsection_new
(
start
,
num_dimensions
,
global_size
,
local_size
,
local_start
);
Xt_idxlist
idxsection
=
xt_idxsection_new
(
start
,
num_dimensions
,
global_size
,
local_size
,
local_start
);
//! [custom stride in x]
// testing
...
...
@@ -110,18 +110,18 @@ int main(void) {
{
// test 2D section with stride in x and y
//! [custom stride in x and y]
Xt_idxlist
idxsection
;
Xt_int
start
=
0
;
int
num_dimensions
=
4
;
Xt_int
global_size
[
4
]
=
{
3
,
2
,
5
,
2
};
int
local_size
[
4
]
=
{
3
,
1
,
4
,
1
};
Xt_int
local_start
[
4
]
=
{
0
,
1
,
1
,
0
};
enum
{
num_dimensions
=
4
}
;
static
const
Xt_int
global_size
[
4
]
=
{
3
,
2
,
5
,
2
};
static
const
int
local_size
[
4
]
=
{
3
,
1
,
4
,
1
};
static
const
Xt_int
local_start
[
4
]
=
{
0
,
1
,
1
,
0
};
// create index section
idxsection
=
xt_idxsection_new
(
start
,
num_dimensions
,
global_size
,
local_size
,
local_start
);
Xt_idxlist
idxsection
=
xt_idxsection_new
(
start
,
num_dimensions
,
global_size
,
local_size
,
local_start
);
//! [custom stride in x and y]
// testing
...
...
This diff is collapsed.
Click to expand it.
examples/rrobin.c
+
9
−
15
View file @
f778cd7f
...
...
@@ -69,7 +69,7 @@ int main(void) {
{
// init source and destination data array, local data 5 elements length
int
len
=
5
;
enum
{
len
=
5
}
;
int
src_array
[
len
];
int
dst_array
[
len
];
...
...
@@ -87,30 +87,24 @@ int main(void) {
// output barrier
MPI_Barrier
(
MPI_COMM_WORLD
);
// source index list by stripes
Xt_idxlist
src_idxlist
;
struct
Xt_stripe
src_stripes
=
{.
start
=
(
Xt_int
)(
rank
*
len
),
.
stride
=
1
,
.
nstrides
=
len
};
src_idxlist
=
xt_idxstripes_new
(
&
src_stripes
,
1
);
// destination index list by stripes
Xt_idxlist
dst_idxlist
;
// source index list by stripes
Xt_idxlist
src_idxlist
=
xt_idxstripes_new
(
&
src_stripes
,
1
);
struct
Xt_stripe
dst_stripes
=
{.
start
=
(
Xt_int
)(((
rank
+
1
)
*
len
)
%
(
size
*
len
)),
.
stride
=
1
,
.
nstrides
=
len
};
dst_idxlist
=
xt_idxstripes_new
(
&
dst_stripes
,
1
);
// destination index list by stripes
Xt_idxlist
dst_idxlist
=
xt_idxstripes_new
(
&
dst_stripes
,
1
);
// xmap
Xt_xmap
xmap
;
xmap
=
xt_xmap_all2all_new
(
src_idxlist
,
dst_idxlist
,
MPI_COMM_WORLD
);
Xt_xmap
xmap
=
xt_xmap_all2all_new
(
src_idxlist
,
dst_idxlist
,
MPI_COMM_WORLD
);
// redist_p2p
Xt_redist
redist
;
redist
=
xt_redist_p2p_new
(
xmap
,
MPI_INTEGER
);
Xt_redist
redist
=
xt_redist_p2p_new
(
xmap
,
MPI_INTEGER
);
//array poiter, especially necessary for data array number > 1
//
array poi
n
ter, especially necessary for data array number > 1
int
*
src_array_p
=
&
src_array
[
0
];
int
*
dst_array_p
=
&
dst_array
[
0
];
...
...
This diff is collapsed.
Click to expand it.
examples/tr_gp2fs.c
+
11
−
16
View file @
f778cd7f
...
...
@@ -357,17 +357,16 @@ int main(int argc, char** argv) {
get_config
(
&
conf
,
argc
,
argv
,
nprocs
);
// global param
int
num_dims
=
3
;
enum
{
num_dims
=
3
}
;
Xt_int
global_size
[
3
]
=
{(
Xt_int
)
conf
.
z
,
(
Xt_int
)
conf
.
y
,
(
Xt_int
)
conf
.
x
};
// -- SOURCE index list by section
Xt_idxlist
src_idxsection
;
Xt_int
start
=
0
;
//create source index section
src
_idx
section
=
xt_idxsection_new
(
start
,
num_dims
,
global_size
,
conf
.
src
.
lo
c
al_size
,
conf
.
src
.
local_start
);
Xt
_idx
list
src_idxsection
=
xt_idxsection_new
(
start
,
num_dims
,
g
lo
b
al_size
,
conf
.
src
.
local_size
,
conf
.
src
.
local_start
);
#ifdef DEBUG
// 0 = soruce
...
...
@@ -376,25 +375,21 @@ int main(int argc, char** argv) {
#endif
// --- DEST-ination index list by section
Xt_idxlist
dst_idxsection
;
dst_idxsection
=
xt_idxsection_new
(
start
,
num_dims
,
global_size
,
conf
.
dst
.
local_size
,
conf
.
dst
.
local_start
);
Xt_idxlist
dst_idxsection
=
xt_idxsection_new
(
start
,
num_dims
,
global_size
,
conf
.
dst
.
local_size
,
conf
.
dst
.
local_start
);
// 1 = dest
#ifdef DEBUG
print_index
(
dst_idxsection
,
rank
,
DESTINATION
);
#endif
// xmap
Xt_xmap
xmap
;
xmap
=
xt_xmap_all2all_new
(
src_idxsection
,
dst_idxsection
,
MPI_COMM_WORLD
);
Xt_xmap
xmap
=
xt_xmap_all2all_new
(
src_idxsection
,
dst_idxsection
,
MPI_COMM_WORLD
);
// redist_p2p
Xt_redist
redist
;
redist
=
xt_redist_p2p_new
(
xmap
,
MPI_INTEGER
);
Xt_redist
redist
=
xt_redist_p2p_new
(
xmap
,
MPI_INT
);
// --- local data array
int
*
src_array
,
*
dst_array
;
...
...
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