WIP: devel : travail du mois de mars/avril #28

Draft
neox wants to merge 24 commits from devel into devel_orig
1 changed files with 33 additions and 16 deletions
Showing only changes of commit 8b2f383409 - Show all commits

View File

@ -32,7 +32,10 @@ static int sched_new_id (void)
return id;
}
int sched_start (struct scheduler_t *self, struct parameters_t *parameters)
static int sched_run(struct scheduler_t *self,
struct parameters_t *parameters,
struct model_t *model)
{
int n_threads = omp_get_max_threads();
int n_arrows;
@ -43,14 +46,6 @@ int sched_start (struct scheduler_t *self, struct parameters_t *parameters)
bool pleaseStop;
struct worker_t **workers;
self->id = sched_new_id();
printlog("Hey, I'm the scheduler %d and I can work with %d threads !\n",
self->id,
n_threads);
workers = calloc(n_threads, sizeof(struct worker_t*));
//XXX
n_arrows = 10000000000;
max_cycles = 1;
@ -70,15 +65,8 @@ int sched_start (struct scheduler_t *self, struct parameters_t *parameters)
thread_num = omp_get_thread_num();
while (!pleaseStop) {
/* n_workers++; */
/* if (n_workers > max_workers) { */
/* pleaseStop = true; */
/* } */
workers[thread_num] = calloc(1, sizeof(struct worker_t));
workers[thread_num]->id = n_workers;
worker_start(workers[thread_num], self);
free(workers[thread_num]);
}
}
@ -88,3 +76,32 @@ int sched_start (struct scheduler_t *self, struct parameters_t *parameters)
return SCHED_NORMAL_EXIT;
}
int sched_start (struct scheduler_t *self, struct parameters_t *parameters)
{
int n_threads = omp_get_max_threads();
int n_arrows;
int n_workers;
int workers_per_cycle;
int max_cycles;
int max_workers;
bool pleaseStop;
struct worker_t **workers;
self->id = sched_new_id();
printlog("Hey, I'm the scheduler %d and I can work with %d threads !\n",
self->id,
n_threads);
workers = calloc(n_threads, sizeof(struct worker_t*));
for (int i = 0; i < n_threads; i++) {
workers[thread_num] = calloc(1, sizeof(struct worker_t));
}
sched_run(self, parameters, NULL);
for (int i = 0; i < n_threads; i++) {
free(workers[thread_num]);
}
}