Skip to content

Commit

Permalink
Zmiana makefile i cpuid pod army
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandeorowicz authored and marekkokot committed Mar 10, 2023
1 parent 89ddf81 commit b1db4ed
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 24 deletions.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
all: kmc kmc_dump kmc_tools py_kmc_api

UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
UNAME_P := $(shell uname -p)

KMC_MAIN_DIR = kmc_core
KMC_CLI_DIR = kmc_CLI
Expand All @@ -12,6 +14,25 @@ PY_KMC_API_DIR = py_kmc_api
OUT_BIN_DIR = bin
OUT_INCLUDE_DIR = include

D_OS =
D_ARCH =

ifeq ($(UNAME_S),Darwin)
D_OS = MACOS
else
D_OS = LINUX
endif

ifeq ($(UNAME_M,arm64)
D_ARCH = ARM64
endif
ifeq ($(UNAME_M,aarch64)
D_ARCH = ARM64
endif
ifeq ($(UNAME_M,x86_64)
D_ARCH = X64
endif

ifeq ($(UNAME_S),Darwin)
CC = g++-11

Expand Down Expand Up @@ -51,7 +72,12 @@ $(KMC_MAIN_DIR)/kb_collector.o \
$(KMC_MAIN_DIR)/kmc_runner.o

ifeq ($(UNAME_S),Darwin)
ifeq ($(ARCH),ARM64)
RADULS_OBJS = \
$(KMC_MAIN_DIR)/raduls_neon.o
else
RADULS_OBJS =
endif

KMC_LIBS = \
$(KMC_MAIN_DIR)/libs/libz.1.2.5.dylib \
Expand All @@ -62,12 +88,17 @@ ifeq ($(UNAME_S),Darwin)
$(KMC_TOOLS_DIR)/libs/libbz2.1.0.5.dylib

LIB_KMC_CORE = $(OUT_BIN_DIR)/libkmc_core.mac.a
else
ifeq ($(ARCH),ARM64)
RADULS_OBJS = \
$(KMC_MAIN_DIR)/raduls_neon.o
else
RADULS_OBJS = \
$(KMC_MAIN_DIR)/raduls_sse2.o \
$(KMC_MAIN_DIR)/raduls_sse41.o \
$(KMC_MAIN_DIR)/raduls_avx2.o \
$(KMC_MAIN_DIR)/raduls_avx.o
endif

KMC_LIBS = \
$(KMC_MAIN_DIR)/libs/libz.a \
Expand Down
8 changes: 4 additions & 4 deletions kmc_CLI/kmc_CLI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
10 changes: 10 additions & 0 deletions kmc_core/cpu_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ static struct CpuInfoImpl {
bool sse4_2 = false;
bool avx = false;
bool avx2 = false;
bool neon = false;

string vendor, brand;

#if defined(__aarch64__)
CpuInfoImpl()
{
neon = true;
}
#else
void cpuid(int *result, int function_id) const
{
#ifdef _MSC_VER
Expand Down Expand Up @@ -123,6 +131,7 @@ static struct CpuInfoImpl {
computed = true;
return brand;
}
#endif
} cpu_info_impl;

const string& CCpuInfo::GetVendor()
Expand All @@ -143,5 +152,6 @@ bool CCpuInfo::SSE41_Enabled() { return cpu_info_impl.sse4_1; }
bool CCpuInfo::SSE42_Enabled() { return cpu_info_impl.sse4_2; }
bool CCpuInfo::AVX_Enabled() { return cpu_info_impl.avx; }
bool CCpuInfo::AVX2_Enabled() { return cpu_info_impl.avx2; }
bool CCpuInfo::NEON_Enabled() { return cpu_info_impl.neon; }

// ***** EOF
2 changes: 2 additions & 0 deletions kmc_core/cpu_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class CCpuInfo
static bool SSE42_Enabled();
static bool AVX_Enabled();
static bool AVX2_Enabled();

static bool NEON_Enabled();

};

Expand Down
8 changes: 4 additions & 4 deletions kmc_core/kmc_core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
3 changes: 3 additions & 0 deletions kmc_core/raduls.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace RadulsSort

template<typename KMER_T>
void RadixSortMSD_AVX2(KMER_T* kmers, KMER_T* tmp, uint64 n_recs, uint32 byte, uint32 n_threads, CMemoryPool* pmm_radix_buf);

template<typename KMER_T>
void RadixSortMSD_NEON(KMER_T* kmers, KMER_T* tmp, uint64 n_recs, uint32 byte, uint32 n_threads, CMemoryPool* pmm_radix_buf);
}

#endif // RADULS_H
Expand Down
2 changes: 2 additions & 0 deletions kmc_core/raduls_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ namespace RadulsSort
#define RADULS_RADIX_SORT_FUNNAME RadixSortMSD_SSE41
#elif defined(__SSE2__)
#define RADULS_RADIX_SORT_FUNNAME RadixSortMSD_SSE2
#elif defined(__NEON__)
#define RADULS_RADIX_SORT_FUNNAME RadixSortMSD_NEON
#endif


Expand Down
13 changes: 13 additions & 0 deletions kmc_core/raduls_neon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
This file is a part of KMC software distributed under GNU GPL 3 licence.
The homepage of the KMC project is http://sun.aei.polsl.pl/kmc
Authors: Sebastian Deorowicz, Agnieszka Debudaj-Grabysz, Marek Kokot
Version: 3.2.1
Date : 2022-01-04
*/

#include "raduls_impl.h"

// ***** EOF
8 changes: 4 additions & 4 deletions kmc_dump/kmc_dump.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
Expand Down
8 changes: 4 additions & 4 deletions kmc_dump_sample/kmc_dump_sample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
Expand Down
8 changes: 4 additions & 4 deletions kmc_tools/kmc_tools.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions py_kmc_api/py_kmc_api.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down

0 comments on commit b1db4ed

Please sign in to comment.