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
912f28d4
Commit
912f28d4
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Better name for the time-stamp function
parent
1a2e49aa
No related branches found
No related tags found
2 merge requests
!136
Master
,
!107
Code timing and verbosity
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/clocks.c
+1
-1
1 addition, 1 deletion
src/clocks.c
src/clocks.h
+1
-1
1 addition, 1 deletion
src/clocks.h
src/engine.c
+8
-7
8 additions, 7 deletions
src/engine.c
src/error.h
+45
-44
45 additions, 44 deletions
src/error.h
with
55 additions
and
53 deletions
src/clocks.c
+
1
−
1
View file @
912f28d4
...
@@ -233,7 +233,7 @@ const char *clocks_getunit() { return clocks_units[clocks_units_index]; }
...
@@ -233,7 +233,7 @@ const char *clocks_getunit() { return clocks_units[clocks_units_index]; }
*
*
* @result the time since the start of the execution
* @result the time since the start of the execution
*/
*/
const
char
*
clocks_get_time
ofday
()
{
const
char
*
clocks_get_time
sincestart
()
{
static
char
buffer
[
40
];
static
char
buffer
[
40
];
...
...
This diff is collapsed.
Click to expand it.
src/clocks.h
+
1
−
1
View file @
912f28d4
...
@@ -39,6 +39,6 @@ void clocks_set_cpufreq(unsigned long long freq);
...
@@ -39,6 +39,6 @@ void clocks_set_cpufreq(unsigned long long freq);
unsigned
long
long
clocks_get_cpufreq
();
unsigned
long
long
clocks_get_cpufreq
();
double
clocks_from_ticks
(
ticks
tics
);
double
clocks_from_ticks
(
ticks
tics
);
double
clocks_diff_ticks
(
ticks
tic
,
ticks
toc
);
double
clocks_diff_ticks
(
ticks
tic
,
ticks
toc
);
const
char
*
clocks_get_time
ofday
();
const
char
*
clocks_get_time
sincestart
();
#endif
/* SWIFT_CLOCKS_H */
#endif
/* SWIFT_CLOCKS_H */
This diff is collapsed.
Click to expand it.
src/engine.c
+
8
−
7
View file @
912f28d4
...
@@ -1171,10 +1171,10 @@ void engine_print(struct engine *e) {
...
@@ -1171,10 +1171,10 @@ void engine_print(struct engine *e) {
counts
[
task_type_count
]
+=
1
;
counts
[
task_type_count
]
+=
1
;
#ifdef WITH_MPI
#ifdef WITH_MPI
printf
(
"[%04i] %s engine_print: task counts are [ %s=%i"
,
e
->
nodeID
,
printf
(
"[%04i] %s engine_print: task counts are [ %s=%i"
,
e
->
nodeID
,
clocks_get_time
ofday
(),
taskID_names
[
0
],
counts
[
0
]);
clocks_get_time
sincestart
(),
taskID_names
[
0
],
counts
[
0
]);
#else
#else
printf
(
"%s engine_print: task counts are [ %s=%i"
,
clocks_get_timeofday
(),
printf
(
"%s engine_print: task counts are [ %s=%i"
,
taskID_names
[
0
],
counts
[
0
]);
clocks_get_timesincestart
(),
taskID_names
[
0
],
counts
[
0
]);
#endif
#endif
for
(
k
=
1
;
k
<
task_type_count
;
k
++
)
for
(
k
=
1
;
k
<
task_type_count
;
k
++
)
printf
(
" %s=%i"
,
taskID_names
[
k
],
counts
[
k
]);
printf
(
" %s=%i"
,
taskID_names
[
k
],
counts
[
k
]);
...
@@ -1929,9 +1929,9 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
...
@@ -1929,9 +1929,9 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
if
(
nodeID
==
0
)
{
if
(
nodeID
==
0
)
{
#ifdef WITH_MPI
#ifdef WITH_MPI
printf
(
"[%04i] %s engine_init: cpu map is [ "
,
nodeID
,
printf
(
"[%04i] %s engine_init: cpu map is [ "
,
nodeID
,
clocks_get_time
ofday
());
clocks_get_time
sincestart
());
#else
#else
printf
(
"%s engine_init: cpu map is [ "
,
clocks_get_time
ofday
());
printf
(
"%s engine_init: cpu map is [ "
,
clocks_get_time
sincestart
());
#endif
#endif
for
(
int
i
=
0
;
i
<
nr_cores
;
i
++
)
printf
(
"%i "
,
cpuid
[
i
]);
for
(
int
i
=
0
;
i
<
nr_cores
;
i
++
)
printf
(
"%i "
,
cpuid
[
i
]);
printf
(
"].
\n
"
);
printf
(
"].
\n
"
);
...
@@ -2108,14 +2108,15 @@ void engine_print_policy(struct engine *e) {
...
@@ -2108,14 +2108,15 @@ void engine_print_policy(struct engine *e) {
#ifdef WITH_MPI
#ifdef WITH_MPI
if
(
e
->
nodeID
==
0
)
{
if
(
e
->
nodeID
==
0
)
{
printf
(
"[0000] %s engine_policy: engine policies are [ "
,
printf
(
"[0000] %s engine_policy: engine policies are [ "
,
clocks_get_time
ofday
());
clocks_get_time
sincestart
());
for
(
int
k
=
1
;
k
<
32
;
k
++
)
for
(
int
k
=
1
;
k
<
32
;
k
++
)
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
" %s "
,
engine_policy_names
[
k
+
1
]);
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
" %s "
,
engine_policy_names
[
k
+
1
]);
printf
(
" ]
\n
"
);
printf
(
" ]
\n
"
);
fflush
(
stdout
);
fflush
(
stdout
);
}
}
#else
#else
printf
(
"%s engine_policy: engine policies are [ "
,
clocks_get_timeofday
());
printf
(
"%s engine_policy: engine policies are [ "
,
clocks_get_timesincestart
());
for
(
int
k
=
1
;
k
<
32
;
k
++
)
for
(
int
k
=
1
;
k
<
32
;
k
++
)
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
" %s "
,
engine_policy_names
[
k
+
1
]);
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
" %s "
,
engine_policy_names
[
k
+
1
]);
printf
(
" ]
\n
"
);
printf
(
" ]
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
src/error.h
+
45
−
44
View file @
912f28d4
...
@@ -37,19 +37,19 @@
...
@@ -37,19 +37,19 @@
*/
*/
#ifdef WITH_MPI
#ifdef WITH_MPI
extern
int
engine_rank
;
extern
int
engine_rank
;
#define error(s, ...) \
#define error(s, ...)
\
{ \
{
\
fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \
fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank,
\
clocks_get_time
ofday
(), __FILE__, __FUNCTION__, __LINE__, \
clocks_get_time
sincestart
(), __FILE__, __FUNCTION__, __LINE__, \
##__VA_ARGS__); \
##__VA_ARGS__);
\
MPI_Abort(MPI_COMM_WORLD, -1); \
MPI_Abort(MPI_COMM_WORLD, -1);
\
}
}
#else
#else
#define error(s, ...) \
#define error(s, ...)
\
{ \
{
\
fprintf(stderr, "%s %s:%s():%i: " s "\n", clocks_get_time
ofday
(), \
fprintf(stderr, "%s %s:%s():%i: " s "\n", clocks_get_time
sincestart
(), \
__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
\
abort(); \
abort();
\
}
}
#endif
#endif
...
@@ -59,27 +59,27 @@ extern int engine_rank;
...
@@ -59,27 +59,27 @@ extern int engine_rank;
* followed by the MPI error string and aborts.
* followed by the MPI error string and aborts.
*
*
*/
*/
#define mpi_error(res, s, ...) \
#define mpi_error(res, s, ...)
\
{ \
{
\
fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \
fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank,
\
clocks_get_time
ofday
(), __FILE__, __FUNCTION__, __LINE__, \
clocks_get_time
sincestart
(), __FILE__, __FUNCTION__, __LINE__, \
##__VA_ARGS__); \
##__VA_ARGS__);
\
int len = 1024; \
int len = 1024;
\
char buf[len]; \
char buf[len];
\
MPI_Error_string(res, buf, &len); \
MPI_Error_string(res, buf, &len);
\
fprintf(stderr, "%s\n\n", buf); \
fprintf(stderr, "%s\n\n", buf);
\
MPI_Abort(MPI_COMM_WORLD, -1); \
MPI_Abort(MPI_COMM_WORLD, -1);
\
}
}
#define mpi_error_string(res, s, ...) \
#define mpi_error_string(res, s, ...)
\
{ \
{
\
fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \
fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank,
\
clocks_get_time
ofday
(), __FILE__, __FUNCTION__, __LINE__, \
clocks_get_time
sincestart
(), __FILE__, __FUNCTION__, __LINE__, \
##__VA_ARGS__); \
##__VA_ARGS__);
\
int len = 1024; \
int len = 1024;
\
char buf[len]; \
char buf[len];
\
MPI_Error_string(res, buf, &len); \
MPI_Error_string(res, buf, &len);
\
fprintf(stderr, "%s\n\n", buf); \
fprintf(stderr, "%s\n\n", buf);
\
}
}
#endif
#endif
...
@@ -89,12 +89,13 @@ extern int engine_rank;
...
@@ -89,12 +89,13 @@ extern int engine_rank;
*/
*/
#ifdef WITH_MPI
#ifdef WITH_MPI
extern
int
engine_rank
;
extern
int
engine_rank
;
#define message(s, ...) \
#define message(s, ...)
\
printf("[%04i] %s %s: " s "\n", engine_rank, clocks_get_time
ofday
(), \
printf("[%04i] %s %s: " s "\n", engine_rank, clocks_get_time
sincestart
(), \
__FUNCTION__, ##__VA_ARGS__)
__FUNCTION__, ##__VA_ARGS__)
#else
#else
#define message(s, ...) \
#define message(s, ...) \
printf("%s %s: " s "\n", clocks_get_timeofday(), __FUNCTION__, ##__VA_ARGS__)
printf("%s %s: " s "\n", clocks_get_timesincestart(), __FUNCTION__, \
##__VA_ARGS__)
#endif
#endif
/**
/**
...
@@ -107,21 +108,21 @@ extern int engine_rank;
...
@@ -107,21 +108,21 @@ extern int engine_rank;
{ \
{ \
if (!(expr)) { \
if (!(expr)) { \
fprintf(stderr, "[%04i] %s %s:%s():%i: FAILED ASSERTION: " #expr " \n", \
fprintf(stderr, "[%04i] %s %s:%s():%i: FAILED ASSERTION: " #expr " \n", \
engine_rank, clocks_get_time
ofday
(), __FILE__,
__FUNCTION__,
\
engine_rank, clocks_get_time
sincestart
(), __FILE__,
\
__
LINE__);
\
__
FUNCTION__, __LINE__);
\
fflush(stderr); \
fflush(stderr); \
MPI_Abort(MPI_COMM_WORLD, -1); \
MPI_Abort(MPI_COMM_WORLD, -1); \
} \
} \
}
}
#else
#else
#define assert(expr) \
#define assert(expr)
\
{ \
{
\
if (!(expr)) { \
if (!(expr)) {
\
fprintf(stderr, "%s %s:%s():%i: FAILED ASSERTION: " #expr " \n", \
fprintf(stderr, "%s %s:%s():%i: FAILED ASSERTION: " #expr " \n",
\
clocks_get_time
ofday
(), __FILE__, __FUNCTION__, __LINE__); \
clocks_get_time
sincestart
(), __FILE__, __FUNCTION__, __LINE__); \
fflush(stderr); \
fflush(stderr);
\
abort(); \
abort();
\
} \
}
\
}
}
#endif
#endif
...
...
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