Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PARSEC] Graphite setup scripts for PARSEC 2.1 & 3.0
- Loading branch information
George Kurian
committed
Dec 15, 2012
1 parent
6066f54
commit 0b7f8fd
Showing
14 changed files
with
660 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
diff --git a/pkgs/apps/freqmine/src/data.cpp b/pkgs/apps/freqmine/src/data.cpp | |||
index aa1454b..7c82fc3 100644 | |||
--- a/pkgs/apps/freqmine/src/data.cpp | |||
+++ b/pkgs/apps/freqmine/src/data.cpp | |||
@@ -9,9 +9,9 @@ Contents : data set management | |||
Data::Data(char *filename) | |||
{ | |||
#ifndef BINARY | |||
- in = fopen(filename,"r+t"); | |||
+ in = fopen(filename,"rt"); | |||
#else | |||
- in = fopen(filename, "r+b"); | |||
+ in = fopen(filename, "rb"); | |||
#endif | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
diff --git a/config/gcc.bldconf b/config/gcc.bldconf | |||
index 890efbb..3481aeb 100644 | |||
--- a/config/gcc.bldconf | |||
+++ b/config/gcc.bldconf | |||
@@ -39,9 +39,9 @@ case "${OSTYPE}" in | |||
# Linux + default case | |||
|
|||
# CC_HOME is installation root of the C compiler | |||
- export CC_HOME="/n/fs/parsec/local/gcc-4.4.0-static" | |||
+ export CC_HOME="/usr" | |||
# BINUTIL_HOME is installation root of the GNU binutils | |||
- export BINUTIL_HOME="/usr/local" | |||
+ export BINUTIL_HOME="/usr" | |||
# GNUTOOL_HOME is installation root of the GNU tools | |||
export GNUTOOL_HOME="/usr" | |||
# BINARY_PREFIX is the string which is used as prefix for the GNU binaries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
diff --git a/config/graphite.bldconf b/config/graphite.bldconf | |||
index 8452c42..12ad93c 100644 | |||
--- a/config/graphite.bldconf | |||
+++ b/config/graphite.bldconf | |||
@@ -1,5 +1,12 @@ | |||
#!/bin/bash | |||
- | |||
-# graphite.bldconf - configuration file for PARSEC | |||
+# | |||
+# graphite.bldconf - file containing global information necessary to build | |||
+# PARSEC with the Graphite multicore simulator | |||
|
|||
source ${PARSECDIR}/config/gcc-hooks.bldconf | |||
+ | |||
+# Enable PARSEC hooks | |||
+CFLAGS="${CFLAGS} -DENABLE_GRAPHITE -I${GRAPHITE_HOME}/common/user" | |||
+CXXFLAGS="${CXXFLAGS} -DENABLE_GRAPHITE -I${GRAPHITE_HOME}/common/user" | |||
+LDFLAGS="${LDFLAGS} -static -u CarbonStartSim -u CarbonStopSim -u pthread_create -u pthread_join -L${GRAPHITE_HOME}/lib -L${GRAPHITE_HOME}/contrib/dsent" | |||
+LIBS="${LIBS} -lcarbon_sim -ldsent_contrib -lboost_filesystem-mt -lboost_system-mt -lpthread -lstdc++ -lm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,54 @@ | |||
diff --git a/pkgs/libs/hooks/src/config.h b/pkgs/libs/hooks/src/config.h | |||
index 0cff79a..33948c3 100644 | |||
--- a/pkgs/libs/hooks/src/config.h | |||
+++ b/pkgs/libs/hooks/src/config.h | |||
@@ -131,7 +131,20 @@ | |||
#include "/opt/PTLsim/ptlcalls.h" | |||
#endif | |||
|
|||
- | |||
+/** \brief Run Graphite simulator models only in ROI | |||
+ * | |||
+ * If this macro is set to 1, then CarbonEnableModels() is called at the | |||
+ * start of the region-of-interest (ROI) and CarbonDisableModels() at the end of | |||
+ * it, so just the ROI in the program is modeled. For most parallel | |||
+ * benchmarking purposes, the ROI is the parallel part of the program. | |||
+ * | |||
+ * This functionality is disabled by default and must be enabled using | |||
+ * a compile-time macro (using -DENABLE_GRAPHITE). | |||
+ */ | |||
+/* Path to the include file */ | |||
+#ifdef ENABLE_GRAPHITE | |||
+#include "carbon_user.h" | |||
+#endif | |||
|
|||
/** \brief Prefix for all output. | |||
* | |||
diff --git a/pkgs/libs/hooks/src/hooks.c b/pkgs/libs/hooks/src/hooks.c | |||
index 9658425..5c878f7 100644 | |||
--- a/pkgs/libs/hooks/src/hooks.c | |||
+++ b/pkgs/libs/hooks/src/hooks.c | |||
@@ -195,6 +195,11 @@ void __parsec_roi_begin() { | |||
#if ENABLE_PTLSIM_TRIGGER | |||
ptlcall_switch_to_sim(); | |||
#endif //ENABLE_PTLSIM_TRIGGER | |||
+ | |||
+ // Graphite Enable Models | |||
+ #ifdef ENABLE_GRAPHITE | |||
+ CarbonEnableModels(); | |||
+ #endif | |||
} | |||
|
|||
|
|||
@@ -221,6 +226,11 @@ void __parsec_roi_end() { | |||
time_end = (double)t.tv_sec+(double)t.tv_usec*1e-6; | |||
#endif //ENABLE_TIMING | |||
|
|||
+ // Graphite Disable Models | |||
+ #ifdef ENABLE_GRAPHITE | |||
+ CarbonDisableModels(); | |||
+ #endif | |||
+ | |||
printf(HOOKS_PREFIX" Leaving ROI\n"); | |||
fflush(NULL); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
#!/bin/bash | |||
cd pkgs/apps | |||
for f in blackscholes bodytrack ferret fluidanimate freqmine raytrace vips x264 | |||
do | |||
cd $f | |||
mkdir run | |||
cd run | |||
tar xvf ../inputs/input_simmedium.tar | |||
cd ../.. | |||
done | |||
cd ../kernels | |||
for f in canneal dedup | |||
do | |||
cd $f | |||
mkdir run | |||
cd run | |||
tar xvf ../inputs/input_simmedium.tar | |||
cd ../.. | |||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
#!/bin/bash | |||
|
|||
# Edit gcc.bldconf to set correct paths for CC_HOME and BINUTIL_HOME | |||
echo "[BLDCONF] Editing gcc.bldconf with correct paths for CC_HOME and BINUTIL_HOME" | |||
patch -p1 < setup_parsec_2.1/gcc_bldconf.patch | |||
|
|||
# Populate the PARSEC directories with the build configuration needed | |||
# for Graphite. The configuration is derived from gcc-hooks because | |||
# we would like to have the option to simulate just the parallel | |||
# portion of the benchmark. This command just creates the relevant | |||
# files, the actual compiler and linker flags are put in later | |||
echo "[BLDCONF] Populating PARSEC directories with graphite.bldconf" | |||
./bin/bldconfadd -n graphite -s gcc-hooks -f | |||
|
|||
# Build the tools (yasm,cmake,libtool). These tools are built in | |||
# advance so that they need not be built during the time of | |||
# building & running the benchmarks. | |||
echo "[BUILD] Building tools (yasm, cmake, libtool)" | |||
./bin/parsecmgmt -a build -p tools -c graphite | |||
|
|||
# Apply changes to graphite.bldconf for the Graphite-specific | |||
# compiler and linker flags | |||
echo "[BLDCONF] Applying patches (CFLAGS, CXXFLAGS, LDFLAGS, LIBS) to graphite.bldconf" | |||
patch -p1 < setup_parsec_2.1/graphite_bldconf.patch | |||
|
|||
# Apply changes for calling into Graphite when the hooks APIs' | |||
# are called, __parsec_roi_begin() and __parsec_roi_end() | |||
echo "[HOOKS] Applying graphite patches for hooks API" | |||
patch -p1 < setup_parsec_2.1/hooks.patch | |||
|
|||
# Apply changes for spawning only as many threads as requested. | |||
# By default, if N threads are requested, N+1 threads are spawned | |||
# The changes are applied only to 5 benchmarks: | |||
# blackscholes, swaptions, canneal, fluidanimate, streamcluster | |||
echo "[THREADS] Applying thread spawn patches for blackscholes, swaptions, canneal, fluidanimate, streamcluster" | |||
patch -p1 < setup_parsec_2.1/threads.patch | |||
|
|||
# Apply changes for opening file in read-only mode in freqmine. | |||
# These changes are not required for running with Graphite but | |||
# are put in for our regression tests to run. They do not affect | |||
# the simulator performance/accuracy in any way. | |||
echo "[FREQMINE] Applying open file mode patch for freqmine" | |||
patch -p1 < setup_parsec_2.1/freqmine.patch | |||
|
|||
# Untar the simmedium inputs of PARSEC into benchmark-specific | |||
# run/ directories. While running the benchmarks with the simulator, | |||
# untaring inputs is unnecessary. | |||
echo "[INPUTS] Untar'ing and setting up inputs in the run/ directory" | |||
./setup_parsec_2.1/inputs.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,126 @@ | |||
diff --git a/pkgs/apps/blackscholes/src/blackscholes.c b/pkgs/apps/blackscholes/src/blackscholes.c | |||
index 1bc0285..bb7d4d3 100644 | |||
--- a/pkgs/apps/blackscholes/src/blackscholes.c | |||
+++ b/pkgs/apps/blackscholes/src/blackscholes.c | |||
@@ -367,11 +367,14 @@ int main (int argc, char **argv) | |||
#endif | |||
#ifdef ENABLE_THREADS | |||
int tids[nThreads]; | |||
- for(i=0; i<nThreads; i++) { | |||
+ for(i=1; i<nThreads; i++) { | |||
tids[i]=i; | |||
CREATE_WITH_ARG(bs_thread, &tids[i]); | |||
} | |||
- WAIT_FOR_END(nThreads); | |||
+ tids[0] = 0; | |||
+ bs_thread(&tids[0]); | |||
+ | |||
+ WAIT_FOR_END(nThreads-1); | |||
#else//ENABLE_THREADS | |||
#ifdef ENABLE_OPENMP | |||
{ | |||
diff --git a/pkgs/apps/fluidanimate/src/pthreads.cpp b/pkgs/apps/fluidanimate/src/pthreads.cpp | |||
index 5b98803..8ed7479 100644 | |||
--- a/pkgs/apps/fluidanimate/src/pthreads.cpp | |||
+++ b/pkgs/apps/fluidanimate/src/pthreads.cpp | |||
@@ -851,13 +851,17 @@ int main(int argc, char *argv[]) | |||
#ifdef ENABLE_PARSEC_HOOKS | |||
__parsec_roi_begin(); | |||
#endif | |||
- for(int i = 0; i < threadnum; ++i) { | |||
- targs[i].tid = i; | |||
- targs[i].frames = framenum; | |||
- pthread_create(&thread[i], &attr, AdvanceFramesMT, &targs[i]); | |||
- } | |||
- // *** PARALLEL PHASE *** // | |||
- for(int i = 0; i < threadnum; ++i) { | |||
+ for(int i = 1; i < threadnum; ++i) { | |||
+ targs[i].tid = i; | |||
+ targs[i].frames = framenum; | |||
+ pthread_create(&thread[i], &attr, AdvanceFramesMT, &targs[i]); | |||
+ } | |||
+ targs[0].tid = 0; | |||
+ targs[0].frames = framenum; | |||
+ AdvanceFramesMT(&targs[0]); | |||
+ | |||
+ // *** PARALLEL PHASE *** // | |||
+ for(int i = 1; i < threadnum; ++i) { | |||
pthread_join(thread[i], NULL); | |||
} | |||
#ifdef ENABLE_PARSEC_HOOKS | |||
diff --git a/pkgs/apps/swaptions/src/HJM_Securities.cpp b/pkgs/apps/swaptions/src/HJM_Securities.cpp | |||
index 1a99735..b07efce 100644 | |||
--- a/pkgs/apps/swaptions/src/HJM_Securities.cpp | |||
+++ b/pkgs/apps/swaptions/src/HJM_Securities.cpp | |||
@@ -263,11 +263,14 @@ int main(int argc, char *argv[]) | |||
#else | |||
|
|||
int threadIDs[nThreads]; | |||
- for (i = 0; i < nThreads; i++) { | |||
+ for (i = 1; i < nThreads; i++) { | |||
threadIDs[i] = i; | |||
pthread_create(&threads[i], &pthread_custom_attr, worker, &threadIDs[i]); | |||
} | |||
- for (i = 0; i < nThreads; i++) { | |||
+ threadIDs[0] = 0; | |||
+ worker(&threadIDs[0]); | |||
+ | |||
+ for (i = 1; i < nThreads; i++) { | |||
pthread_join(threads[i], NULL); | |||
} | |||
|
|||
diff --git a/pkgs/kernels/canneal/src/main.cpp b/pkgs/kernels/canneal/src/main.cpp | |||
index 11ef798..cc13e80 100644 | |||
--- a/pkgs/kernels/canneal/src/main.cpp | |||
+++ b/pkgs/kernels/canneal/src/main.cpp | |||
@@ -112,10 +112,12 @@ int main (int argc, char * const argv[]) { | |||
#ifdef ENABLE_THREADS | |||
std::vector<pthread_t> threads(num_threads); | |||
void* thread_in = static_cast<void*>(&a_thread); | |||
- for(int i=0; i<num_threads; i++){ | |||
+ for(int i=1; i<num_threads; i++){ | |||
pthread_create(&threads[i], NULL, entry_pt,thread_in); | |||
} | |||
- for (int i=0; i<num_threads; i++){ | |||
+ entry_pt(thread_in); | |||
+ | |||
+ for (int i=1; i<num_threads; i++){ | |||
pthread_join(threads[i], NULL); | |||
} | |||
#else | |||
diff --git a/pkgs/kernels/streamcluster/src/streamcluster.cpp b/pkgs/kernels/streamcluster/src/streamcluster.cpp | |||
index ab6cb52..3175a07 100644 | |||
--- a/pkgs/kernels/streamcluster/src/streamcluster.cpp | |||
+++ b/pkgs/kernels/streamcluster/src/streamcluster.cpp | |||
@@ -1711,23 +1711,27 @@ void localSearch( Points* points, long kmin, long kmax, long* kfinal ) { | |||
#ifdef ENABLE_THREADS | |||
pthread_barrier_init(&barrier,NULL,nproc); | |||
#endif | |||
- for( int i = 0; i < nproc; i++ ) { | |||
+ for(int i = 0; i < nproc; i++) { | |||
arg[i].points = points; | |||
arg[i].kmin = kmin; | |||
arg[i].kmax = kmax; | |||
arg[i].pid = i; | |||
arg[i].kfinal = kfinal; | |||
- | |||
arg[i].barrier = &barrier; | |||
+ } | |||
#ifdef ENABLE_THREADS | |||
+ for (int i = 1; i < nproc; i++) { | |||
pthread_create(threads+i,NULL,localSearchSub,(void*)&arg[i]); | |||
+ } | |||
+ localSearchSub((void*)&arg[0]); | |||
#else | |||
+ for (int i = 0; i < nproc; i++) { | |||
localSearchSub(&arg[0]); | |||
-#endif | |||
} | |||
+#endif | |||
|
|||
#ifdef ENABLE_THREADS | |||
- for ( int i = 0; i < nproc; i++) { | |||
+ for (int i = 1; i < nproc; i++) { | |||
pthread_join(threads[i],NULL); | |||
} | |||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
diff --git a/pkgs/apps/freqmine/src/data.cpp b/pkgs/apps/freqmine/src/data.cpp | |||
index aa1454b..7c82fc3 100644 | |||
--- a/pkgs/apps/freqmine/src/data.cpp | |||
+++ b/pkgs/apps/freqmine/src/data.cpp | |||
@@ -9,9 +9,9 @@ Contents : data set management | |||
Data::Data(char *filename) | |||
{ | |||
#ifndef BINARY | |||
- in = fopen(filename,"r+t"); | |||
+ in = fopen(filename,"rt"); | |||
#else | |||
- in = fopen(filename, "r+b"); | |||
+ in = fopen(filename, "rb"); | |||
#endif | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
diff --git a/config/graphite.bldconf b/config/graphite.bldconf | |||
index 8452c42..12ad93c 100644 | |||
--- a/config/graphite.bldconf | |||
+++ b/config/graphite.bldconf | |||
@@ -1,5 +1,12 @@ | |||
#!/bin/bash | |||
- | |||
-# graphite.bldconf - configuration file for PARSEC | |||
+# | |||
+# graphite.bldconf - file containing global information necessary to build | |||
+# PARSEC with the Graphite multicore simulator | |||
|
|||
source ${PARSECDIR}/config/gcc-hooks.bldconf | |||
+ | |||
+# Enable PARSEC hooks | |||
+CFLAGS="${CFLAGS} -DENABLE_GRAPHITE -I${GRAPHITE_HOME}/common/user" | |||
+CXXFLAGS="${CXXFLAGS} -DENABLE_GRAPHITE -I${GRAPHITE_HOME}/common/user" | |||
+LDFLAGS="${LDFLAGS} -static -u CarbonStartSim -u CarbonStopSim -u pthread_create -u pthread_join -L${GRAPHITE_HOME}/lib -L${GRAPHITE_HOME}/contrib/dsent" | |||
+LIBS="${LIBS} -lcarbon_sim -ldsent_contrib -lboost_filesystem-mt -lboost_system-mt -lpthread -lstdc++ -lm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,54 @@ | |||
diff --git a/pkgs/libs/hooks/src/config.h b/pkgs/libs/hooks/src/config.h | |||
index 0cff79a..33948c3 100644 | |||
--- a/pkgs/libs/hooks/src/config.h | |||
+++ b/pkgs/libs/hooks/src/config.h | |||
@@ -131,7 +131,20 @@ | |||
#include "/opt/PTLsim/ptlcalls.h" | |||
#endif | |||
|
|||
- | |||
+/** \brief Run Graphite simulator models only in ROI | |||
+ * | |||
+ * If this macro is set to 1, then CarbonEnableModels() is called at the | |||
+ * start of the region-of-interest (ROI) and CarbonDisableModels() at the end of | |||
+ * it, so just the ROI in the program is modeled. For most parallel | |||
+ * benchmarking purposes, the ROI is the parallel part of the program. | |||
+ * | |||
+ * This functionality is disabled by default and must be enabled using | |||
+ * a compile-time macro (using -DENABLE_GRAPHITE). | |||
+ */ | |||
+/* Path to the include file */ | |||
+#ifdef ENABLE_GRAPHITE | |||
+#include "carbon_user.h" | |||
+#endif | |||
|
|||
/** \brief Prefix for all output. | |||
* | |||
diff --git a/pkgs/libs/hooks/src/hooks.c b/pkgs/libs/hooks/src/hooks.c | |||
index 9658425..5c878f7 100644 | |||
--- a/pkgs/libs/hooks/src/hooks.c | |||
+++ b/pkgs/libs/hooks/src/hooks.c | |||
@@ -195,6 +195,11 @@ void __parsec_roi_begin() { | |||
#if ENABLE_PTLSIM_TRIGGER | |||
ptlcall_switch_to_sim(); | |||
#endif //ENABLE_PTLSIM_TRIGGER | |||
+ | |||
+ // Graphite Enable Models | |||
+ #ifdef ENABLE_GRAPHITE | |||
+ CarbonEnableModels(); | |||
+ #endif | |||
} | |||
|
|||
|
|||
@@ -221,6 +226,11 @@ void __parsec_roi_end() { | |||
time_end = (double)t.tv_sec+(double)t.tv_usec*1e-6; | |||
#endif //ENABLE_TIMING | |||
|
|||
+ // Graphite Disable Models | |||
+ #ifdef ENABLE_GRAPHITE | |||
+ CarbonDisableModels(); | |||
+ #endif | |||
+ | |||
printf(HOOKS_PREFIX" Leaving ROI\n"); | |||
fflush(NULL); | |||
} |
Oops, something went wrong.