From be75fd6627a1a6070e8e68b70b860bec736370e2 Mon Sep 17 00:00:00 2001 From: jzhou Date: Fri, 29 May 2009 01:15:25 +0000 Subject: [PATCH] add math operations for multicore version --- Robust/src/IR/Flat/BuildCode.java | 5 - Robust/src/IR/Flat/BuildCodeMultiCore.java | 2 +- Robust/src/Runtime/math.c | 141 --------------------- Robust/src/Runtime/multicoretask.c | 2 +- Robust/src/buildscript | 1 + 5 files changed, 3 insertions(+), 148 deletions(-) diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 93b2228f..9c75c336 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -447,11 +447,6 @@ public class BuildCode { Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); while(classit.hasNext()) { ClassDescriptor cn=(ClassDescriptor)classit.next(); - if(state.MULTICORE) { - if(cn.getSymbol().equals("Math")) { - continue; - } - } Iterator methodit=cn.getMethods(); while(methodit.hasNext()) { /* Classify parameters */ diff --git a/Robust/src/IR/Flat/BuildCodeMultiCore.java b/Robust/src/IR/Flat/BuildCodeMultiCore.java index d058c95f..afd4a7c2 100644 --- a/Robust/src/IR/Flat/BuildCodeMultiCore.java +++ b/Robust/src/IR/Flat/BuildCodeMultiCore.java @@ -662,7 +662,7 @@ public class BuildCodeMultiCore extends BuildCode { } else { output.println("tprintf(\"Process %x(%d): task %s\\n\", corenum, corenum, \"" + task.getSymbol() + "\");"); } - output.println("BAMBOO_DEBUGPRINT((int)BAMBOO_GET_EXE_TIME());"); + output.println("BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME());"); output.println("#endif"); output.println("#ifdef DEBUG"); if(this.state.RAW) { diff --git a/Robust/src/Runtime/math.c b/Robust/src/Runtime/math.c index e450d09e..183fb6b8 100644 --- a/Robust/src/Runtime/math.c +++ b/Robust/src/Runtime/math.c @@ -1,220 +1,79 @@ #include "runtime.h" -#ifdef MULTICORE -#ifdef RAW #include "math.h" -#endif -#else -#include "math.h" -#endif #include "structdefs.h" -#ifndef MULTICORE double CALL11(___Math______cos____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return cos(___a___); -#endif -#else return cos(___a___); -#endif } double CALL11(___Math______sin____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return sin(___a___); -#endif -#else return sin(___a___); -#endif } double CALL11(___Math______tan____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW return tan(___a___); -#endif -#else - return tan(___a___); -#endif } double CALL11(___Math______acos____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return acos(___a___); -#endif -#else return acos(___a___); -#endif } double CALL11(___Math______asin____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW return asin(___a___); -#endif -#else - return asin(___a___); -#endif } double CALL11(___Math______atan____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return atan(___a___); -#endif -#else return atan(___a___); -#endif } double CALL22(___Math______atan2____D_D, double ___a___, double ___b___, double ___a___, double ___b___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return atan2(___a___,___b___); -#endif -#else return atan2(___a___,___b___); -#endif } double CALL11(___Math______log____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW return log(___a___); -#endif -#else - return log(___a___); -#endif } double CALL11(___Math______exp____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return exp(___a___); -#endif -#else return exp(___a___); -#endif } double CALL11(___Math______sqrt____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return -1; -#ifdef RAW return sqrt(___a___); -#endif -#else - return sqrt(___a___); -#endif } double CALL22(___Math______pow____D_D, double ___a___, double ___b___, double ___a___, double ___b___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return pow(___a___); -#endif -#else return pow(___a___,___b___); -#endif } double CALL11(___Math______ceil____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return ceil(___a___); -#endif -#else return ceil(___a___); -#endif } double CALL11(___Math______floor____D, double ___a___, double ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return floor(___a___); -#endif -#else return floor(___a___); -#endif } float CALL11(___Math______cosf____F, float ___a___, float ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW return cosf(___a___); -#endif -#else - return cosf(___a___); -#endif } float CALL11(___Math______sinf____F, float ___a___, float ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return sinf(___a___); -#endif -#else return sinf(___a___); -#endif } float CALL11(___Math______expf____F, float ___a___, float ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW return expf(___a___); -#endif -#else - return expf(___a___); -#endif } float CALL11(___Math______sqrtf____F, float ___a___, float ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return sqrtf(___a___); -#endif -#else return sqrtf(___a___); -#endif } float CALL11(___Math______logf____F, float ___a___, float ___a___) { -#ifdef MULTICORE - return 1; -#ifdef RAW return logf(___a___); -#endif -#else - return logf(___a___); -#endif } float CALL22(___Math______powf____F_F, float ___a___, float ___b___, float ___a___, float ___b___) { -#ifdef MULTICORE - return 1; -#ifdef RAW - return powf(___a___,___b___); -#endif -#else return powf(___a___,___b___); -#endif } -#endif diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index c421e13a..44e910a7 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -386,7 +386,7 @@ inline void run(void * arg) { totalexetime = BAMBOO_GET_EXE_TIME(); #else BAMBOO_DEBUGPRINT(0xbbbbbbbb); - BAMBOO_DEBUGPRINT((int)BAMBOO_GET_EXE_TIME()); + BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME()); #endif // profile mode, send msgs to other cores to request pouring // out progiling data diff --git a/Robust/src/buildscript b/Robust/src/buildscript index c0c6f936..9236c4ab 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -563,6 +563,7 @@ cp ../Runtime/runtime.h ./ cp ../Runtime/SimpleHash.h ./ cp ../Tilera/Runtime/*.c ./ cp ../Tilera/Runtime/*.h ./ +cp ../Tilera/lib/* ./ cp ../tmpbuilddirectory/*.c ./ cp ../tmpbuilddirectory/*.h ./ -- 2.34.1