Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
d44aa904
Commit
d44aa904
authored
7 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Plain Diff
Merge branch 'dump-cells' into cells-per-task
parents
093ec68d
5186c24c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!395
Make the expected number of tasks per cell a parameter.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/debug.c
+51
-0
51 additions, 0 deletions
src/debug.c
src/debug.h
+1
-0
1 addition, 0 deletions
src/debug.h
with
52 additions
and
0 deletions
src/debug.c
+
51
−
0
View file @
d44aa904
...
...
@@ -31,6 +31,7 @@
#include
"debug.h"
/* Local includes. */
#include
"active.h"
#include
"cell.h"
#include
"engine.h"
#include
"hydro.h"
...
...
@@ -268,6 +269,56 @@ int checkCellhdxmax(const struct cell *c, int *depth) {
return
result
;
}
/**
* @brief map function for dumping cells. In MPI mode local cells only.
*/
static
void
dumpCells_map
(
struct
cell
*
c
,
void
*
data
)
{
uintptr_t
*
ldata
=
(
uintptr_t
*
)
data
;
FILE
*
file
=
(
FILE
*
)
ldata
[
0
];
struct
engine
*
e
=
(
struct
engine
*
)
ldata
[
1
];
if
(
e
->
nodeID
==
c
->
nodeID
)
fprintf
(
file
,
" %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6d %6d %6d %6d %6d "
"%20lld %6d %6d %6d %6d
\n
"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
width
[
0
],
c
->
width
[
1
],
c
->
width
[
2
],
c
->
count
,
c
->
gcount
,
c
->
scount
,
c
->
depth
,
c
->
nr_tasks
,
c
->
ti_end_min
,
get_time_bin
(
c
->
ti_end_min
),
(
c
->
super
==
c
),
cell_is_active
(
c
,
e
),
c
->
nodeID
);
}
/**
* @brief Dump the location, depth, task counts and timebins and active state,
* for all cells to a simple text file.
*
* @param prefix base output filename
* @param s the space holding the cells to dump.
*/
void
dumpCells
(
const
char
*
prefix
,
struct
space
*
s
)
{
FILE
*
file
=
NULL
;
/* Name of output file. */
static
int
nseq
=
0
;
char
fname
[
200
];
sprintf
(
fname
,
"%s_%03d.dat"
,
prefix
,
nseq
);
atomic_inc
(
&
nseq
);
file
=
fopen
(
fname
,
"w"
);
/* Header. */
fprintf
(
file
,
"# %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s "
"%20s %6s %6s %6s %6s
\n
"
,
"x"
,
"y"
,
"z"
,
"xw"
,
"yw"
,
"zw"
,
"count"
,
"gcount"
,
"scount"
,
"depth"
,
"tasks"
,
"ti_end_min"
,
"timebin"
,
"issuper"
,
"active"
,
"rank"
);
uintptr_t
data
[
2
];
data
[
0
]
=
(
size_t
)
file
;
data
[
1
]
=
(
size_t
)
s
->
e
;
space_map_cells_pre
(
s
,
1
,
dumpCells_map
,
&
data
);
fclose
(
file
);
}
#ifdef HAVE_METIS
/**
...
...
This diff is collapsed.
Click to expand it.
src/debug.h
+
1
−
0
View file @
d44aa904
...
...
@@ -33,6 +33,7 @@ void printgParticle_single(struct gpart *gp);
int
checkSpacehmax
(
struct
space
*
s
);
int
checkCellhdxmax
(
const
struct
cell
*
c
,
int
*
depth
);
void
dumpCells
(
const
char
*
prefix
,
struct
space
*
s
);
#ifdef HAVE_METIS
#include
"metis.h"
...
...
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