Commit bf8f78b0 authored by Rayan Chikhi's avatar Rayan Chikhi
Browse files

it seems that assert()'s didnt really work.

this is because gatb-core was never compiled in true debug mode. CMake thought it was release so it inserted DNDEBUG
this commit fixes that
parent e9243c8f
......@@ -113,6 +113,7 @@ set (LIB_COMPILE_WARNINGS "-Wall -Wno-unused-function -Wno-unused-variable -Wno-
if (debug)
#set (LIBRARY_COMPILE_DEFINITIONS "${LIBRARY_COMPILE_DEFINITIONS} -g -p -pg")
set (LIBRARY_COMPILE_DEFINITIONS "${LIBRARY_COMPILE_DEFINITIONS} -g -p ${LIB_COMPILE_WARNINGS}")
set (CMAKE_BUILD_TYPE Debug) # else CMake adds DNDEBUG
message("-- COMPILATION IN DEBUG MODE")
else()
set (LIBRARY_COMPILE_DEFINITIONS "${LIBRARY_COMPILE_DEFINITIONS} -O3 ${LIB_COMPILE_WARNINGS}")
......@@ -242,7 +243,7 @@ set (gatb-core-flags ${LIBRARY_COMPILE_DEFINITIONS})
# We define the include directories used for linking binary based on gatb core
# Note that we need to add boost include dependency (not working otherwise with clang)
set (gatb-core-includes ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/thirdparty ${gatb-core-extra-libraries-inc})
set (gatb-core-includes ${PROJECT_BINARY_DIR}/include ${PROJECT_BINARY_DIR}/include/${CMAKE_BUILD_TYPE} ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/thirdparty ${gatb-core-extra-libraries-inc})
# We define the libraries used for linking binary based on gatb core
set (gatb-core-libraries gatbcore-static dl pthread z hdf5 ${gatb-core-extra-libraries})
......
......@@ -321,7 +321,7 @@ void ConfigurationAlgorithm<span>::execute ()
}
}
assert (_max_disk_space > 0);
assert (_config._max_disk_space > 0);
_config._nb_passes = ( (_config._volume/3) / _config._max_disk_space ) + 1; //minim, approx volume /3
//_nb_passes = 1; //do not constrain nb passes on disk space anymore (anyway with minim, not very big)
......@@ -368,10 +368,10 @@ void ConfigurationAlgorithm<span>::execute ()
do {
assert (_nb_passes > 0);
assert (_config._nb_passes > 0);
volume_per_pass = volume_minim / _config._nb_passes;
assert (_max_memory > 0);
assert (_config._max_memory > 0);
//printf("volume_per_pass %lli _nbCores %zu _max_memory %i \n",volume_per_pass, _nbCores,_max_memory);
// _nb_partitions = ( (volume_per_pass*_nbCores) / _max_memory ) + 1;
......@@ -405,7 +405,7 @@ void ConfigurationAlgorithm<span>::execute ()
_config._nbCores, _config._nb_partitions_in_parallel, _config._nbCores_per_partition, _config._nb_partitions, _config._nb_passes
));
assert(_nbCores_per_partition > 0);
assert(_config._nbCores_per_partition > 0);
/* optimize the number of cached items per partition per core */
/* add more items to partition cache as long as the total memory of cached items
......
......@@ -43,14 +43,16 @@
#include <gatb/tools/math/FastMinimizer.hpp>
#ifndef ASSERTS
#define NDEBUG // disable asserts; those asserts make sure that with PRECISION == [1 or 2], all is correct
#define assertLI(x) {} // disable asserts for large int; those asserts make sure that with PRECISION == [1 or 2], all is correct
#else
#define assertLI(x) assert(x)
#endif
#include <assert.h>
// some 64-bit assert macros
#if defined(_LP64)
#define assert128(x) assert(precision != 2 || (x));
#define assert128(x) assertLI(precision != 2 || (x));
#else
#define assert128(x) ;
#endif
......@@ -155,7 +157,7 @@ public:
carry = (result.value[i] < this->value[i]) ? 1 : 0;
}
assert (precision != 1 || (result == other.value[0] + this->value[0]));
assertLI(precision != 1 || (result == other.value[0] + this->value[0]));
assert128 (result.toInt128() == other.toInt128() + toInt128());
return result;
}
......@@ -172,7 +174,7 @@ public:
carry = (result.value[i] < this->value[i]) ? 1 : 0;
}
assert (precision != 1 || (result == other.value[0] + this->value[0]));
assertLI(precision != 1 || (result == other.value[0] + this->value[0]));
assert128 (result.toInt128() == other.toInt128() + toInt128());
return result;
}
......@@ -192,7 +194,7 @@ public:
carry = (result.value[i] > this->value[i]) ? 1 : 0;
}
assert(precision != 1 || (result == this->value[0] - other.value[0]));
assertLI(precision != 1 || (result == this->value[0] - other.value[0]));
assert128(result.toInt128() == toInt128() - other.toInt128());
return result;
}
......@@ -209,7 +211,7 @@ public:
carry = (result.value[i] > this->value[i]) ? 1 : 0;
}
assert(precision != 1 || (result == this->value[0] - other));
assertLI(precision != 1 || (result == this->value[0] - other));
return result;
}
......@@ -244,7 +246,7 @@ public:
}
}
assert(precision != 1 || (result == this->value[0] * coeff));
assertLI(precision != 1 || (result == this->value[0] * coeff));
assert128(result.toInt128() == toInt128() * coeff);
return result;
}
......@@ -272,7 +274,7 @@ public:
r = n % divisor;
}
}
assert(precision != 1 || (result == this->value[0] / divisor));
assertLI(precision != 1 || (result == this->value[0] / divisor));
assert128(result.toInt128() == toInt128() / divisor);
return result;
}
......@@ -295,7 +297,7 @@ public:
}
}
assert(precision != 1 || (r == this->value[0] % divisor));
assertLI(precision != 1 || (r == this->value[0] % divisor));
assert128(r == toInt128() % divisor);
return (uint32_t)r;
}
......@@ -311,7 +313,7 @@ public:
for (int i=0 ; i < precision ; i++)
result.value[i] = this->value[i] ^ other.value[i];
assert(precision != 1 || (result == (this->value[0] ^ other.value[0])));
assertLI(precision != 1 || (result == (this->value[0] ^ other.value[0])));
assert128(result.toInt128() == (toInt128() ^ other.toInt128()));
return result;
}
......@@ -327,7 +329,7 @@ public:
for (int i=0 ; i < precision ; i++)
result.value[i] = this->value[i] | other.value[i];
assert(precision != 1 || (result == (this->value[0] | other.value[0])));
assertLI(precision != 1 || (result == (this->value[0] | other.value[0])));
assert128(result.toInt128() == (toInt128() | other.toInt128()));
return result;
}
......@@ -343,7 +345,7 @@ public:
for (int i=0 ; i < precision ; i++)
result.value[i] = this->value[i] & other.value[i];
assert(precision != 1 || (result == (this->value[0] & other.value[0])));
assertLI(precision != 1 || (result == (this->value[0] & other.value[0])));
assert128(result.toInt128() == (toInt128() & other.toInt128()));
return result;
}
......@@ -371,7 +373,7 @@ public:
for (int i=0 ; i < precision ; i++)
result.value[i] = ~this->value[i];
assert(precision != 1 || (result == ~this->value[0]));
assertLI(precision != 1 || (result == ~this->value[0]));
assert128(result.toInt128() == ~toInt128());
return result;
}
......@@ -406,7 +408,7 @@ public:
}
result.value[precision-1] = result.value[precision-1] | (this->value[precision-1-large_shift] << small_shift);
assert(precision != 1 || (result == (this->value[0] << coeff)));
assertLI(precision != 1 || (result == (this->value[0] << coeff)));
assert128(result.toInt128() == (toInt128() << coeff));
return result;
}
......@@ -440,7 +442,7 @@ public:
}
}
assert(precision != 1 || ( small_shift == 0 || (result == this->value[0] >> coeff)));
assertLI(precision != 1 || ( small_shift == 0 || (result == this->value[0] >> coeff)));
assert128(small_shift == 0 || (result.toInt128() == (toInt128() >> coeff)));
return result;
}
......
......@@ -82,7 +82,7 @@ MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
SET (LIB_DEBUG_NAME "${libname}_D")
ELSE (WIN32)
SET (LIB_RELEASE_NAME "${libname}")
SET (LIB_DEBUG_NAME "${libname}_debug")
SET (LIB_DEBUG_NAME "${libname}") # (rayan) changed that. used to be ${libname}_debug
ENDIF (WIN32)
ELSE (${libtype} MATCHES "SHARED")
IF (WIN32)
......@@ -92,10 +92,10 @@ MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
# if the generator supports configuration types or if the CMAKE_BUILD_TYPE has a value
IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET (LIB_RELEASE_NAME "${libname}")
SET (LIB_DEBUG_NAME "${libname}_debug")
SET (LIB_DEBUG_NAME "${libname}") # (rayan) changed that. used to be ${libname}_debug
ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET (LIB_RELEASE_NAME "lib${libname}")
SET (LIB_DEBUG_NAME "lib${libname}_debug")
SET (LIB_DEBUG_NAME "lib${libname}") # (rayan) changed that. used to be ${libname}_debug
ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
ENDIF (WIN32)
ENDIF (${libtype} MATCHES "SHARED")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment