Parallel Programming - Finished OpenMP
[matches/honours.git] / course / semester2 / pprog / assignment1 / openmp / nbody.h~
diff --git a/course/semester2/pprog/assignment1/openmp/nbody.h~ b/course/semester2/pprog/assignment1/openmp/nbody.h~
new file mode 100644 (file)
index 0000000..ebab892
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef _NBODY_OPENMP_H
+#define _NBODY_OPENMP_H
+
+/**
+ * @file nbody.h
+ * @purpose OpenMP version of N-Body simulator, declarations
+ * @author Sam Moore (20503628) - 2012
+ */
+
+#include "../single-thread/nbody.h" //Include original code
+#include <omp.h>
+
+
+#undef SINGLE_THREADED
+#define OMP_THREADED
+
+
+#define CRAPPY_VERSION
+
+// Replace default macros with thread-safe functions
+#undef Simulation_Run
+void Simulation_Run(int argc, char ** argv);
+//#undef QuitProgram
+//#define QuitProgram(x) break
+
+#undef BeforeDraw
+#define BeforeDraw() (void)0 // Do nothing (apparently this is how to do nothing with a macro)
+//void BeforeDraw();
+
+#undef AfterDraw 
+#define AfterDraw() (void)0
+//void AfterDraw();
+
+omp_lock_t graphics_lock;
+
+
+void Compute(void);
+void Compute2(void);
+
+//#define OVER_ENGINEERED 
+// define to (my original approach) manually split the System array (same as pthread version) between threads
+//     Manually splitting the System array is not required in openmp, since "#pragma omp for" automatically does it
+//     I still like doing it this way, since you can explicitly see what each thread is doing, but it would probably lose me marks.
+//     However I can't bring myself to delete it. Hence, compromise.
+
+#endif //_NBODY_OPENMP_H
+
+//EOF

UCC git Repository :: git.ucc.asn.au