changeset 1031:2caac93dee00

try to compile each app independentry. move context.h to c-twice/context.h
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 24 Oct 2023 12:15:07 +0900
parents c0cff89bb044
children 793b21a8ea12
files src/parallel_execution/AtomicReference.cbc src/parallel_execution/AtomicTImpl.cbc src/parallel_execution/CMakeLists.txt src/parallel_execution/CPUWorker.cbc src/parallel_execution/CUDAExecutor.cbc src/parallel_execution/CUDAWorker.cbc src/parallel_execution/DebugTaskManagerImpl.cbc src/parallel_execution/EntryTree.cbc src/parallel_execution/FileSystemTree.cbc src/parallel_execution/LockImpl.cbc src/parallel_execution/MCTaskManagerImpl.cbc src/parallel_execution/MultiDimIterator.cbc src/parallel_execution/RedBlackTree.cbc src/parallel_execution/RedBlackTreeReWright.cbc src/parallel_execution/SemaphoreImpl.cbc src/parallel_execution/SingleLinkedQueue.cbc src/parallel_execution/SingleLinkedStack.cbc src/parallel_execution/SpinLock.cbc src/parallel_execution/SynchronizedQueue.cbc src/parallel_execution/TaskIterator.cbc src/parallel_execution/TaskManagerImpl.cbc src/parallel_execution/TimerImpl.cbc src/parallel_execution/cleanup.sh src/parallel_execution/examples/twice/createArray.cbc src/parallel_execution/examples/twice/main.cbc src/parallel_execution/examples/twice/printArray.cbc src/parallel_execution/examples/twice/twice.cbc src/parallel_execution/generate_context.pl src/parallel_execution/generate_stub.pl src/parallel_execution/lib/Gears/Template/Context.pm
diffstat 30 files changed, 50 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/AtomicReference.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/AtomicReference.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Atomic.h"
 #include <stdio.h>
 
--- a/src/parallel_execution/AtomicTImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/AtomicTImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #impl "AtomicT.h" as "AtomicTImpl.h"
 #include <stdio.h>
 
--- a/src/parallel_execution/CMakeLists.txt	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/CMakeLists.txt	Tue Oct 24 12:15:07 2023 +0900
@@ -27,18 +27,20 @@
     set( _ONE_VALUE_ARGS TARGET )
     set( _MULTI_VALUE_ARGS SOURCES )
     cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+    set(DDIR "c-${_Gears_TARGET}")
+    add_definitions("-I ${DDIR}")
 
     set (_Gears_CSOURCES)
     foreach(i ${_Gears_SOURCES})
         if (${i} MATCHES "\\.cbc")
-            string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i})
+            string(REGEX REPLACE "(.*).cbc" "${DDIR}/\\1.c" j ${i})
             add_custom_command (
                 OUTPUT    ${j}
                 DEPENDS   ${i}
                 COMMAND  "perl" "generate_stub.pl" "-o" ${j} ${i}
             )
         elseif (${i} MATCHES "\\.cu")
-            string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i})
+            string(REGEX REPLACE "(.*).cu" "${DDIR}/\\1.ptx" j ${i})
             add_custom_command (
                 OUTPUT    ${j}
                 DEPENDS   ${i}
@@ -51,11 +53,11 @@
     endforeach(i)
 
     add_custom_command (
-          OUTPUT    c/${_Gears_TARGET}-context.c
+          OUTPUT    ${DDIR}/${_Gears_TARGET}-context.c
           DEPENDS   ${_Gears_CSOURCES}
-          COMMAND  "perl" "generate_context.pl" "-o" ${_Gears_TARGET} "-w" ${_Gears_CSOURCES}
+          COMMAND  "perl" "generate_context.pl" "-c" "${DDIR}" "-o" ${_Gears_TARGET} "-w" ${_Gears_CSOURCES}
     )
-    add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c)
+    add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} ${DDIR}/${_Gears_TARGET}-context.c)
     target_link_libraries(${_Gears_TARGET} m pthread)
 endmacro()
 
--- a/src/parallel_execution/CPUWorker.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/CPUWorker.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "TaskManager.h"
 #interface "Worker.h"
 #interface "Iterator.h"
--- a/src/parallel_execution/CUDAExecutor.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/CUDAExecutor.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Executor.h"
 #interface "Timer.h"
 #include <stdio.h>
--- a/src/parallel_execution/CUDAWorker.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/CUDAWorker.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "TaskManager.h"
 #interface "Worker.h"
 #interface "Iterator.h"
--- a/src/parallel_execution/DebugTaskManagerImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/DebugTaskManagerImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "TaskManager.h"
 #interface "Iterator.h"
 #interface "Queue.h" 
--- a/src/parallel_execution/EntryTree.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/EntryTree.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-#include "../context.h"
+#include "context.h"
 #interface "ETree.h"
 #interface "Stack.h"
 
--- a/src/parallel_execution/FileSystemTree.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/FileSystemTree.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-#include "../context.h"
+#include "context.h"
 #interface "FTree.h"
 #interface "Stack.h"
 
--- a/src/parallel_execution/LockImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/LockImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Queue.h"
 #interface "Atomic.h"
 #interface "Lock.h"
--- a/src/parallel_execution/MCTaskManagerImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/MCTaskManagerImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "TaskManager.h"
 #interface "Iterator.h"
 #interface "Queue.h" 
--- a/src/parallel_execution/MultiDimIterator.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/MultiDimIterator.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Iterator.h"
 #interface "TaskManager.h"
 #include <stdio.h>
--- a/src/parallel_execution/RedBlackTree.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/RedBlackTree.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-#include "../context.h"
+#include "context.h"
 #interface "Tree.h"
 #interface "Stack.h"
 
--- a/src/parallel_execution/RedBlackTreeReWright.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/RedBlackTreeReWright.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,7 +1,7 @@
 #include <stdio.h>
 
-#include "../context.h"
-#include "../compare.c"
+#include "context.h"
+#include "compare.c"
 #interface "Tree.h"
 #interface "Stack.h"
 
--- a/src/parallel_execution/SemaphoreImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/SemaphoreImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "semaphore.h"
 
 Semaphore* createSemaphoreImpl(struct Context* context, int n) {
--- a/src/parallel_execution/SingleLinkedQueue.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/SingleLinkedQueue.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #include <stdio.h>
 #impl "Queue.h" as "SingleLinkedQueue.h"
 #data "Node.h"
--- a/src/parallel_execution/SingleLinkedStack.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/SingleLinkedStack.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #include <stdio.h>
 
 #impl "Stack.h" as "SingleLinkedStack.h"
--- a/src/parallel_execution/SpinLock.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/SpinLock.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Atomic.h"
 #interface "Lock.h"
 
--- a/src/parallel_execution/SynchronizedQueue.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/SynchronizedQueue.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Queue.h"
 #interface "Atomic.h"
 
--- a/src/parallel_execution/TaskIterator.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/TaskIterator.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "Iterator.h"
 #include <stdio.h>
 
--- a/src/parallel_execution/TaskManagerImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/TaskManagerImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../context.h"
+#include "context.h"
 #interface "TaskManager.h"
 #interface "Iterator.h"
 #interface "Queue.h"
--- a/src/parallel_execution/TimerImpl.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/TimerImpl.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <sys/time.h>
 
-#include "../context.h"
+#include "context.h"
 #interface "Timer.h"
 
 Timer* createTimerImpl(struct Context* context) {
--- a/src/parallel_execution/cleanup.sh	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/cleanup.sh	Tue Oct 24 12:15:07 2023 +0900
@@ -5,3 +5,4 @@
 if [ -n "$cfiles" ]; then
   echo $cfiles | xargs rm
 fi
+rm -rf c-*/
--- a/src/parallel_execution/examples/twice/createArray.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/examples/twice/createArray.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include "../../../context.h"
+#include "context.h"
 #interface "Timer.h"
 
 extern int length;
--- a/src/parallel_execution/examples/twice/main.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/examples/twice/main.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "../../../context.h"
+#include "context.h"
 #interface "TaskManager.h"
 
 int cpu_num = 1;
--- a/src/parallel_execution/examples/twice/printArray.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/examples/twice/printArray.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,4 +1,4 @@
-#include "../../../context.h"
+#include "context.h"
 #interface "Timer.h"
 #include <stdio.h>
 
--- a/src/parallel_execution/examples/twice/twice.cbc	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/examples/twice/twice.cbc	Tue Oct 24 12:15:07 2023 +0900
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-#include "../../../context.h"
+#include "context.h"
 
 #ifdef USE_CUDAWorker
 extern void cudaLoadFunction(struct Context* context, char* filename, char* function);
--- a/src/parallel_execution/generate_context.pl	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/generate_context.pl	Tue Oct 24 12:15:07 2023 +0900
@@ -54,7 +54,7 @@
 our($opt_o,$opt_d,$opt_h,$opt_w, $opt_project,$opt_D);
 GetOptions(
     "o=s"       => \$opt_o,
-    "d=s"       => \$opt_d,
+    "c=s"       => \$opt_d,    # d=s conflict with -D 
     "h"         => \$opt_h,
     "w"         => \$opt_w,
     "D"         => \$opt_D,
@@ -94,15 +94,15 @@
 
 if (! $opt_w) {
       generateContextHeader("stdout", $opt_o, $project, @ARGV);
-} elsif (-f  "context.h") {
-      generateContextHeader("context.h-new", $opt_o, $project, @ARGV);
-      if (system("cmp -s context.h context.h-new")) {
-          rename "context.h-new","context.h";
+} elsif (-f  "$ddir/context.h") {
+      generateContextHeader("$ddir/context.h-new", $opt_o, $project, @ARGV);
+      if (system("cmp -s $ddir/context.h $ddir/context.h-new")) {
+          rename "$ddir/context.h-new","$ddir/context.h";
       } else {
-          unlink "context.h-new";
+          unlink "$ddir/context.h-new";
       }
 } else  {
-      generateContextHeader("context.h", $opt_o, $project, @ARGV);
+      generateContextHeader("$ddir/context.h", $opt_o, $project, @ARGV);
 }
 
 
@@ -144,7 +144,7 @@
     }
     close $fd;
 
-    open my $cx,"<","context.h" or die("can't open context.h $!");
+    open my $cx,"<","$ddir/context.h" or die("can't open context.h $!");
     my $inUnionData = 0;
     while (<$cx>) {
         if (! $inUnionData) {
@@ -231,7 +231,7 @@
 
 $context_c .= << "EOFEOF";
 
-#include "../context.h"
+#include "context.h"
 
 void initContext(struct Context* $context_name) {
     ${context_name}\->heapLimit = sizeof(union Data)*ALLOCATE_SIZE;
--- a/src/parallel_execution/generate_stub.pl	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/generate_stub.pl	Tue Oct 24 12:15:07 2023 +0900
@@ -639,6 +639,7 @@
         }
     }
     open my $fd,">",$fn or die("can't write $fn $!");
+    print $fh "#include \"context.h\"\n";
 
     my $prevCodeGearName;
     my $inTypedef  = 0;
--- a/src/parallel_execution/lib/Gears/Template/Context.pm	Mon Oct 16 18:19:31 2023 +0900
+++ b/src/parallel_execution/lib/Gears/Template/Context.pm	Tue Oct 24 12:15:07 2023 +0900
@@ -108,9 +108,9 @@
 
 #define GearImpl(context, intf, name) (Gearef(context, intf)->name->intf.name)
 
-#include "c/enumCode.h"
-#include "ModelChecking/memory.h"
-#include "ModelChecking/state_db.h"
+#include "enumCode.h"
+#include "../ModelChecking/memory.h"
+#include "../ModelChecking/state_db.h"
 
 enum Relational {
     EQ,
@@ -118,7 +118,7 @@
     LT,
 };
 
-#include "c/enumData.h"
+#include "enumData.h"
 EOFEOF
   print $out $str;
 }
@@ -163,7 +163,7 @@
 #ifndef USE_CUDAWorker
 typedef unsigned long long CUdeviceptr;
 #endif
-#include "c/typedefData.h"
+#include "typedefData.h"
 EOFEOF
     print $out $str;
 }
@@ -195,7 +195,7 @@
   my($class, $out) = @_;
   print $out <<'EOF';
 
-#include "c/extern.h"
+#include "extern.h"
 
 extern __code start_code(struct Context* context);
 extern __code exit_code(struct Context* context);