[mathicgb] 109/393: Migration from OpenMP to TBB complete.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.
commit f6010fc585b1885edbec7d07df75743904fc95d9
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Tue Nov 13 19:55:37 2012 +0100
Migration from OpenMP to TBB complete.
---
Makefile.am | 6 +-
build/vs12/mathicgb-exe/mathicgb-exe.vcxproj | 20 +--
build/vs12/mathicgb-lib/mathicgb-lib.vcxproj | 17 +--
build/vs12/mathicgb-test/mathicgb-test.vcxproj | 20 +--
src/cli/GBMain.cpp | 12 +-
src/mathicgb/F4MatrixBuilder.cpp | 63 ++++------
src/mathicgb/F4MatrixBuilder.hpp | 2 +-
src/mathicgb/F4MatrixReducer.cpp | 165 ++++++++++---------------
src/mathicgb/QuadMatrix.hpp | 4 +-
src/mathicgb/QuadMatrixBuilder.hpp | 5 -
10 files changed, 135 insertions(+), 179 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 4a9af4f..c3ac285 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,8 +10,8 @@ libmathicgb_la_CPPFLAGS = $(DEPS_CFLAGS)
noinst_LTLIBRARIES = libmathicgb.la
# set the C++ compiler to include src/
-AM_CXXFLAGS=-I$(top_srcdir)/src/ -std=gnu++0x -fopenmp
-AM_LDFLAGS=-fopenmp
+AM_CXXFLAGS=-I$(top_srcdir)/src/ -std=gnu++0x
+AM_LDFLAGS=
# libraries that are needed by this library
libmathicgb_la_LIBADD= $(DEPS_LIBS)
@@ -84,7 +84,7 @@ unittest_CPPFLAGS = $(DEPS_CFLAGS)
unittest_CXXFLAGS=\
-I$(top_srcdir)/libs/gtest/include\
-I$(top_srcdir)/libs/gtest/\
- -I$(top_srcdir)/src/ -std=gnu++0x -fopenmp
+ -I$(top_srcdir)/src/ -std=gnu++0x
unittest_LDADD = $(DEPS_LIBS) libmathicgb.la
test_LIBS=
diff --git a/build/vs12/mathicgb-exe/mathicgb-exe.vcxproj b/build/vs12/mathicgb-exe/mathicgb-exe.vcxproj
index 8ea1d81..97f294c 100755
--- a/build/vs12/mathicgb-exe/mathicgb-exe.vcxproj
+++ b/build/vs12/mathicgb-exe/mathicgb-exe.vcxproj
@@ -229,7 +229,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -247,7 +247,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -265,7 +265,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
@@ -284,7 +284,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
@@ -303,7 +303,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -321,7 +321,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -340,7 +340,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MATHICGBLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -362,7 +362,7 @@
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;MATHICGBLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -387,7 +387,7 @@
<PreprocessorDefinitions>WIN32;MATHICGB_DEBUG;MATHIC_DEBUG;MEMTAILOR_DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -409,7 +409,7 @@
<PreprocessorDefinitions>WIN64;MATHICGB_DEBUG;MATHIC_DEBUG;MEMTAILOR_DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
diff --git a/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj b/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj
index 9b57ad5..3619f54 100755
--- a/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj
+++ b/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj
@@ -226,6 +226,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -245,7 +246,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -267,6 +268,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
<MinimalRebuild>false</MinimalRebuild>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -287,7 +289,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -308,6 +310,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -327,7 +330,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -348,7 +351,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MATHICGBLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -372,7 +375,7 @@
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;MATHICGBLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -396,7 +399,7 @@
<PreprocessorDefinitions>TBB_USE_DEBUG=1;WIN32;MATHICGB_DEBUG;MATHIC_DEBUG;MEMTAILOR_DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -420,7 +423,7 @@
<PreprocessorDefinitions>TBB_USE_DEBUG=1;WIN64;MATHICGB_DEBUG;MATHIC_DEBUG;MEMTAILOR_DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeaderFile>stdinc.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/build/vs12/mathicgb-test/mathicgb-test.vcxproj b/build/vs12/mathicgb-test/mathicgb-test.vcxproj
index 77d7e33..3a6e5e5 100755
--- a/build/vs12/mathicgb-test/mathicgb-test.vcxproj
+++ b/build/vs12/mathicgb-test/mathicgb-test.vcxproj
@@ -206,7 +206,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -224,7 +224,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -242,7 +242,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
@@ -261,7 +261,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
@@ -280,7 +280,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -298,7 +298,7 @@
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -317,7 +317,7 @@
<PreprocessorDefinitions>WIN32;_VARIADIC_MAX=10;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -339,7 +339,7 @@
<PreprocessorDefinitions>WIN64;_VARIADIC_MAX=10;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -361,7 +361,7 @@
<PreprocessorDefinitions>WIN32;_VARIADIC_MAX=10;MATHICGB_DEBUG;MATHIC_DEBUG;MEMTAILOR_DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
@@ -383,7 +383,7 @@
<PreprocessorDefinitions>WIN64;_VARIADIC_MAX=10;MATHICGB_DEBUG;MATHIC_DEBUG;MEMTAILOR_DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\projs\mathic\tbb\include;C:\projs\mathic\gtest\include;C:\projs\mathic\gtest;C:\projs\mathic\mathicgb\src;C:\projs\mathic\mathic\src;C:\projs\mathic\memtailor\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <OpenMPSupport>true</OpenMPSupport>
+ <OpenMPSupport>false</OpenMPSupport>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
diff --git a/src/cli/GBMain.cpp b/src/cli/GBMain.cpp
index aa297fe..6a07d83 100755
--- a/src/cli/GBMain.cpp
+++ b/src/cli/GBMain.cpp
@@ -7,6 +7,7 @@
#include "mathicgb/MTArray.hpp"
#include <mathic.h>
+#include <tbb/tbb.h>
#include <cstdlib>
#include <fstream>
#include <iostream>
@@ -187,7 +188,12 @@ public:
ideal = Ideal::parse(inputFile);
}
std::unique_ptr<PolyRing const> ring(&(ideal->ring()));
-
+
+ const auto threadCount = mThreadCount.value() == 0 ?
+ tbb::task_scheduler_init::automatic :
+ mThreadCount.value();
+ tbb::task_scheduler_init scheduler(threadCount);
+
if (mClassicBuchbergerAlgorithm.value()) {
BuchbergerAlg alg(
*ideal,
@@ -197,9 +203,9 @@ public:
mPreferSparseReducers.value(),
mSPairQueue.value());
alg.setBreakAfter(mBreakAfter.value());
+ alg.setThreadCount(mThreadCount.value());
alg.setPrintInterval(mPrintInterval.value());
alg.setSPairGroupSize(mSPairGroupSize.value());
- alg.setThreadCount(mThreadCount.value());
alg.setReducerMemoryQuantum(mMemoryQuantum.value());
alg.setUseAutoTopReduction(mAutoTopReduce.value());
alg.setUseAutoTailReduction(mAutoTailReduce.value());
@@ -324,9 +330,7 @@ private:
mic::IntegerParameter mMemoryQuantum;
};
-int oldmain(int argc, char **argv);
int main(int argc, char **argv) {
- //oldmain(argc, argv);
try {
mic::CliParser parser;
parser.registerAction<CliActionSignature>();
diff --git a/src/mathicgb/F4MatrixBuilder.cpp b/src/mathicgb/F4MatrixBuilder.cpp
index 7e78341..53b8aeb 100755
--- a/src/mathicgb/F4MatrixBuilder.cpp
+++ b/src/mathicgb/F4MatrixBuilder.cpp
@@ -1,9 +1,7 @@
#include "stdinc.h"
#include "F4MatrixBuilder.hpp"
-#ifdef _OPENMP
-#include <omp.h>
-#endif
+#include <tbb/tbb.h>
MATHICGB_NO_INLINE
std::pair<QuadMatrixBuilder::LeftRightColIndex, ConstMonomial>
@@ -133,21 +131,15 @@ void F4MatrixBuilder::buildMatrixAndClear(QuadMatrix& matrix) {
// todo: prefer sparse/old reducers among the inputs.
// Process pending rows until we are done. Note that the methods
- // we are calling here can add more items to mTodo.
-
- QuadMatrixBuilder mainBuilder(
- ring(), mMap, mMonomialsLeft, mMonomialsRight, mBuilder.memoryQuantum()
- );
+ // we are calling here can add more pending items.
-#ifdef _OPENMP
MATHICGB_ASSERT(mThreadCount >= 1);
- std::vector<QuadMatrixBuilder*> threadData(mThreadCount);
- for (size_t i = 0; i < threadData.size(); ++i) {
- threadData[i] = i == 0 ? &mainBuilder : new QuadMatrixBuilder(
+ tbb::enumerable_thread_specific<std::unique_ptr<QuadMatrixBuilder>>
+ builders([&](){
+ return make_unique<QuadMatrixBuilder>(
ring(), mMap, mMonomialsLeft, mMonomialsRight, mBuilder.memoryQuantum()
);
- }
-#endif
+ });
decltype(mTodo) currentTasks;
while (!mTodo.empty()) {
@@ -160,18 +152,14 @@ void F4MatrixBuilder::buildMatrixAndClear(QuadMatrix& matrix) {
}
currentTasks.clear();
mTodo.swap(currentTasks);
- const auto taskCountOMP = static_cast<OMPIndex>(currentTasks.size());
-#pragma omp parallel for num_threads(mThreadCount) schedule(dynamic)
- for (OMPIndex taskOMP = 0; taskOMP < taskCountOMP; ++taskOMP) {
-#pragma omp flush
-
- const size_t taskIndex = taskOMP;
-#ifdef _OPENMP
- MATHICGB_ASSERT(omp_get_thread_num() < threadData.size());
- QuadMatrixBuilder& builder = *threadData[omp_get_thread_num()];
-#else
- QuadMatrixBuilder& builder = mainBuilder;
-#endif
+
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, currentTasks.size(), 1),
+ [&](const tbb::blocked_range<size_t>& range)
+ {for (auto it = range.begin(); it != range.end(); ++it)
+ {
+ const size_t taskIndex = it;
+ QuadMatrixBuilder& builder = *builders.local();
+ MATHICGB_ASSERT(&builder != 0);
const RowTask task = currentTasks[taskIndex];
MATHICGB_ASSERT(ring().hashValid(task.multiply));
@@ -181,21 +169,22 @@ void F4MatrixBuilder::buildMatrixAndClear(QuadMatrix& matrix) {
appendRowTop(task.multiply, *task.poly, builder);
} else
appendRowBottom(task, builder);
- }
+ }});
}
-#ifdef _OPENMP
-#pragma omp flush
- for (auto it = threadData.begin(); it != threadData.end(); ++it) {
- if (&mainBuilder != *it) {
- mainBuilder.takeRowsFrom((*it)->buildMatrixAndClear());
- delete *it;
- }
+ if (builders.empty()) {
+ matrix = QuadMatrix();
+ matrix.ring = &ring();
+ return;
}
- threadData.clear();
-#endif
- matrix = mainBuilder.buildMatrixAndClear();
+ auto& builder = **builders.begin();
+ const auto end = builders.end();
+ for (auto it = builders.begin() + 1; it != end; ++it)
+ builder.takeRowsFrom((*it)->buildMatrixAndClear());
+ matrix = builder.buildMatrixAndClear();
+ builders.clear();
+
{
ColReader reader(mMap);
matrix.leftColumnMonomials.clear();
diff --git a/src/mathicgb/F4MatrixBuilder.hpp b/src/mathicgb/F4MatrixBuilder.hpp
index cdc072a..ff77187 100755
--- a/src/mathicgb/F4MatrixBuilder.hpp
+++ b/src/mathicgb/F4MatrixBuilder.hpp
@@ -6,7 +6,7 @@
#include "PolyRing.hpp"
#include "PolyBasis.hpp"
#include "QuadMatrix.hpp"
-#include <tbb/tbb.h>
+#include <tbb/mutex.h>
#include <vector>
/** Class for constructing an F4 matrix. This class is reponsible for
diff --git a/src/mathicgb/F4MatrixReducer.cpp b/src/mathicgb/F4MatrixReducer.cpp
index 574124d..a691a42 100755
--- a/src/mathicgb/F4MatrixReducer.cpp
+++ b/src/mathicgb/F4MatrixReducer.cpp
@@ -4,6 +4,7 @@
#include "QuadMatrix.hpp"
#include "SparseMatrix.hpp"
#include "PolyRing.hpp"
+#include <tbb/tbb.h>
#include <algorithm>
#include <vector>
#include <stdexcept>
@@ -12,10 +13,6 @@
#include <cstdio>
#include <iostream>
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
namespace {
template<class T>
class DenseRow {
@@ -85,40 +82,9 @@ namespace {
template<class Iter>
void addRowMultiple(
const SparseMatrix::Scalar multiple,
- const Iter& begin,
- const Iter& end
+ const Iter begin,
+ const Iter end
) {
- // Now, you may be wondering why begin and end are passed by reference
- // instead of by value, and that would be a good question. As it turns
- // out, this method does not work otherwise when run in parallel using
- // OpenMP on MS Visual Studio 2012 when being called from reduce().
- // Strange but true.
- //
- // Why is that? To the best of my ability
- // to determine what was going on, it appears that, sometimes,
- // two threads would be running on the same stack when calling this method,
- // overwriting each other's local variables causing all kinds of havoc.
- // My evidence for this is that I could find no other explanation after
- // hours of investigation and that I could consistently get two threads
- // with different return values of omp_get_thread_num() to print out the
- // same address for a local variable - and this would happen just before
- // things went wrong. So at this point I'm concluding that it is a compiler
- // bug. All the writes and reads outside critical sections are to local
- // variables, memory allocated by the same thread or to data structures
- // that do not change within the scope of the parallel code in reduce(),
- // so I don't know what the issue would otherwise be. I thought perhaps
- // not building all the code with OpenMP enabled could be the issue,
- // but changing that did not fix the issue.
- //
- // Now you may be wondering what that has to do with passing iterators by
- // reference. As it happens, the issue does not happen this way. "But that
- // doesn't make any sense", you say, and you would be right. Feel free
- // to come up with a better explanation of this issue.
- //
- // If you want to take a look at this issue, the issue only turns up for 64
- // bit debug builds. This was on Visual Studio version
- // "11.0.50727.1 RTMREL" - Bjarke Hammersholt Roune
-
// MATHICGB_RESTRICT on entries is important. It fixed a performance
// regression on MSVC 2012 which otherwise was not able to determine that
// entries is not an alias for anything else in this loop. I suspect that
@@ -194,23 +160,22 @@ namespace {
SparseMatrix reduced(qm.topRight.memoryQuantum());
-#ifdef _OPENMP
- std::vector<DenseRow<uint64> > denseRowPerThread(threadCount);
-#else
- DenseRow<uint64> denseRow;
-#endif
+ tbb::enumerable_thread_specific<DenseRow<uint64>> denseRowPerThread([&](){
+ return DenseRow<uint64>();
+ });
SparseMatrix tmp(qm.topRight.memoryQuantum());
std::vector<SparseMatrix::RowIndex> rowOrder(rowCount);
-#pragma omp parallel for num_threads(threadCount) schedule(dynamic)
- for (OMPIndex rowOMP = 0;
- rowOMP < static_cast<OMPIndex>(rowCount); ++rowOMP) {
- const size_t row = static_cast<size_t>(rowOMP);
-#ifdef _OPENMP
- auto& denseRow = denseRowPerThread[omp_get_thread_num()];
-#endif
+ tbb::mutex lock;
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, rowCount),
+ [&](const tbb::blocked_range<size_t>& range)
+ {for (auto it = range.begin(); it != range.end(); ++it)
+ {
+ const size_t row = it;
+ auto& denseRow = denseRowPerThread.local();
+
denseRow.clear(leftColCount);
denseRow.addRow(toReduceLeft, row);
MATHICGB_ASSERT(leftColCount == pivotCount);
@@ -233,25 +198,23 @@ namespace {
denseRow.addRowMultiple(static_cast<SparseMatrix::Scalar>(entry), ++reduceByLeft.rowBegin(row), reduceByLeft.rowEnd(row));
denseRow[pivot] = entry;
}
-#pragma omp critical
- {
- for (size_t pivot = 0; pivot < pivotCount; ++pivot) {
- MATHICGB_ASSERT(denseRow[pivot] < std::numeric_limits<SparseMatrix::Scalar>::max());
- if (denseRow[pivot] != 0)
- tmp.appendEntry(rowThatReducesCol[pivot], static_cast<SparseMatrix::Scalar>(denseRow[pivot]));
- }
- tmp.rowDone();
- rowOrder[tmp.rowCount() - 1] = row;
- }
- }
-
-#pragma omp parallel for num_threads(threadCount) schedule(dynamic)
- for (OMPIndex iOMP = 0; iOMP < static_cast<OMPIndex>(rowCount); ++iOMP) {
- const size_t i = static_cast<size_t>(iOMP);
-#ifdef _OPENMP
- auto& denseRow = denseRowPerThread[omp_get_thread_num()];
-#endif
- size_t row = rowOrder[i];
+ tbb::mutex::scoped_lock lockGuard(lock);
+ for (size_t pivot = 0; pivot < pivotCount; ++pivot) {
+ MATHICGB_ASSERT(denseRow[pivot] < std::numeric_limits<SparseMatrix::Scalar>::max());
+ if (denseRow[pivot] != 0)
+ tmp.appendEntry(rowThatReducesCol[pivot], static_cast<SparseMatrix::Scalar>(denseRow[pivot]));
+ }
+ tmp.rowDone();
+ rowOrder[tmp.rowCount() - 1] = row;
+ }});
+
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, rowCount),
+ [&](const tbb::blocked_range<size_t>& range)
+ {for (auto iter = range.begin(); iter != range.end(); ++iter)
+ {
+ const size_t i = iter;
+ const size_t row = rowOrder[i];
+ auto& denseRow = denseRowPerThread.local();
denseRow.clear(rightColCount);
denseRow.addRow(toReduceRight, row);
@@ -263,21 +226,19 @@ namespace {
denseRow.addRowMultiple(it.scalar(), begin, end);
}
-#pragma omp critical
- {
- bool zero = true;
- for (SparseMatrix::ColIndex col = 0; col < rightColCount; ++col) {
- const auto entry =
- static_cast<SparseMatrix::Scalar>(denseRow[col] % modulus);
- if (entry != 0) {
- reduced.appendEntry(col, entry);
- zero = false;
- }
+ tbb::mutex::scoped_lock lockGuard(lock);
+ bool zero = true;
+ for (SparseMatrix::ColIndex col = 0; col < rightColCount; ++col) {
+ const auto entry =
+ static_cast<SparseMatrix::Scalar>(denseRow[col] % modulus);
+ if (entry != 0) {
+ reduced.appendEntry(col, entry);
+ zero = false;
}
- if (!zero)
- reduced.rowDone();
}
- }
+ if (!zero)
+ reduced.rowDone();
+ }});
return std::move(reduced);
}
@@ -292,15 +253,16 @@ namespace {
SparseMatrix::RowIndex const rowCount = toReduce.rowCount();
// dense representation
- std::vector<DenseRow<uint64> > dense(rowCount);
-#pragma omp parallel for num_threads(threadCount) schedule(dynamic)
- for (OMPIndex rowOMP = 0;
- rowOMP < static_cast<OMPIndex>(rowCount); ++rowOMP) {
- const size_t row = static_cast<size_t>(rowOMP);
- MATHICGB_ASSERT(!toReduce.emptyRow(row));
+ std::vector<DenseRow<uint64>> dense(rowCount);
+
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, rowCount),
+ [&](const tbb::blocked_range<size_t>& range)
+ {for (auto it = range.begin(); it != range.end(); ++it)
+ {
+ const size_t row = it;
dense[row].clear(colCount);
dense[row].addRow(toReduce, row);
- }
+ }});
// invariant: all columns in row to the left of leadCols[row] are zero.
std::vector<SparseMatrix::ColIndex> leadCols(rowCount);
@@ -325,14 +287,16 @@ namespace {
size_t const reducerCount = reduced.rowCount();
//std::cout << "reducing " << reduced.rowCount() << " out of " << toReduce.rowCount() << std::endl;
-#pragma omp parallel for num_threads(threadCount) schedule(dynamic)
- for (OMPIndex rowOMP = 0;
- rowOMP < static_cast<OMPIndex>(rowCount); ++rowOMP) {
- const size_t row = static_cast<size_t>(rowOMP);
+ tbb::mutex lock;
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, rowCount),
+ [&](const tbb::blocked_range<size_t>& range)
+ {for (auto it = range.begin(); it != range.end(); ++it)
+ {
+ const size_t row = it;
MATHICGB_ASSERT(leadCols[row] <= colCount);
DenseRow<uint64>& denseRow = dense[row];
if (denseRow.empty())
- continue;
+ return;
// reduce by each row of reduced.
for (size_t reducerRow = 0; reducerRow < reducerCount; ++reducerRow) {
@@ -359,8 +323,8 @@ namespace {
else {
MATHICGB_ASSERT(col < colCount);
bool isNewReducer = false;
-#pragma omp critical
{
+ tbb::mutex::scoped_lock lockGuard(lock);
if (!columnHasPivot[col]) {
columnHasPivot[col] = true;
isNewReducer = true;
@@ -370,7 +334,7 @@ namespace {
if (isNewReducer)
denseRow.makeUnitary(modulus, col);
}
- }
+ }});
//std::cout << "done reducing that batch" << std::endl;
reduced.clear(colCount);
@@ -391,12 +355,13 @@ namespace {
nextReducers.clear();
}
-#pragma omp parallel for num_threads(threadCount) schedule(dynamic)
- for (OMPIndex rowOMP = 0;
- rowOMP < static_cast<OMPIndex>(rowCount); ++rowOMP) {
- const size_t row = static_cast<size_t>(rowOMP);
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, rowCount),
+ [&](const tbb::blocked_range<size_t>& range)
+ {for (auto it = range.begin(); it != range.end(); ++it)
+ {
+ const size_t row = it;
dense[row].takeModulus(modulus);
- }
+ }});
toReduce.clear(colCount);
for (size_t row = 0; row < rowCount; ++row)
diff --git a/src/mathicgb/QuadMatrix.hpp b/src/mathicgb/QuadMatrix.hpp
index a66d316..67ed7bb 100755
--- a/src/mathicgb/QuadMatrix.hpp
+++ b/src/mathicgb/QuadMatrix.hpp
@@ -58,8 +58,8 @@ public:
/// Sort the left columns to be in decreasing order according to the monomial
/// order from the ring. The operation is parallel using up to threadCount
/// threads.
- void sortColumnsLeftRightParallel(int threadCount);
-
+ void sortColumnsLeftRightParallel(int threadCount);
+
/// Makes a copy of this matrix whose rows are sorted in some canonical way.
/// TODO: Actually only coarsely sorts the top rows right now.
QuadMatrix toCanonical() const;
diff --git a/src/mathicgb/QuadMatrixBuilder.hpp b/src/mathicgb/QuadMatrixBuilder.hpp
index 3794fe2..924e014 100755
--- a/src/mathicgb/QuadMatrixBuilder.hpp
+++ b/src/mathicgb/QuadMatrixBuilder.hpp
@@ -1,8 +1,6 @@
#ifndef MATHICGB_QUAD_MATRIX_BUILDER_GUARD
#define MATHICGB_QUAD_MATRIX_BUILDER_GUARD
-#define MATHICGB_USE_QUADMATRIX_STD_HASH
-
#include "MonomialMap.hpp"
#include "SparseMatrix.hpp"
@@ -13,9 +11,6 @@
#include <string>
#include <ostream>
#include <memtailor.h>
-#ifdef MATHICGB_USE_QUADMATRIX_STD_HASH
-#include <unordered_map>
-#endif
class FreeModuleOrder;
class QuadMatrix;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git
More information about the debian-science-commits
mailing list