Skip to content

Commit

Permalink
Clean up CMake files; add include/pomagma
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzo committed Aug 8, 2014
1 parent 1ff4fd0 commit 5754fc9
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 103 deletions.
22 changes: 7 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
cmake_minimum_required(VERSION 2.6)
project(pomagma)

#set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -Wsign-promo -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wno-deprecated")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -funswitch-loops -fomit-frame-pointer -pipe")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
# Set -Wno-error=unknown-pragmas when temporarily disabling -fopenmp
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unknown-pragmas")
if(DEFINED ENV{POMAGMA_NO_OPENMP})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unknown-pragmas")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPOMAGMA_ASSUME_X86")

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -DPOMAGMA_DEBUG_LEVEL=9")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1")
#add_definitions(-DPOMAGMA_DEBUG_LEVEL=0)
#add_definitions(-DNDEBUG)

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(APPLE)
set(CMAKE_CXX_COMPILER "g++-4.7")
# see http://stackoverflow.com/questions/10327939
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-avx")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-q")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

# FIXME
#find_package(Protobuf)
#include_directories(${PROTOBUF_INCLUDE_DIRS})
#include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()

enable_testing()

Expand Down
20 changes: 9 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@ all:
POMAGMA_DEBUG=1 python -m pomagma.make build
python -m pomagma.make build

set-ulimit: FORCE
$(call ulimit -c unlimited)

static-check: FORCE
find src | grep '.py$$' | grep -v '_pb2.py' | xargs pyflakes
find src | grep '.py$$' | grep -v '_pb2.py' | xargs pep8

unit-test: all set-ulimit FORCE
unit-test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-units -v
batch-test: all set-ulimit FORCE
batch-test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-atlas
h4-test: all set-ulimit FORCE
h4-test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-atlas h4
sk-test: all set-ulimit FORCE
sk-test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-atlas sk
skj-test: all set-ulimit FORCE
skj-test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-atlas skj
skrj-test: all set-ulimit FORCE
skrj-test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-atlas skrj
test: all set-ulimit FORCE
test: all FORCE
POMAGMA_DEBUG=1 python -m pomagma.make test-units -v
POMAGMA_DEBUG=1 python -m pomagma.make test-atlas

Expand All @@ -43,7 +40,8 @@ python-libs:
@$(MAKE) -C src/language all

profile:
python -m pomagma.make profile
python -m pomagma.make profile-util
python -m pomagma.make profile-surveyor
# TODO add profile for sequential & concurrent dense_set

clean: FORCE
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ that this very repo is stored in.)
- [/data](data) - generated data, mirroring an S3 bucket
- [/build](build) - destination of C++ builds
- [/pomagma](pomagma) - a symbolic link to appease `pip install -e`
- [/include/pomagma](include/pomagma) - a symbolic link to appease g++

## Installing

Expand Down
1 change: 1 addition & 0 deletions include/pomagma
27 changes: 13 additions & 14 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

set(POMAGMA_SEQUENTIAL_LIBS
tbb
hdf5
hdf5_hl
crypto ssl
protobuf
)
tbb
hdf5
hdf5_hl
crypto ssl
protobuf
)

set(POMAGMA_CONCURRENT_LIBS
tbb
hdf5
hdf5_hl
crypto ssl
protobuf
)
tbb
hdf5
hdf5_hl
crypto ssl
protobuf
)

add_subdirectory(platform)
add_subdirectory(language)
Expand Down
9 changes: 4 additions & 5 deletions src/analyst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_LIST_DIR}/messages.pb.cc
COMMAND protoc ${CMAKE_CURRENT_LIST_DIR}/messages.proto
--proto_path=${CMAKE_CURRENT_LIST_DIR}
--cpp_out=${CMAKE_CURRENT_LIST_DIR}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/messages.proto
)
)

add_executable(analyst
main.cpp
Expand All @@ -17,11 +16,11 @@ add_executable(analyst
corpus.cpp
validator.cpp
messages.pb.cc
)
)
target_link_libraries(analyst
pomagma_macrostructure
pomagma_platform_sequential
pomagma_language
${POMAGMA_SEQUENTIAL_LIBS}
zmq
)
)
7 changes: 3 additions & 4 deletions src/cartographer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_LIST_DIR}/messages.pb.cc
COMMAND protoc ${CMAKE_CURRENT_LIST_DIR}/messages.proto
--proto_path=${CMAKE_CURRENT_LIST_DIR}
--cpp_out=${CMAKE_CURRENT_LIST_DIR}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/messages.proto
)
)

add_executable(cartographer
main.cpp
Expand All @@ -29,4 +28,4 @@ target_link_libraries(cartographer
pomagma_language
${POMAGMA_SEQUENTIAL_LIBS}
zmq
)
)
7 changes: 3 additions & 4 deletions src/language/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_library(pomagma_language SHARED
language.cpp
language.pb.cc
)
)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_LIST_DIR}/language.pb.cc
COMMAND protoc ${CMAKE_CURRENT_LIST_DIR}/language.proto
--proto_path=${CMAKE_CURRENT_LIST_DIR}
--cpp_out=${CMAKE_CURRENT_LIST_DIR}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/language.proto
)
)
57 changes: 31 additions & 26 deletions src/macrostructure/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_library(pomagma_macrostructure SHARED
carrier.cpp
Expand All @@ -14,35 +13,41 @@ add_library(pomagma_macrostructure SHARED
scheduler.cpp
compact.cpp
router.cpp
)
)
set(POMAGMA_MACROSTRUCTURE_LIBS
pomagma_macrostructure
pomagma_platform_sequential
pomagma_language
${POMAGMA_SEQUENTIAL_LIBS})
${POMAGMA_SEQUENTIAL_LIBS}
)

add_executable(macrostructure_carrier_test carrier_test.cpp)
target_link_libraries(macrostructure_carrier_test
${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_carrier COMMAND macrostructure_carrier_test)

add_executable(binary_relation_test binary_relation_test.cpp)
target_link_libraries(binary_relation_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_binary_relation COMMAND binary_relation_test)

add_executable(nullary_function_test nullary_function_test.cpp)
target_link_libraries(nullary_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_nullary_function COMMAND nullary_function_test)

add_executable(injective_function_test injective_function_test.cpp)
target_link_libraries(injective_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_injective_function COMMAND injective_function_test)

add_executable(binary_function_test binary_function_test.cpp)
target_link_libraries(binary_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_binary_function COMMAND binary_function_test)

add_executable(symmetric_function_test symmetric_function_test.cpp)
target_link_libraries(symmetric_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_symmetric_function COMMAND symmetric_function_test)

add_test(NAME macrostructure_carrier
COMMAND macrostructure_carrier_test)

add_executable(macrostructure_binary_relation_test binary_relation_test.cpp)
target_link_libraries(macrostructure_binary_relation_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_binary_relation
COMMAND macrostructure_binary_relation_test)

add_executable(macrostructure_nullary_function_test nullary_function_test.cpp)
target_link_libraries(macrostructure_nullary_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_nullary_function
COMMAND macrostructure_nullary_function_test)

add_executable(macrostructure_injective_function_test injective_function_test.cpp)
target_link_libraries(macrostructure_injective_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_injective_function
COMMAND macrostructure_injective_function_test)

add_executable(macrostructure_binary_function_test binary_function_test.cpp)
target_link_libraries(macrostructure_binary_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_binary_function
COMMAND macrostructure_binary_function_test)

add_executable(macrostructure_symmetric_function_test symmetric_function_test.cpp)
target_link_libraries(macrostructure_symmetric_function_test ${POMAGMA_MACROSTRUCTURE_LIBS})
add_test(NAME macrostructure_symmetric_function
COMMAND macrostructure_symmetric_function_test)
13 changes: 6 additions & 7 deletions src/microstructure/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_library(pomagma_microstructure SHARED
carrier.cpp
Expand All @@ -12,20 +11,22 @@ add_library(pomagma_microstructure SHARED
sampler.cpp
structure.cpp
scheduler.cpp
)
)
set(POMAGMA_MICROSTRUCTURE_LIBS
pomagma_microstructure
pomagma_platform_concurrent
pomagma_language
${POMAGMA_CONCURRENT_LIBS})
${POMAGMA_CONCURRENT_LIBS}
)

add_library(pomagma_microstructure_dummy SHARED dummy.theory.cpp)
set(POMAGMA_MICROSTRUCTURE_TEST_LIBS
pomagma_microstructure
pomagma_microstructure_dummy
pomagma_platform_concurrent
pomagma_language
${POMAGMA_CONCURRENT_LIBS})
${POMAGMA_CONCURRENT_LIBS}
)

add_executable(microstructure_carrier_test carrier_test.cpp)
target_link_libraries(microstructure_carrier_test ${POMAGMA_MICROSTRUCTURE_TEST_LIBS})
Expand All @@ -42,8 +43,6 @@ target_link_libraries(microstructure_nullary_function_test ${POMAGMA_MICROSTRUCT
add_test(NAME microstructure_nullary_function
COMMAND microstructure_nullary_function_test)

# TODO either omit the microstructure_ prefix on tests
# or add a macrostructure_ prefix to macrostructure tests.
add_executable(microstructure_injective_function_test injective_function_test.cpp)
target_link_libraries(microstructure_injective_function_test ${POMAGMA_MICROSTRUCTURE_TEST_LIBS})
add_test(NAME microstructure_injective_function
Expand Down
7 changes: 3 additions & 4 deletions src/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_library(pomagma_platform_sequential SHARED
util.cpp
aligned_alloc.cpp
sequential/dense_set.cpp
hdf5.cpp
)
)

add_library(pomagma_platform_concurrent SHARED
util.cpp
aligned_alloc.cpp
concurrent/dense_set.cpp
hdf5.cpp
)
)

add_executable(threading_profile threading_profile.cpp)
target_link_libraries(threading_profile
Expand Down
Loading

0 comments on commit 5754fc9

Please sign in to comment.