Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory mapped iitii #4

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 7 additions & 46 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
.vscode

# CMake
CMakeCache.txt
CMakeFiles
test/Testing
test/*.cmake
test/DartConfiguration.tcl
test/external
test/Makefile
test/test_iitii
test/gnomad_benchmark
test/variants.txt
example
\#*
.#*
*~
build/
bin/
test/
.gdb_history
120 changes: 120 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Specify the minimum version for CMake

cmake_minimum_required(VERSION 3.1)

# Project's name
project(iitii)
# We build using c++14
set(CMAKE_CXX_STANDARD 14)

# Use all standard-compliant optimizations
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g")

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

# assumes clang build
# we can't reliably detect when we're using clang, so for the time being we assume
# TODO: can't we though?

# adapted from https://stackoverflow.com/questions/46414660/macos-cmake-and-openmp
# find_package(OpenMP) does not work reliably on macOS, so we do its work ourselves
set (OpenMP_C "${CMAKE_C_COMPILER}")
set (OpenMP_C_FLAGS " -Xpreprocessor -fopenmp -I/opt/local/include/libomp -I/usr/local/include -L/opt/local/lib/libomp -L/usr/local/lib")
set (OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set (OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set (OpenMP_CXX_FLAGS " -Xpreprocessor -fopenmp -I/opt/local/include/libomp -I/usr/local/include -L/opt/local/lib/libomp -L/usr/local/lib")
set (OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
set (OpenMP_libomp_LIBRARY "omp")
set (OpenMP_libgomp_LIBRARY "gomp")
set (OpenMP_libiomp5_LIBRARY "iomp5")

# and now add the OpenMP parameters to the compile flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS} -lomp")

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

find_package(OpenMP REQUIRED)

# add the flags it detects to the compile flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -fopenmp")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -fopenmp")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")

endif()

# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)

# The following folder will be included
include_directories("${PROJECT_SOURCE_DIR}")

# Add external projects
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)

# TODO: We're using INSTALL_DIR very wrong. We *should* be actually installing
# the external projects into their prefixes and working with the installed
# files. Instead we're building but not installing them and trying to work with
# the non-installed build trees.
#
# Hence the blanked out INSTALL_COMMANDs to suppress the install step.
#
# We need to NOT blank out UPDATE_COMMAND or we can never change the Git revision we point to.
# The cost of this is that we have to re-configure on every build if we do update.

# In-place Parallel Super Scalar Samplesort (IPS⁴o), header only
ExternalProject_Add(ips4o
GIT_REPOSITORY "https://github.com/vgteam/ips4o.git"
GIT_TAG "22069381cc1bf2df07ee1ff47f6b6073fcfb4508"
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND ""
CONFIGURE_COMMAND "")
ExternalProject_Get_property(ips4o SOURCE_DIR)
set(ips4o_INCLUDE "${SOURCE_DIR}")

# taywee's C++ args library, header only
ExternalProject_Add(tayweeargs
GIT_REPOSITORY "https://github.com/Taywee/args.git"
GIT_TAG "3de44ec671db452cc0c4ef86399b108939768abb"
UPDATE_COMMAND ""
INSTALL_COMMAND "")
ExternalProject_Get_property(tayweeargs SOURCE_DIR)
set(tayweeargs_INCLUDE "${SOURCE_DIR}")

ExternalProject_Add(mmap_allocator
GIT_REPOSITORY "https://github.com/ekg/mmap_allocator.git"
GIT_TAG "ed61daf094de1c2e1adbe8306287ad52da5f0264"
BUILD_IN_SOURCE TRUE
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND "make"
CONFIGURE_COMMAND "")
ExternalProject_Get_property(mmap_allocator SOURCE_DIR)
set(mmap_allocator_INCLUDE "${SOURCE_DIR}")

set(CMAKE_BUILD_TYPE Debug)

# set up our target executable and specify its dependencies and includes
add_executable(iitii
${CMAKE_SOURCE_DIR}/src/main.cpp
)
add_dependencies(iitii ips4o tayweeargs mmap_allocator)
target_include_directories(iitii PUBLIC
"${CMAKE_SOURCE_DIR}/src"
"${ips4o_INCLUDE}"
"${mmap_allocator_INCLUDE}"
"${tayweeargs_INCLUDE}")

target_link_libraries(iitii
"${mmap_allocator_INCLUDE}/libmmap_allocator.a"
"-latomic")

if (APPLE)
elseif (TRUE)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif()
25 changes: 0 additions & 25 deletions example.cc

This file was deleted.

Loading