Mercurial > hg > Gears > Gears
changeset 898:04edc3e392bc
?
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2021 17:32:42 +0900 |
parents | 70016b1cd1e2 |
children | d24f24e942de |
files | src/parallel_execution/MCWorker.h src/parallel_execution/ModelChecking/MCWorker.cbc src/parallel_execution/examples/DPPMC/meta.pm src/parallel_execution/lib/Gears/Template/Context.pm |
diffstat | 4 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/MCWorker.h Tue Jan 26 15:45:50 2021 +0900 +++ b/src/parallel_execution/MCWorker.h Tue Jan 26 17:32:42 2021 +0900 @@ -1,3 +1,5 @@ +#include "ModelChecking/state_db.h" + typedef struct MCWorker <> { pthread_mutex_t mutex; pthread_cond_t cond; @@ -7,4 +9,6 @@ struct Queue* mcQueue; enum Code nextStep; struct Context* mcContext; + StateDB state; + StateNode st; } MCWorker;
--- a/src/parallel_execution/ModelChecking/MCWorker.cbc Tue Jan 26 15:45:50 2021 +0900 +++ b/src/parallel_execution/ModelChecking/MCWorker.cbc Tue Jan 26 17:32:42 2021 +0900 @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> +#include "state_db.h" #interface "TaskManager.h" #interface "Worker.h" @@ -13,6 +14,7 @@ extern int lengthSingleLinkedQueue(struct SingleLinkedQueue* queue); extern Element* getElementByIdx(struct SingleLinkedQueue* queue, int idx); + Worker* createMCWorker(struct Context* context, int id, Queue* queue) { struct Worker* worker = new Worker(); struct MCWorker* mcWorker = new MCWorker(); @@ -21,6 +23,7 @@ worker->tasks = queue; mcWorker->id = id; mcWorker->mcContext = NULL; + mcWorker->state = NULL; mcWorker->loopCounter = 0; mcWorker->nextStep = C_startModelChecker; worker->taskReceive = C_taskReceiveMCWorker; @@ -57,11 +60,12 @@ goto meta(ncontext, ncontext->next); } -#define __ncode __code - __ncode mcMeta(struct Context* context, enum Code next) { + StateDB out; struct MCWorker* mcworker = (struct MCWorker*) context->worker->worker; + if (lookup_StateDB(&mcworker->st, &mcworker->state, &out)) { + } context->next = next; goto meta(mcworker->context, mcworker->nextStep); }
--- a/src/parallel_execution/examples/DPPMC/meta.pm Tue Jan 26 15:45:50 2021 +0900 +++ b/src/parallel_execution/examples/DPPMC/meta.pm Tue Jan 26 17:32:42 2021 +0900 @@ -5,12 +5,16 @@ sub replaceMeta { return ( [qr/PhilsImpl/ => \&generateMcMeta], - #[qr/.+/ => \&all], ); } #my ($currentCodeGearName, $context, $next) = @_; +sub generateRondomMeta { + my ($context, $next) = @_; + return "goto rondom($context, $next);"; +} + sub generateMcMeta { my ($context, $next) = @_; return "goto mcMeta($context, $next);";
--- a/src/parallel_execution/lib/Gears/Template/Context.pm Tue Jan 26 15:45:50 2021 +0900 +++ b/src/parallel_execution/lib/Gears/Template/Context.pm Tue Jan 26 17:32:42 2021 +0900 @@ -17,6 +17,8 @@ #include "helper_cuda.h" #endif +#define __ncode __code + #define ALLOCATE_SIZE 20000000 #define NEW(type) (type*)(calloc(1, sizeof(type))) #define NEWN(n, type) (type*)(calloc(n, sizeof(type)))