Skip to content

Commit

Permalink
update to public
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkokot committed Feb 8, 2024
1 parent ac308fe commit f3262a4
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
all: kmc kmc_dump kmc_tools py_kmc_api

dummy := $(shell git submodule update --init --recursive)

UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
UNAME_P := $(shell uname -p)
Expand Down Expand Up @@ -169,15 +171,15 @@ $(LIB_KMC_CORE): $(KMC_CORE_OBJS) $(RADULS_OBJS) $(KMC_API_OBJS) $(KFF_OBJS)

kmc: $(KMC_CLI_OBJS) $(LIB_KMC_CORE) $(LIB_ZLIB)
-mkdir -p $(OUT_BIN_DIR)
$(CC) $(CLINK) -o $(OUT_BIN_DIR)/$@ $^ $(LIB_ZLIB)
$(CC) $(CLINK) -o $(OUT_BIN_DIR)/$@ $^

kmc_dump: $(KMC_DUMP_OBJS) $(KMC_API_OBJS)
-mkdir -p $(OUT_BIN_DIR)
$(CC) $(CLINK) -o $(OUT_BIN_DIR)/$@ $^

kmc_tools: $(KMC_TOOLS_OBJS) $(KMC_API_OBJS) $(KFF_OBJS) $(LIB_ZLIB)
-mkdir -p $(OUT_BIN_DIR)
$(CC) $(CLINK) -I 3rd_party/cloudflare -o $(OUT_BIN_DIR)/$@ $^ $(LIB_ZLIB)
$(CC) $(CLINK) -I 3rd_party/cloudflare -o $(OUT_BIN_DIR)/$@ $^

$(PY_KMC_API_DIR)/%.o: $(KMC_API_DIR)/%.cpp
$(CC) -c -fPIC -Wall -O3 $(CPU_FLAGS) -std=c++14 $^ -o $@
Expand Down
1 change: 1 addition & 0 deletions kmc_core/kff_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <string>
#include <vector>
#include <cstdint>

template<typename T>
void StoreBigEndian(uint8_t* buff, const T& data)
Expand Down
16 changes: 14 additions & 2 deletions kmc_core/kmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1802,14 +1802,26 @@ template <unsigned SIZE> KMC::Stage2Results CKMC<SIZE>::ProcessStage2_impl()

template <unsigned SIZE> KMC::Stage1Results CKMC<SIZE>::ProcessStage1()
{
auto res = ProcessStage1_impl();
KMC::Stage1Results res;
//run on separate exception aware thread for proper exception handling
CExceptionAwareThread th([&res, this] {
res = this->ProcessStage1_impl();
});
th.join();

CThreadExceptionCollector::Inst().RethrowIfAnyException();
return res;
}

template <unsigned SIZE> KMC::Stage2Results CKMC<SIZE>::ProcessStage2()
{
auto res = ProcessStage2_impl();
KMC::Stage2Results res;
//run on separate exception aware thread for proper exception handling if exception thrown in main thread
CExceptionAwareThread th([&res, this] {
res = this->ProcessStage2_impl();
});
th.join();

CThreadExceptionCollector::Inst().RethrowIfAnyException();
return res;
}
Expand Down
12 changes: 12 additions & 0 deletions kmc_core/small_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,25 @@ class CSmallSort {

static void Adjust(uint32 max_small_size = 256)
{
static bool is_adjusted = false;
if (is_adjusted)
return;

static std::mutex mtx;
std::lock_guard<std::mutex> lck(mtx);
if (is_adjusted)
return;

PrepareArray();
EvaluateAlgorithms(max_small_size);
SmoothTimes();
SelectBestSorters();
ReleaseArray();

is_adjusted = true;
}


static void Sort(CKmer<SIZE> *ptr, uint32 size)
{
sorters[size](ptr, size);
Expand Down
1 change: 1 addition & 0 deletions kmc_tools/kff_info_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdint>

std::string CKFFInfoReader::ReadVarName()
{
Expand Down
1 change: 1 addition & 0 deletions kmc_tools/kff_info_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <limits>
#include <string>
#include <map>
#include <cstdint>


template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion kmc_tools/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ bool CParser::nextLine(std::string& line)
}
}

// ***** EOF
// ***** EOF

0 comments on commit f3262a4

Please sign in to comment.