Browse Source

Fixed a bug in the SparseMatrix.h where the multi threaded implementation would crash sometimes

Added a new definition to CMakeLists.txt for MSVC as to undefine the MIN/MAX macros


Former-commit-id: 5a3d12e920
tempestpy_adaptions
PBerger 11 years ago
parent
commit
79c40126f3
  1. 2
      CMakeLists.txt
  2. 21
      src/storage/SparseMatrix.h
  3. 4
      src/utility/OsDetection.h

2
CMakeLists.txt

@ -121,6 +121,8 @@ elseif(MSVC)
add_definitions(/bigobj)
# required by GTest and PrismGrammar::createIntegerVariable
add_definitions(/D_VARIADIC_MAX=10)
# Windows.h breaks GMM in gmm_except.h because of its macro definition for min and max
add_definitions(/DNOMINMAX)
# MSVC does not do strict-aliasing, so no option needed
else(CLANG)

21
src/storage/SparseMatrix.h

@ -1,23 +1,24 @@
#ifndef STORM_STORAGE_SPARSEMATRIX_H_
#define STORM_STORAGE_SPARSEMATRIX_H_
#include <exception>
#include <new>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <set>
#include <cstdint>
// To detect whether the usage of TBB is possible, this include is neccessary
#include "storm-config.h"
#ifdef STORM_HAVE_INTELTBB
# include <new> // This fixes a potential dependency ordering problem between GMM and TBB
# include "utility/OsDetection.h" // This fixes a potential dependency ordering problem between GMM and TBB
# include <new>
# include "tbb/tbb.h"
# include <iterator>
#endif
#include <exception>
#include <new>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <set>
#include <cstdint>
#include "src/exceptions/InvalidStateException.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/exceptions/OutOfRangeException.h"
@ -1545,7 +1546,7 @@ private:
tbbHelper_MatrixRowVectorScalarProduct(M const* matrixA, V const* vectorX, V * resultVector) : matrixA(matrixA), vectorX(vectorX), resultVector(resultVector) {}
void operator() (const tbb::blocked_range<uint_fast64_t>& r) const {
for (uint_fast64_t row = r.begin(); row <= r.end(); ++row) {
for (uint_fast64_t row = r.begin(); row < r.end(); ++row) {
uint_fast64_t index = matrixA->rowIndications.at(row);
uint_fast64_t indexEnd = matrixA->rowIndications.at(row + 1);

4
src/utility/OsDetection.h

@ -19,7 +19,11 @@
# include <sys/resource.h> // Required by storm.cpp, Memory Usage
#elif defined _WIN32 || defined _WIN64
# define WINDOWS
# ifndef NOMINMAX
# define NOMINMAX
# undef min
# undef max
# endif
# include <Windows.h>
# include <winnt.h>
# include <DbgHelp.h>

Loading…
Cancel
Save