Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pairs
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
software
pairs
Commits
106f5217
Commit
106f5217
authored
4 months ago
by
Behzad Safaei
Browse files
Options
Downloads
Patches
Plain Diff
Fix block config
parent
1adaab41
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
runtime/domain/block_forest.cpp
+34
-37
34 additions, 37 deletions
runtime/domain/block_forest.cpp
runtime/domain/block_forest.hpp
+1
-1
1 addition, 1 deletion
runtime/domain/block_forest.hpp
with
35 additions
and
38 deletions
runtime/domain/block_forest.cpp
+
34
−
37
View file @
106f5217
...
...
@@ -179,38 +179,41 @@ void BlockForest::updateWeights() {
}
}
walberla
::
Vector3
<
int
>
BlockForest
::
getBlockConfig
(
int
num_processes
,
int
nx
,
int
ny
,
int
nz
)
{
const
int
bx_factor
=
1
;
const
int
by_factor
=
1
;
const
int
bz_factor
=
1
;
const
int
ax
=
nx
*
ny
;
const
int
ay
=
nx
*
nz
;
const
int
az
=
ny
*
nz
;
int
bestsurf
=
2
*
(
ax
+
ay
+
az
);
int
x
=
1
;
int
y
=
1
;
int
z
=
1
;
for
(
int
i
=
1
;
i
<
num_processes
;
++
i
)
{
if
(
num_processes
%
i
==
0
)
{
const
int
rem_yz
=
num_processes
/
i
;
for
(
int
j
=
1
;
j
<
rem_yz
;
++
j
)
{
if
(
rem_yz
%
j
==
0
)
{
const
int
k
=
rem_yz
/
j
;
const
int
surf
=
(
ax
/
i
/
j
)
+
(
ay
/
i
/
k
)
+
(
az
/
j
/
k
);
walberla
::
Vector3
<
int
>
BlockForest
::
getBlockConfig
()
{
real_t
area
[
3
];
real_t
best_surf
=
0.0
;
int
ndims
=
3
;
int
d
=
0
;
int
nranks
[
3
]
=
{
1
,
1
,
1
};
for
(
int
d1
=
0
;
d1
<
ndims
;
d1
++
)
{
for
(
int
d2
=
d1
+
1
;
d2
<
ndims
;
d2
++
)
{
area
[
d
]
=
(
this
->
grid_max
[
d1
]
-
this
->
grid_min
[
d1
])
*
(
this
->
grid_max
[
d2
]
-
this
->
grid_min
[
d2
]);
best_surf
+=
2.0
*
area
[
d
];
d
++
;
}
}
for
(
int
i
=
1
;
i
<=
world_size
;
i
++
)
{
if
(
world_size
%
i
==
0
)
{
const
int
rem_yz
=
world_size
/
i
;
if
(
surf
<
bestsurf
)
{
x
=
i
,
y
=
j
,
z
=
k
;
bestsurf
=
surf
;
for
(
int
j
=
1
;
j
<=
rem_yz
;
j
++
)
{
if
(
rem_yz
%
j
==
0
)
{
const
int
k
=
rem_yz
/
j
;
const
real_t
surf
=
(
area
[
0
]
/
i
/
j
)
+
(
area
[
1
]
/
i
/
k
)
+
(
area
[
2
]
/
j
/
k
);
if
(
surf
<
best_surf
)
{
nranks
[
0
]
=
i
;
nranks
[
1
]
=
j
;
nranks
[
2
]
=
k
;
best_surf
=
surf
;
}
}
}
}
}
}
return
walberla
::
Vector3
<
int
>
(
x
*
bx_factor
,
y
*
by_factor
,
z
*
bz_factor
);
return
walberla
::
Vector3
<
int
>
(
nranks
[
0
],
nranks
[
1
],
nranks
[
2
]);
}
int
BlockForest
::
getInitialRefinementLevel
(
int
num_processes
)
{
...
...
@@ -250,20 +253,14 @@ void BlockForest::initialize(int *argc, char ***argv) {
mpiManager
->
useWorldComm
();
world_size
=
mpiManager
->
numProcesses
();
rank
=
mpiManager
->
rank
();
walberla
::
math
::
AABB
domain
(
grid_min
[
0
],
grid_min
[
1
],
grid_min
[
2
],
grid_max
[
0
],
grid_max
[
1
],
grid_max
[
2
]);
int
gridsize
[
3
]
=
{
32
,
32
,
32
};
auto
block_config
=
balance_workload
?
walberla
::
Vector3
<
int
>
(
1
,
1
,
1
)
:
getBlockConfig
();
auto
procs
=
mpiManager
->
numProcesses
();
auto
block_config
=
balance_workload
?
walberla
::
Vector3
<
int
>
(
1
,
1
,
1
)
:
getBlockConfig
(
procs
,
gridsize
[
0
],
gridsize
[
1
],
gridsize
[
2
]);
auto
ref_level
=
balance_workload
?
getInitialRefinementLevel
(
procs
)
:
0
;
// PBC's are forced to true here and sperately handled when determining ghosts
walberla
::
Vector3
<
bool
>
pbc
(
true
,
true
,
true
);
walberla
::
math
::
AABB
domain
(
grid_min
[
0
],
grid_min
[
1
],
grid_min
[
2
],
grid_max
[
0
],
grid_max
[
1
],
grid_max
[
2
]);
forest
=
walberla
::
blockforest
::
createBlockForest
(
domain
,
block_config
,
pbc
,
procs
,
ref_level
);
this
->
info
=
make_shared
<
walberla
::
blockforest
::
InfoCollection
>
();
...
...
This diff is collapsed.
Click to expand it.
runtime/domain/block_forest.hpp
+
1
−
1
View file @
106f5217
...
...
@@ -68,7 +68,7 @@ public:
void
updateNeighborhood
();
void
updateWeights
();
walberla
::
math
::
Vector3
<
int
>
getBlockConfig
(
int
num_processes
,
int
nx
,
int
ny
,
int
nz
);
walberla
::
math
::
Vector3
<
int
>
getBlockConfig
();
int
getInitialRefinementLevel
(
int
num_processes
);
void
setBoundingBox
();
void
rebalance
();
...
...
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