Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
0a9bb54a
Commit
0a9bb54a
authored
Dec 17, 2018
by
Loic Hausammann
Browse files
change to uppercase constant (and format)
parent
12bfc29d
Changes
2
Show whitespace changes
Inline
Side-by-side
src/scheduler.c
View file @
0a9bb54a
...
...
@@ -146,9 +146,8 @@ int scheduler_get_number_relation(const struct scheduler *s,
return
count
;
}
/* Conservative number of dependencies per task type */
#define
max_nber_dep
128
#define
MAX_NUMBER_DEP
128
/**
* @brief Informations about all the task dependencies of
...
...
@@ -167,23 +166,22 @@ struct task_dependency {
/* Dependent task */
/* ID of the dependent task */
int
type_out
[
max_nber_dep
];
int
type_out
[
MAX_NUMBER_DEP
];
/* ID of the dependent subtask */
int
subtype_out
[
max_nber_dep
];
int
subtype_out
[
MAX_NUMBER_DEP
];
/* Is the dependent task implicit */
int
implicit_out
[
max_nber_dep
];
int
implicit_out
[
MAX_NUMBER_DEP
];
/* Statistics */
/* number of link between the two task type */
int
number_link
[
max_nber_dep
];
int
number_link
[
MAX_NUMBER_DEP
];
/* number of ranks having this relation */
int
number_rank
[
max_nber_dep
];
int
number_rank
[
MAX_NUMBER_DEP
];
};
#ifdef WITH_MPI
/**
* @brief Define the #task_dependency for MPI
...
...
@@ -199,7 +197,7 @@ void task_dependency_define(MPI_Datatype *tstype) {
MPI_Aint
disps
[
count
];
/* all the type are int */
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
types
[
i
]
=
MPI_INT
;
}
...
...
@@ -213,17 +211,17 @@ void task_dependency_define(MPI_Datatype *tstype) {
/* Task out */
disps
[
3
]
=
offsetof
(
struct
task_dependency
,
type_out
);
blocklens
[
3
]
=
max_nber_dep
;
blocklens
[
3
]
=
MAX_NUMBER_DEP
;
disps
[
4
]
=
offsetof
(
struct
task_dependency
,
subtype_out
);
blocklens
[
4
]
=
max_nber_dep
;
blocklens
[
4
]
=
MAX_NUMBER_DEP
;
disps
[
5
]
=
offsetof
(
struct
task_dependency
,
implicit_out
);
blocklens
[
5
]
=
max_nber_dep
;
blocklens
[
5
]
=
MAX_NUMBER_DEP
;
/* statistics */
disps
[
6
]
=
offsetof
(
struct
task_dependency
,
number_link
);
blocklens
[
6
]
=
max_nber_dep
;
blocklens
[
6
]
=
MAX_NUMBER_DEP
;
disps
[
7
]
=
offsetof
(
struct
task_dependency
,
number_rank
);
blocklens
[
7
]
=
max_nber_dep
;
blocklens
[
7
]
=
MAX_NUMBER_DEP
;
/* define it for MPI */
MPI_Type_create_struct
(
count
,
blocklens
,
disps
,
types
,
tstype
);
...
...
@@ -238,8 +236,8 @@ void task_dependency_define(MPI_Datatype *tstype) {
* @param len The length of the arrays
* @param type The MPI datatype
*/
void
task_dependency_sum
(
void
*
in_p
,
void
*
out_p
,
int
*
len
,
MPI_Datatype
*
type
){
void
task_dependency_sum
(
void
*
in_p
,
void
*
out_p
,
int
*
len
,
MPI_Datatype
*
type
)
{
/* change pointer type */
struct
task_dependency
*
in
=
in_p
;
...
...
@@ -249,7 +247,7 @@ void task_dependency_sum(
for
(
int
i
=
0
;
i
<
*
len
;
i
++
)
{
/* loop over all the object set in invals */
for
(
int
j
=
0
;
j
<
max_nber_dep
;
j
++
)
{
for
(
int
j
=
0
;
j
<
MAX_NUMBER_DEP
;
j
++
)
{
/* Have we reached the end of the links? */
if
(
in
[
i
].
number_link
[
j
]
==
-
1
)
{
...
...
@@ -273,7 +271,7 @@ void task_dependency_sum(
/* find the corresponding id */
int
k
=
0
;
while
(
k
<
max_nber_dep
)
{
while
(
k
<
MAX_NUMBER_DEP
)
{
/* have we reached the end of the links? */
if
(
out
[
i
].
number_link
[
k
]
==
-
1
)
{
/* reset the counter in order to be safe */
...
...
@@ -301,8 +299,8 @@ void task_dependency_sum(
}
/* Check if we are still in the memory */
if
(
k
==
max_nber_dep
)
{
error
(
"Not enough memory, please increase
max_nber_dep
"
);
if
(
k
==
MAX_NUMBER_DEP
)
{
error
(
"Not enough memory, please increase
MAX_NUMBER_DEP
"
);
}
#ifdef SWIFT_DEBUG_CHECKS
...
...
@@ -342,8 +340,7 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
const
ticks
tic
=
getticks
();
/* Number of possible relations between tasks */
const
int
nber_tasks
=
task_type_count
*
task_subtype_count
;
const
int
nber_tasks
=
task_type_count
*
task_subtype_count
;
/* To get the table for a task:
* ind = (ta * task_subtype_count + sa)
...
...
@@ -357,7 +354,7 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
/* Reset counter */
for
(
int
i
=
0
;
i
<
nber_tasks
;
i
++
)
{
for
(
int
j
=
0
;
j
<
max_nber_dep
;
j
++
)
{
for
(
int
j
=
0
;
j
<
MAX_NUMBER_DEP
;
j
++
)
{
/* Use number_link as indicator of the existance of a relation */
task_dep
[
i
].
number_link
[
j
]
=
-
1
;
}
...
...
@@ -382,7 +379,7 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
const
struct
task
*
tb
=
ta
->
unlock_tasks
[
j
];
int
k
=
0
;
while
(
k
<
max_nber_dep
)
{
while
(
k
<
MAX_NUMBER_DEP
)
{
/* not written yet */
if
(
cur
->
number_link
[
k
]
==
-
1
)
{
...
...
@@ -400,16 +397,17 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
}
/* already written */
if
(
cur
->
type_out
[
k
]
==
tb
->
type
&&
cur
->
subtype_out
[
k
]
==
tb
->
subtype
)
{
if
(
cur
->
type_out
[
k
]
==
tb
->
type
&&
cur
->
subtype_out
[
k
]
==
tb
->
subtype
)
{
break
;
}
k
+=
1
;
}
/*
max_nber_dep
is too small */
if
(
k
==
max_nber_dep
)
error
(
"Not enough memory, please increase
max_nber_dep
"
);
/*
MAX_NUMBER_DEP
is too small */
if
(
k
==
MAX_NUMBER_DEP
)
error
(
"Not enough memory, please increase
MAX_NUMBER_DEP
"
);
}
}
...
...
@@ -419,18 +417,18 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
task_dependency_define
(
&
data_type
);
MPI_Op
sum
;
MPI_Op_create
(
task_dependency_sum
,
/* commute */
1
,
&
sum
);
MPI_Op_create
(
task_dependency_sum
,
/* commute */
1
,
&
sum
);
/* create recv buffer */
struct
task_dependency
*
recv
=
NULL
;
if
(
s
->
nodeID
==
0
)
{
recv
=
(
struct
task_dependency
*
)
malloc
(
nber_tasks
*
sizeof
(
struct
task_dependency
));
recv
=
(
struct
task_dependency
*
)
malloc
(
nber_tasks
*
sizeof
(
struct
task_dependency
));
/* reset counter */
for
(
int
i
=
0
;
i
<
nber_tasks
;
i
++
)
{
for
(
int
j
=
0
;
j
<
max_nber_dep
;
j
++
)
{
for
(
int
j
=
0
;
j
<
MAX_NUMBER_DEP
;
j
++
)
{
/* Use number_link as indicator of the existance of a relation */
recv
[
i
].
number_link
[
j
]
=
-
1
;
}
...
...
@@ -438,9 +436,9 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
}
/* Do the reduction */
int
test
=
MPI_Reduce
(
task_dep
,
recv
,
nber_tasks
,
data_type
,
sum
,
0
,
MPI_COMM_WORLD
);
if
(
test
!=
MPI_SUCCESS
)
error
(
"MPI reduce failed"
);
int
test
=
MPI_Reduce
(
task_dep
,
recv
,
nber_tasks
,
data_type
,
sum
,
0
,
MPI_COMM_WORLD
);
if
(
test
!=
MPI_SUCCESS
)
error
(
"MPI reduce failed"
);
/* free some memory */
if
(
s
->
nodeID
==
0
)
{
...
...
@@ -457,12 +455,13 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
/* Write header */
fprintf
(
f
,
"# %s
\n
"
,
git_revision
());
fprintf
(
f
,
fprintf
(
f
,
"task_in,task_out,implicit_in,implicit_out,mpi_in,mpi_out,cluster_in,"
"cluster_out,number_link,number_rank
\n
"
);
for
(
int
i
=
0
;
i
<
nber_tasks
;
i
++
){
for
(
int
j
=
0
;
j
<
max_nber_dep
;
j
++
)
{
for
(
int
i
=
0
;
i
<
nber_tasks
;
i
++
)
{
for
(
int
j
=
0
;
j
<
MAX_NUMBER_DEP
;
j
++
)
{
/* Does this link exists */
if
(
task_dep
[
i
].
number_link
[
j
]
==
-
1
)
{
continue
;
...
...
@@ -490,12 +489,10 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
/* Check if MPI */
int
ta_mpi
=
0
;
if
(
ta_type
==
task_type_send
||
ta_type
==
task_type_recv
)
ta_mpi
=
1
;
if
(
ta_type
==
task_type_send
||
ta_type
==
task_type_recv
)
ta_mpi
=
1
;
int
tb_mpi
=
0
;
if
(
tb_type
==
task_type_send
||
tb_type
==
task_type_recv
)
tb_mpi
=
1
;
if
(
tb_type
==
task_type_send
||
tb_type
==
task_type_recv
)
tb_mpi
=
1
;
/* Get group name */
char
ta_cluster
[
20
];
...
...
@@ -510,7 +507,6 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) {
}
/* Close the file */
fclose
(
f
);
}
/* Be clean */
...
...
src/task.c
View file @
0a9bb54a
...
...
@@ -619,8 +619,7 @@ void task_get_full_name(enum task_types type, enum task_subtypes subtype,
#ifdef SWIFT_DEBUG_CHECKS
/* Check input */
if
(
type
>=
task_type_count
)
error
(
"Unknown task type %i"
,
type
);
if
(
type
>=
task_type_count
)
error
(
"Unknown task type %i"
,
type
);
if
(
subtype
>=
task_subtype_count
)
error
(
"Unknown task subtype %i with type %s"
,
subtype
,
taskID_names
[
type
]);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment