Prepare arrows module
This commit is contained in:
parent
f98e51bf4a
commit
5862b207ce
|
@ -0,0 +1,24 @@
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
// Arrows management module //
|
||||||
|
// //
|
||||||
|
// Copyright © 2021 The Gem-graph Project //
|
||||||
|
// //
|
||||||
|
// This file is part of gem-graph. //
|
||||||
|
// //
|
||||||
|
// This program is free software: you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU Affero General Public License as //
|
||||||
|
// published by the Free Software Foundation, either version 3 of the //
|
||||||
|
// License, or (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU Affero General Public License for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU Affero General Public License //
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
|
#include "../include/base.h"
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
|
@ -41,7 +41,7 @@ void CenterRemove(Center_t *oldCenter)
|
||||||
register Center_t *prev;
|
register Center_t *prev;
|
||||||
register Center_t *next;
|
register Center_t *next;
|
||||||
|
|
||||||
printLog("Removing center %p\n", oldCenter);
|
//printLog("Removing center %p\n", oldCenter);
|
||||||
if (!oldCenter) return;
|
if (!oldCenter) return;
|
||||||
|
|
||||||
prev = oldCenter->prev;
|
prev = oldCenter->prev;
|
||||||
|
|
|
@ -43,7 +43,7 @@ pthread_t *WorkerInit(Worker_t *worker)
|
||||||
static void *LittleWorker(void *worker)
|
static void *LittleWorker(void *worker)
|
||||||
{
|
{
|
||||||
Worker_t *args;
|
Worker_t *args;
|
||||||
int a;
|
int a = rand()%__INT_MAX__;
|
||||||
|
|
||||||
args = (Worker_t*) worker;
|
args = (Worker_t*) worker;
|
||||||
printLog("Worker #%lu online\n", *args->id);
|
printLog("Worker #%lu online\n", *args->id);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define ARROW_NUMBER 150
|
#define ARROW_NUMBER 150
|
||||||
#define MAX_CYCLES 40000
|
#define MAX_CYCLES 400000
|
||||||
#define SPACE_SIZE 10000
|
#define SPACE_SIZE 10000
|
||||||
#define MAX_THREAD 0
|
#define MAX_THREAD 0
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ static void *GreatScheduler(void *scheduler)
|
||||||
args = (Scheduler_t*) scheduler;
|
args = (Scheduler_t*) scheduler;
|
||||||
printLog("Scheduler #%lu online\n", *args->id);
|
printLog("Scheduler #%lu online\n", *args->id);
|
||||||
|
|
||||||
ncpu = get_nprocs();
|
ncpu = get_nprocs() * 3;
|
||||||
printLog("%d CPUs available.\n", ncpu);
|
printLog("%d CPUs available.\n", ncpu);
|
||||||
|
|
||||||
// Data structures
|
// Data structures
|
||||||
|
@ -119,13 +119,13 @@ static void *GreatScheduler(void *scheduler)
|
||||||
|
|
||||||
// If a free area exists,
|
// If a free area exists,
|
||||||
if (workArea) {
|
if (workArea) {
|
||||||
printLog("A free workArea exists at %p\n", workArea);
|
//printLog("A free workArea exists at %p\n", workArea);
|
||||||
// preempt it,
|
// preempt it,
|
||||||
CenterAdd(centersList, workArea);
|
CenterAdd(centersList, workArea);
|
||||||
// find a worker socket,
|
// find a worker socket,
|
||||||
for (int i = 0; i < ncpu; i++) {
|
for (int i = 0; i < ncpu; i++) {
|
||||||
if (!workerArray[i].id) {
|
if (!workerArray[i].id) {
|
||||||
printLog("Adding worker at rank %d\n", i);
|
//printLog("Adding worker at rank %d\n", i);
|
||||||
// prepare the worker for the area,
|
// prepare the worker for the area,
|
||||||
workerArray[i].localWorkAreaCenter = workArea;
|
workerArray[i].localWorkAreaCenter = workArea;
|
||||||
// create the worker,
|
// create the worker,
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
// Arrows tests //
|
||||||
|
// //
|
||||||
|
// Copyright © 2021 The Gem-graph Project //
|
||||||
|
// //
|
||||||
|
// This file is part of gem-graph. //
|
||||||
|
// //
|
||||||
|
// This program is free software: you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU Affero General Public License as //
|
||||||
|
// published by the Free Software Foundation, either version 3 of the //
|
||||||
|
// License, or (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU Affero General Public License for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU Affero General Public License //
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
|
#include "../centers.c"
|
Loading…
Reference in New Issue