[med-svn] [Git][med-team/gatb-core][upstream] New upstream version 1.4.1+dfsg
Andreas Tille
gitlab at salsa.debian.org
Mon May 14 20:57:45 BST 2018
Andreas Tille pushed to branch upstream at Debian Med / gatb-core
Commits:
8e45a9a1 by Andreas Tille at 2018-05-14T21:36:27+02:00
New upstream version 1.4.1+dfsg
- - - - -
18 changed files:
- gatb-core/CMakeLists.txt
- gatb-core/RELEASES.md
- gatb-core/src/gatb/bcalm2/bglue_algo.cpp
- gatb-core/src/gatb/bcalm2/ograph.cpp
- gatb-core/src/gatb/bcalm2/unionFind.hpp
- gatb-core/src/gatb/debruijn/impl/Graph.cpp
- gatb-core/src/gatb/tools/collections/impl/Bloom.hpp
- gatb-core/src/gatb/tools/collections/impl/CollectionAbstract.hpp
- gatb-core/src/gatb/tools/misc/impl/TimeInfo.cpp
- gatb-core/src/gatb/tools/misc/impl/TimeInfo.hpp
- gatb-core/src/gatb/tools/storage/impl/CollectionFile.hpp
- gatb-core/src/gatb/tools/storage/impl/StorageFile.hpp
- gatb-core/src/gatb/tools/storage/impl/StorageTools.hpp
- − gatb-core/test/db/NIST7035_TAAGGCGA_L001_R1_001_5OK.fastq.gz
- − gatb-core/test/db/NIST7035_TAAGGCGA_L001_R1_001_5OK.fastq.leon-ref
- − gatb-core/test/db/giab.hg002.2D_6K.fastq.gz
- gatb-core/test/unit/src/bank/TestLeon.cpp
- + gatb-core/test/unit/src/bcalm/TestBcalm.cpp
Changes:
=====================================
gatb-core/CMakeLists.txt
=====================================
--- a/gatb-core/CMakeLists.txt
+++ b/gatb-core/CMakeLists.txt
@@ -9,7 +9,7 @@ cmake_minimum_required (VERSION 3.1.0)
# The default version number is the latest official build
SET (gatb-core_VERSION_MAJOR 1)
SET (gatb-core_VERSION_MINOR 4)
-SET (gatb-core_VERSION_PATCH 0)
+SET (gatb-core_VERSION_PATCH 1)
# But, it is possible to define another release number during a local build
IF (DEFINED MAJOR)
=====================================
gatb-core/RELEASES.md
=====================================
--- a/gatb-core/RELEASES.md
+++ b/gatb-core/RELEASES.md
@@ -1,4 +1,12 @@
--------------------------------------------------------------------------------
+# RELEASE 1.4.1
+
+* This is a bugfix release
+ * fixed a segfault in some multi-threaded situations
+ * removed some spurious large files in the distrib
+ * fixed a bug with the -storate-type file option
+
+--------------------------------------------------------------------------------
# RELEASE 1.4.0
* Integration of Leon compressor into GATB-Core :
=====================================
gatb-core/src/gatb/bcalm2/bglue_algo.cpp
=====================================
--- a/gatb-core/src/gatb/bcalm2/bglue_algo.cpp
+++ b/gatb-core/src/gatb/bcalm2/bglue_algo.cpp
@@ -791,7 +791,10 @@ void bglue(Storage *storage,
const typename ModelCanon::Kmer kmmerBegin = modelCanon.codeSeed(kmerBegin.c_str(), Data::ASCII);
const typename ModelCanon::Kmer kmmerEnd = modelCanon.codeSeed(kmerEnd.c_str(), Data::ASCII);
- ufkmers.union_(uf_mphf.lookup(hasher(kmmerBegin)), uf_mphf.lookup(hasher(kmmerEnd)));
+ uint32_t v1 = uf_mphf.lookup(hasher(kmmerBegin));
+ uint32_t v2 = uf_mphf.lookup(hasher(kmmerEnd));
+
+ ufkmers.union_(v1,v2);
//ufkmers.union_((hasher(kmmerBegin)), (hasher(kmmerEnd)));
#if 0
@@ -818,10 +821,9 @@ void bglue(Storage *storage,
};
- //setDispatcher (new SerialDispatcher()); // force single thread
Dispatcher dispatcher (nb_threads);
dispatcher.iterate (in->iterator(), createUF);
-
+
#if 0
ufmin.printStats("uf minimizers");
@@ -836,6 +838,7 @@ void bglue(Storage *storage,
if (debug_uf_stats) // for debugging
{
ufkmers.printStats("uf kmers");
+ //ufkmers.dumpUF("uf.dump");
logging("after computing UF stats");
}
@@ -929,6 +932,7 @@ void bglue(Storage *storage,
logging( "Allowed " + to_string((max_buffer * nbGluePartitions) /1024 /1024) + " MB memory for buffers");
+
// partition the glue into many files, à la dsk
auto partitionGlue = [k, &modelCanon /* crashes if copied!*/, \
&get_UFclass, &gluePartitions,
@@ -983,7 +987,7 @@ void bglue(Storage *storage,
delete gluePartitions[i]; // takes care of the final flush (this doesn't delete the file, just closes it)
free_memory_vector(gluePartitions);
out.flush();
-
+
logging("Done disk partitioning of glue");
@@ -1010,10 +1014,11 @@ void bglue(Storage *storage,
// glue all partitions using a thread pool
ThreadPool pool(nb_threads);
+ std::mutex mtx; // lock to avoid a nasty bug when calling output()
for (int partition = 0; partition < nbGluePartitions; partition++)
{
auto glue_partition = [&modelCanon, &ufkmers, partition, &gluePartition_prefix, nbGluePartitions, ©_nb_seqs_in_partition,
- &get_UFclass, &out, &outLock, &out_id, kmerSize]( int thread_id)
+ &get_UFclass, &out, &outLock, &out_id, kmerSize, &mtx]( int thread_id)
{
int k = kmerSize;
@@ -1101,7 +1106,12 @@ void bglue(Storage *storage,
float mean_abundance = get_mean_abundance(abs);
uint32_t sum_abundances = get_sum_abundance(abs);
- output(seq, out, std::to_string(out_id++) + " LN:i:" + to_string(seq.size()) + " KC:i:" + to_string(sum_abundances) + " km:f:" + to_string_with_precision(mean_abundance));
+ {
+ // for some reason i do need that lock_guard here.. even though output is itself lock guarded. maybe some lazyness in the evauation of the to_string(out_id++)? who kon
+ // anyway this fixes the problem, i'll understand it some other time.
+ std::lock_guard<std::mutex> lock(mtx);
+ output(seq, out, std::to_string(out_id++) + " LN:i:" + to_string(seq.size()) + " KC:i:" + to_string(sum_abundances) + " km:f:" + to_string_with_precision(mean_abundance));
+ }
}
free_memory_vector(ordered_sequences_idxs);
=====================================
gatb-core/src/gatb/bcalm2/ograph.cpp
=====================================
--- a/gatb-core/src/gatb/bcalm2/ograph.cpp
+++ b/gatb-core/src/gatb/bcalm2/ograph.cpp
@@ -126,7 +126,7 @@ template<size_t span>
void graph3<span>::compaction(uint iL, uint iR,typename graph3<span>::kmerType kmmer){
if(iR!=iL){
typename graph3<span>::kmerType RC=rcb(kmmer);
- uint s1(unitigs[iL].size()),s2(unitigs[iR].size());
+ //uint s1(unitigs[iL].size()),s2(unitigs[iR].size());
bool b1(isNumber(unitigs[iL][0])),b2(isNumber(unitigs[iR][0]));
if(b1 and b2){return compaction(stoi(unitigs[iL]),stoi(unitigs[iR]),kmmer);}
if(b1){return compaction(stoi(unitigs[iL]),iR,kmmer);}
=====================================
gatb-core/src/gatb/bcalm2/unionFind.hpp
=====================================
--- a/gatb-core/src/gatb/bcalm2/unionFind.hpp
+++ b/gatb-core/src/gatb/bcalm2/unionFind.hpp
@@ -5,6 +5,7 @@
#include <set>
#include <atomic>
#include <iostream>
+#include <fstream>
#include <unordered_map>
/**
@@ -130,6 +131,15 @@ public:
std::cout << "raw space of UF hash data: " << ( 2*getNumKeys * sizeof(T) ) /1024/1024 << " MB" << std::endl; // 2x because each key of type T is associated to a value of type T
}
+ // debug function
+ void dumpUF(std::string file)
+ {
+ std::ofstream dumpfile;
+ dumpfile.open (file);
+ for (uint32_t i=0; i<size(); ++i)
+ dumpfile << i << " " << mData[i] << std::endl;
+ dumpfile.close();
+ }
mutable std::vector<std::atomic<uint64_t>> mData;
=====================================
gatb-core/src/gatb/debruijn/impl/Graph.cpp
=====================================
--- a/gatb-core/src/gatb/debruijn/impl/Graph.cpp
+++ b/gatb-core/src/gatb/debruijn/impl/Graph.cpp
@@ -309,7 +309,6 @@ void build_visitor_solid<Node,Edge,GraphDataVariant>::operator() (GraphData<span
DEBUG ((cout << "builGraph for bank '" << bank->getId() << "'"
<< " kmerSize=" << kmerSize
- << " nksMin=" << nksMin
<< " output='" << output << "'"
<< endl
));
=====================================
gatb-core/src/gatb/tools/collections/impl/Bloom.hpp
=====================================
--- a/gatb-core/src/gatb/tools/collections/impl/Bloom.hpp
+++ b/gatb-core/src/gatb/tools/collections/impl/Bloom.hpp
@@ -1277,6 +1277,7 @@ public:
const std::string& kmerSizeStr
)
{
+ //std::cout << "custom createbloom, name=" << name << " size=" << sizeStr << " nbHash=" << nbHashStr << " k=" << kmerSizeStr << std::endl;
tools::misc::BloomKind kind; parse (name, kind);
return createBloom<T> (kind, (u_int64_t)atol (sizeStr.c_str()), (size_t)atol (nbHashStr.c_str()), atol (kmerSizeStr.c_str()));
}
=====================================
gatb-core/src/gatb/tools/collections/impl/CollectionAbstract.hpp
=====================================
--- a/gatb-core/src/gatb/tools/collections/impl/CollectionAbstract.hpp
+++ b/gatb-core/src/gatb/tools/collections/impl/CollectionAbstract.hpp
@@ -113,7 +113,9 @@ public:
void flush () { _bag->flush(); }
/** \copydoc Collection::addProperty */
- void addProperty (const std::string& key, const std::string value) {}
+ void addProperty (const std::string& key, const std::string value) {
+ std::cout << "warning: collectionAbstract.addProperty() called without an implementation (notify a developer)" << std::endl;
+ }
/** \copydoc Collection::addProperty */
void addProperty (const std::string& key, const char* format ...)
=====================================
gatb-core/src/gatb/tools/misc/impl/TimeInfo.cpp
=====================================
--- a/gatb-core/src/gatb/tools/misc/impl/TimeInfo.cpp
+++ b/gatb-core/src/gatb/tools/misc/impl/TimeInfo.cpp
@@ -41,6 +41,7 @@ namespace gatb { namespace core { namespace tools { namespace misc { namespac
*********************************************************************/
TimeInfo::TimeInfo () : _time(system::impl::System::time())
{
+ _synchro = System::thread().newSynchronizer();
}
/*********************************************************************
@@ -53,6 +54,7 @@ TimeInfo::TimeInfo () : _time(system::impl::System::time())
*********************************************************************/
TimeInfo::TimeInfo (system::ITime& aTime) : _time(aTime)
{
+ _synchro = System::thread().newSynchronizer();
}
/*********************************************************************
@@ -68,6 +70,16 @@ void TimeInfo::start (const char* name)
_entriesT0 [name] = _time.getTimeStamp();
}
+
+//destructor
+TimeInfo::~TimeInfo()
+{
+ if(_synchro)
+ {
+ delete _synchro;
+ _synchro = 0;
+ }
+}
/*********************************************************************
** METHOD :
** PURPOSE :
@@ -87,17 +99,21 @@ void TimeInfo::stop (const char* name)
** INPUT :
** OUTPUT :
** RETURN :
-** REMARKS :
+ ** REMARKS :
+ GR: this must be thread safe ! because multiple threads may call this on the same TimeInfo object at the same time !
*********************************************************************/
TimeInfo& TimeInfo::operator+= (TimeInfo& ti)
{
- const std::map <std::string, u_int32_t>& entries = ti.getEntries();
+ _synchro->lock();
+
+ const std::map <std::string, u_int32_t>& entries = ti.getEntries();
for (map <string, u_int32_t>::const_iterator it = entries.begin(); it != ti.getEntries().end(); ++it)
{
_entries[it->first] += it->second;
}
+ _synchro->unlock();
return *this;
}
@@ -108,14 +124,18 @@ TimeInfo& TimeInfo::operator+= (TimeInfo& ti)
** OUTPUT :
** RETURN :
** REMARKS :
+ GR: this must be thread safe ! because multiple threads may call this on the same TimeInfo object at the same time !
*********************************************************************/
TimeInfo& TimeInfo::operator/= (size_t nb)
{
+ _synchro->lock();
+
for (map <string, u_int32_t>::const_iterator it = _entries.begin(); it != _entries.end(); ++it)
{
_entries[it->first] = (u_int32_t) ((float)it->second / (float)nb);
}
-
+
+ _synchro->unlock();
return *this;
}
=====================================
gatb-core/src/gatb/tools/misc/impl/TimeInfo.hpp
=====================================
--- a/gatb-core/src/gatb/tools/misc/impl/TimeInfo.hpp
+++ b/gatb-core/src/gatb/tools/misc/impl/TimeInfo.hpp
@@ -30,6 +30,7 @@
#include <gatb/tools/misc/api/IProperty.hpp>
#include <gatb/system/api/ITime.hpp>
+#include <gatb/system/impl/System.hpp>
#include <map>
@@ -75,6 +76,8 @@ public:
/** Default constructor. */
TimeInfo ();
+ ~TimeInfo();
+
/** Constructor taking a time factory.
* \param[in] aTime : the time factory to be used.
*/
@@ -126,6 +129,7 @@ private:
system::ITime& _time;
std::map <std::string, u_int32_t> _entriesT0;
std::map <std::string, u_int32_t> _entries;
+ gatb::core::system::ISynchronizer* _synchro;
};
/********************************************************************************/
=====================================
gatb-core/src/gatb/tools/storage/impl/CollectionFile.hpp
=====================================
--- a/gatb-core/src/gatb/tools/storage/impl/CollectionFile.hpp
+++ b/gatb-core/src/gatb/tools/storage/impl/CollectionFile.hpp
@@ -35,9 +35,11 @@
#include <gatb/tools/collections/impl/IteratorFile.hpp>
#include <gatb/tools/collections/impl/CollectionAbstract.hpp>
#include <gatb/system/impl/System.hpp>
+#include <json/json.hpp>
#include <string>
#include <vector>
+#include <fstream>
/********************************************************************************/
namespace gatb {
@@ -63,18 +65,76 @@ public:
/* Note (Rayan): this isn't very clean. Two files objectss are opened, one by BagFile (in write mode) and one in IterableFile (in read mode).
* With Clang/OSX, turns out the IterableFile was created before BagFile, causing some troubles.
* Also this is opening the file twice, not nice. Anyway until I think of a better system, it's kept as it is, and IterableFile does a small hack*/
- ), _name(filename)
+ ), _name(filename), _propertiesName(filename+".props")
{}
/** Destructor. */
virtual ~CollectionFile() {}
/** \copydoc tools::collections::Collection::remove */
- void remove () { gatb::core::system::impl::System::file().remove (_name); }
+ void remove () {
+ gatb::core::system::impl::System::file().remove (_name);
+ gatb::core::system::impl::System::file().remove (_propertiesName);
+ }
+
+
+ /* R: some code duplication with GroupFile, but it's the same in the HDF5 case. not the best design.
+ * so, collections can hold properties, so can groups.. */
+
+ /** \copydoc tools::collections::Collection::addProperty */
+ void addProperty (const std::string& key, const std::string value)
+ {
+ //std::cout << "CollectionFile addProperty called, key=" << key << " value=" << value<< std::endl;
+ std::ifstream myfile (_propertiesName);
+ std::string data, line;
+ if (myfile.is_open())
+ {
+ while ( getline (myfile,line) )
+ data += line;
+ myfile.close();
+ }
+ json::JSON j;
+ if (data.size() > 0)
+ j = json::LoadJson(data);
+ // otherwise json is empty and we create it
+
+ j[key] = value;
+
+ std::string s = j.dump();
+ std::ofstream myfile2;
+ myfile2.open (_propertiesName);
+ myfile2 << s;
+ myfile2.close();
+ }
+
+ /** \copydoc tools::collections::Collection::getProperty */
+ std::string getProperty (const std::string& key)
+ {
+ //std::cout << "CollectionFile getProperty called, key=" << key << std::endl;
+ std::string result;
+
+ std::ifstream myfile (_propertiesName);
+ std::string data, line;
+ if (myfile.is_open())
+ {
+ while ( getline (myfile,line) )
+ data += line;
+ myfile.close();
+ }
+ json::JSON j;
+ if (data.size() > 0)
+ {
+ j = json::LoadJson(data);
+ result = j[key].ToString();
+ }
+
+ return result;
+ }
private:
std::string _name;
+ std::string _propertiesName;
};
/********************************************************************************/
=====================================
gatb-core/src/gatb/tools/storage/impl/StorageFile.hpp
=====================================
--- a/gatb-core/src/gatb/tools/storage/impl/StorageFile.hpp
+++ b/gatb-core/src/gatb/tools/storage/impl/StorageFile.hpp
@@ -63,7 +63,7 @@ namespace impl {
int ok = system::impl::System::file().mkdir(folder, 0755);
if(ok != 0){
std::cout << "Error: can't create output directory (" << folder<< ")\n" << " debug, doesexist:" << system::impl::System::file().doesExistDirectory(folder);
- std::cout << "created directory " << folder << std::endl;
+ std::cout << "created directory " << folder << std::endl; // doesn't seem to be ever printed
}
}
/** We may need to create the HDF5 group. Empty name means root group, which is constructed by default. */
@@ -221,7 +221,7 @@ public:
std::string filename = file_folder + parent->getFullId('.') + std::string(".") + name;
std::string folder = system::impl::System::file().getDirectory(filename);
- std::string prefix = system::impl::System::file().getBaseName(filename);
+ std::string prefix = system::impl::System::file().getBaseName(filename) + std::string(".") + name; // because gatb's getBaseName is stupid and cuts after the last dot
if (nb == 0)
{ // if nb is 0, it means we're opening partitions and not creating them, thus we need to get the number of partitions.
=====================================
gatb-core/src/gatb/tools/storage/impl/StorageTools.hpp
=====================================
--- a/gatb-core/src/gatb/tools/storage/impl/StorageTools.hpp
+++ b/gatb-core/src/gatb/tools/storage/impl/StorageTools.hpp
@@ -118,6 +118,7 @@ public:
bloomCollection->addProperty ("nb_hash", ss2.str());
bloomCollection->addProperty ("type", bloom->getName());
bloomCollection->addProperty ("kmer_size", ss3.str());
+ bloomCollection->flush (); // R: wasn't there before but I guess this can't hurt
}
/** Load a Bloom filter from a group
=====================================
gatb-core/test/db/NIST7035_TAAGGCGA_L001_R1_001_5OK.fastq.gz deleted
=====================================
Binary files a/gatb-core/test/db/NIST7035_TAAGGCGA_L001_R1_001_5OK.fastq.gz and /dev/null differ
=====================================
gatb-core/test/db/NIST7035_TAAGGCGA_L001_R1_001_5OK.fastq.leon-ref deleted
=====================================
Binary files a/gatb-core/test/db/NIST7035_TAAGGCGA_L001_R1_001_5OK.fastq.leon-ref and /dev/null differ
=====================================
gatb-core/test/db/giab.hg002.2D_6K.fastq.gz deleted
=====================================
Binary files a/gatb-core/test/db/giab.hg002.2D_6K.fastq.gz and /dev/null differ
=====================================
gatb-core/test/unit/src/bank/TestLeon.cpp
=====================================
--- a/gatb-core/test/unit/src/bank/TestLeon.cpp
+++ b/gatb-core/test/unit/src/bank/TestLeon.cpp
@@ -62,14 +62,15 @@ class TestLeon : public Test
CPPUNIT_TEST_SUITE_GATB (TestLeon);
CPPUNIT_TEST_GATB(bank_checkLeon1);
- /*
CPPUNIT_TEST_GATB(bank_checkLeon2);
CPPUNIT_TEST_GATB(bank_checkLeon3);
CPPUNIT_TEST_GATB(bank_checkLeon4);
CPPUNIT_TEST_GATB(bank_checkLeon5);
CPPUNIT_TEST_GATB(bank_checkLeon6);
- CPPUNIT_TEST_GATB(bank_checkLeon7);
- CPPUNIT_TEST_GATB(bank_checkLeon8);*/
+
+ //removed some large files from distrib
+ // CPPUNIT_TEST_GATB(bank_checkLeon7);
+ // CPPUNIT_TEST_GATB(bank_checkLeon8);
CPPUNIT_TEST_SUITE_GATB_END();
@@ -155,10 +156,12 @@ public:
// STEP 2: compare reference and compressed version
// we open the files in read mode
+
IBank* fasBank = Bank::open (fastqFile); //BankFasta
IBank* leonBank = Bank::open (leonFile); //BankLeon
bank_compare_banks_equality(fasBank, leonBank);
+
}
/**
=====================================
gatb-core/test/unit/src/bcalm/TestBcalm.cpp
=====================================
--- /dev/null
+++ b/gatb-core/test/unit/src/bcalm/TestBcalm.cpp
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * GATB : Genome Assembly Tool Box
+ * Copyright (C) 2014 R.Chikhi, G.Rizk, E.Drezen
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*****************************************************************************/
+
+#include <CppunitCommon.hpp>
+
+#include <gatb/system/impl/System.hpp>
+
+#include <gatb/tools/math/LargeInt.hpp>
+
+#include <gatb/tools/collections/impl/IteratorFile.hpp>
+
+#include <gatb/tools/misc/api/StringsRepository.hpp>
+#include <gatb/tools/misc/impl/TimeInfo.hpp>
+
+#include <gatb/bcalm2/unionFind.hpp>
+
+#include <gatb/tools/designpattern/impl/Command.hpp>
+#include <gatb/tools/designpattern/impl/IteratorHelpers.hpp>
+
+#include <iostream>
+#include <thread>
+
+using namespace std;
+
+using namespace gatb::core::tools::misc;
+using namespace gatb::core::tools::misc::impl;
+
+using namespace gatb::core::tools::dp;
+using namespace gatb::core::tools::dp::impl;
+
+using namespace gatb::core::system;
+using namespace gatb::core::system::impl;
+
+using namespace gatb::core::tools::math;
+using namespace gatb::core::tools::dp;
+using namespace gatb::core::tools::collections::impl;
+
+extern std::string DBPATH (const string& a);
+
+/********************************************************************************/
+namespace gatb { namespace tests {
+/********************************************************************************/
+
+/** \brief Test class for genomic databases management
+ */
+class TestBcalm : public Test
+{
+ /********************************************************************************/
+ CPPUNIT_TEST_SUITE_GATB (TestBcalm);
+
+ CPPUNIT_TEST_GATB (bcalm_test1);
+ CPPUNIT_TEST_SUITE_GATB_END();
+
+public:
+
+ /********************************************************************************/
+ void setUp () {}
+ void tearDown () {}
+
+
+ /********************************************************************************/
+ void bcalm_test1 () // i wanna test de UF because it was buggy in multithreads
+ {
+ int nb_uf_elts = 3000000;
+ unionFind<uint32_t> uf(nb_uf_elts);
+
+
+ auto doJoins = [&uf](int start, int end)
+ {
+ for (int i = start; i < end; i++)
+ {
+ uf.union_(i,i+1);
+ //std::cout << "joining " << i << " " << i+1 << std::endl; // it's indeed threaded, this checks it
+ }
+
+ };
+
+ //doJoins(0,nb_uf_elts/2);
+ //doJoins(nb_uf_elts/2,nb_uf_elts-1);
+ //
+ std::thread first(doJoins,0,nb_uf_elts/3);
+ std::thread second(doJoins,nb_uf_elts/3,2*(nb_uf_elts/3));
+ std::thread third(doJoins,2*(nb_uf_elts/3),nb_uf_elts-1);
+
+ first.join();
+ second.join();
+ third.join();
+
+ int foundclass = uf.find(0); // not always 0, depends which thread starts first
+ for (int i = 1; i < nb_uf_elts; i++)
+ {
+ int ufclass = uf.find(i);
+ if (ufclass != foundclass)
+ std::cout<< "\nclass of " << i << " is " << ufclass <<std::endl;
+ CPPUNIT_ASSERT (ufclass == foundclass);
+ }
+
+ }
+
+};
+
+/********************************************************************************/
+
+CPPUNIT_TEST_SUITE_REGISTRATION (TestBcalm);
+CPPUNIT_TEST_SUITE_REGISTRATION_GATB (TestBcalm);
+
+/********************************************************************************/
+} } /* end of namespaces. */
+/********************************************************************************/
+
View it on GitLab: https://salsa.debian.org/med-team/gatb-core/commit/8e45a9a10a24b387c839913a974e40f9dff2c517
---
View it on GitLab: https://salsa.debian.org/med-team/gatb-core/commit/8e45a9a10a24b387c839913a974e40f9dff2c517
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20180514/ab88138c/attachment-0001.html>
More information about the debian-med-commit
mailing list