Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
batsched
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
poquet
millian
batsched
Commits
3b4730a0
Commit
3b4730a0
authored
1 year ago
by
karim.moussaoui
Browse files
Options
Downloads
Patches
Plain Diff
Update main.cpp, parsing,ajout du type carbon_co2... : Fait par Karim/Adem
parent
06530205
No related branches found
No related tags found
No related merge requests found
Pipeline
#8636
failed
1 year ago
Stage: big_stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.cpp
+28
-7
28 additions, 7 deletions
src/main.cpp
with
28 additions
and
7 deletions
src/main.cpp
+
28
−
7
View file @
3b4730a0
...
@@ -23,14 +23,14 @@
...
@@ -23,14 +23,14 @@
#include
"algo/fcfs.hpp"
#include
"algo/fcfs.hpp"
#include
"algo/rejecter.hpp"
#include
"algo/rejecter.hpp"
#include
"algo/sequencer.hpp"
#include
"algo/sequencer.hpp"
#include
"algo/psc.hpp"
// Inclusion de l'algorithme Psc
#include
"algo/carbone.hpp"
using
namespace
std
;
using
namespace
std
;
using
namespace
boost
;
using
namespace
boost
;
namespace
n
=
network
;
namespace
n
=
network
;
namespace
r
=
rapidjson
;
namespace
r
=
rapidjson
;
//Modification : Karim/Adem
void
run
(
Network
&
n
,
ISchedulingAlgorithm
*
algo
,
SchedulingDecision
&
d
,
void
run
(
Network
&
n
,
ISchedulingAlgorithm
*
algo
,
SchedulingDecision
&
d
,
Workload
&
workload
,
bool
call_make_decisions_on_single_nop
=
true
);
Workload
&
workload
,
bool
call_make_decisions_on_single_nop
=
true
);
...
@@ -56,13 +56,12 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision &d,
...
@@ -56,13 +56,12 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision &d,
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
const
set
<
string
>
variants_set
=
{
"easy_bf"
,
"fcfs"
,
"rejecter"
,
"sequencer"
,
"
psc"
};
// Ajout de Psc
const
set
<
string
>
variants_set
=
{
"easy_bf"
,
"fcfs"
,
"rejecter"
,
"sequencer"
,
"
carbone"
};
const
set
<
string
>
policies_set
=
{
"basic"
,
"contiguous"
};
const
set
<
string
>
policies_set
=
{
"basic"
,
"contiguous"
};
const
set
<
string
>
queue_orders_set
=
{
"fcfs"
,
"lcfs"
,
"desc_bounded_slowdown"
,
"desc_slowdown"
,
const
set
<
string
>
queue_orders_set
=
{
"fcfs"
,
"lcfs"
,
"desc_bounded_slowdown"
,
"desc_slowdown"
,
"asc_size"
,
"desc_size"
,
"asc_walltime"
,
"desc_walltime"
};
"asc_size"
,
"desc_size"
,
"asc_walltime"
,
"desc_walltime"
};
const
set
<
string
>
verbosity_levels_set
=
{
"debug"
,
"info"
,
"quiet"
,
"silent"
};
const
set
<
string
>
verbosity_levels_set
=
{
"debug"
,
"info"
,
"quiet"
,
"silent"
};
const
string
variants_string
=
"{"
+
boost
::
algorithm
::
join
(
variants_set
,
", "
)
+
"}"
;
const
string
variants_string
=
"{"
+
boost
::
algorithm
::
join
(
variants_set
,
", "
)
+
"}"
;
const
string
policies_string
=
"{"
+
boost
::
algorithm
::
join
(
policies_set
,
", "
)
+
"}"
;
const
string
policies_string
=
"{"
+
boost
::
algorithm
::
join
(
policies_set
,
", "
)
+
"}"
;
const
string
queue_orders_string
=
"{"
+
boost
::
algorithm
::
join
(
queue_orders_set
,
", "
)
+
"}"
;
const
string
queue_orders_string
=
"{"
+
boost
::
algorithm
::
join
(
queue_orders_set
,
", "
)
+
"}"
;
...
@@ -243,9 +242,8 @@ int main(int argc, char ** argv)
...
@@ -243,9 +242,8 @@ int main(int argc, char ** argv)
algo
=
new
Rejecter
(
&
w
,
&
decision
,
queue
,
selector
,
rjms_delay
,
&
json_doc_variant_options
);
algo
=
new
Rejecter
(
&
w
,
&
decision
,
queue
,
selector
,
rjms_delay
,
&
json_doc_variant_options
);
else
if
(
scheduling_variant
==
"sequencer"
)
else
if
(
scheduling_variant
==
"sequencer"
)
algo
=
new
Sequencer
(
&
w
,
&
decision
,
queue
,
selector
,
rjms_delay
,
&
json_doc_variant_options
);
algo
=
new
Sequencer
(
&
w
,
&
decision
,
queue
,
selector
,
rjms_delay
,
&
json_doc_variant_options
);
else
if
(
scheduling_variant
==
"psc"
)
// Ajout de psc
else
if
(
scheduling_variant
==
"carbone"
)
algo
=
new
Psc
(
&
w
,
&
decision
,
queue
,
selector
,
rjms_delay
,
&
json_doc_variant_options
);
algo
=
new
CarboneAlgorithm
(
&
w
,
&
decision
,
queue
,
selector
,
rjms_delay
,
&
json_doc_variant_options
);
// Network
// Network
Network
n
;
Network
n
;
n
.
bind
(
socket_endpoint
);
n
.
bind
(
socket_endpoint
);
...
@@ -316,6 +314,7 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
...
@@ -316,6 +314,7 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
current_date
=
event_object
[
"timestamp"
].
GetDouble
();
current_date
=
event_object
[
"timestamp"
].
GetDouble
();
const
r
::
Value
&
event_data
=
event_object
[
"data"
];
const
r
::
Value
&
event_data
=
event_object
[
"data"
];
if
(
event_type
==
"SIMULATION_BEGINS"
)
if
(
event_type
==
"SIMULATION_BEGINS"
)
{
{
int
nb_resources
;
int
nb_resources
;
...
@@ -444,6 +443,28 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
...
@@ -444,6 +443,28 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
}
}
}
}
else
if
(
event_type
==
"carbon_co2"
)
{
int
val_dcA
=
0
,
val_dcB
=
0
,
val_dcC
=
0
;
// Initialisation
if
(
event_data
.
HasMember
(
"some_field_dcA"
))
{
val_dcA
=
event_data
[
"some_field_dcA"
].
GetInt
();
}
if
(
event_data
.
HasMember
(
"another_field_dcB"
))
{
val_dcB
=
event_data
[
"another_field_dcB"
].
GetInt
();
}
if
(
event_data
.
HasMember
(
"additional_field_dcC"
))
{
val_dcC
=
event_data
[
"additional_field_dcC"
].
GetInt
();
}
CarboneAlgorithm
*
carboneAlgo
=
dynamic_cast
<
CarboneAlgorithm
*>
(
algo
);
if
(
carboneAlgo
!=
nullptr
)
{
carboneAlgo
->
updateCarbonFootprint
(
val_dcA
,
val_dcB
,
val_dcC
);
}
else
{
std
::
cerr
<<
"Erreur : l'algorithme en cours n'est pas une instance de CarboneAlgorithm."
<<
std
::
endl
;
}
}
else
else
{
{
throw
runtime_error
(
"Unknown event received. Type = "
+
event_type
);
throw
runtime_error
(
"Unknown event received. Type = "
+
event_type
);
...
...
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