Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Partee committed Aug 31, 2020
0 parents commit eb584cf
Show file tree
Hide file tree
Showing 88 changed files with 16,178 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[paths]
source =
src
*/site-packages

[run]
branch = true
source =
silc
tests
parallel = true

[report]
show_missing = true
precision = 2
omit = *migrations*
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# see https://editorconfig.org/
root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
*.py[cod]
__pycache__

# third party libs
third-party/

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
wheelhouse
develop-eggs
.installed.cfg
lib
lib64
venv*/
pyvenv*/
pip-wheel-metadata/

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
.coverage.*
.pytest_cache/
nosetests.xml
coverage.xml
htmlcov

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
*.iml
*.komodoproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build

.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.benchmarks
.bootstrap
.appveyor.token
*.bak

# Mypy Cache
.mypy_cache/
10 changes: 10 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
sphinx:
configuration: docs/conf.py
formats: all
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": true
}
5 changes: 5 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Authors
=======

* HPE HPC & AI - hpe.com
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Changelog
=========

0.1.0 (2020-08-25)
------------------
121 changes: 121 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
SET(CMAKE_CXX_STANDARD 17)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
project (silc)

set(PROJECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(CPP_ROOT_FOLDER_NAME silc)
include_directories(${PROJECT_INCLUDE_DIR})


# Dependencies
# ============
find_package(xtl REQUIRED)
find_package(xtensor REQUIRED)

# # Build
# # =====


SET(INTERFACE_LIB_NAME silc)

file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS ${PROJECT_INCLUDE_DIR}/*.hpp)

add_library(${INTERFACE_LIB_NAME} INTERFACE)

message(STATUS "INSTALL_INTERFACE: ${CMAKE_INSTALL_INCLUDEDIR}")
target_include_directories(${INTERFACE_LIB_NAME} INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)



target_link_libraries(${INTERFACE_LIB_NAME}
INTERFACE xtensor)


# Python
# ============
OPTION(BUILD_PYTHON "${PROJECT_NAME} python binding" ON)
if(BUILD_PYTHON)
add_subdirectory(python)
endif()



# Tests
###########

OPTION(BUILD_TESTS "${PROJECT_NAME} test suite" ON)
# OPTION(DOWNLOAD_DOCTEST "build doctest from downloaded sources" ON)

# if(DOWNLOAD_DOCTEST)
# set(BUILD_TESTS ON)
# endif()

if(BUILD_TESTS)
add_subdirectory(test)
endif()



# Installation
# ============

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)


set(${PROJECT_NAME}_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE
STRING "install path for ${PROJECT_NAME}Config.cmake")


message(STATUS "DEST ${${PROJECT_NAME}_CMAKECONFIG_INSTALL_DIR}" )


install(TARGETS ${INTERFACE_LIB_NAME}
EXPORT ${INTERFACE_LIB_NAME}-targets)

install(EXPORT ${INTERFACE_LIB_NAME}-targets
FILE ${INTERFACE_LIB_NAME}Targets.cmake
#NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME}
)


install(DIRECTORY ${PROJECT_INCLUDE_DIR}/${CPP_ROOT_FOLDER_NAME}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})




configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${${PROJECT_NAME}_CMAKECONFIG_INSTALL_DIR})


# ${PROJECT_NAME} is header-only and does not depend on the architecture.
# Remove CMAKE_SIZEOF_VOID_P from ${PROJECT_NAME}ConfigVersion.cmake so that an ${PROJECT_NAME}Config.cmake
# generated for a 64 bit target can be used for 32 bit targets and vice versa.
set(_${PROJECT_NAME}_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
unset(CMAKE_SIZEOF_VOID_P)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion)
set(CMAKE_SIZEOF_VOID_P ${_${PROJECT_NAME}_CMAKE_SIZEOF_VOID_P})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${${PROJECT_NAME}_CMAKECONFIG_INSTALL_DIR})

install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${${PROJECT_NAME}_CMAKECONFIG_INSTALL_DIR})

configure_file(${PROJECT_NAME}.pc.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")



18 changes: 18 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
graft docs
graft src
graft tests


include .coveragerc
include .cookiecutterrc
include .editorconfig

include AUTHORS.rst
include CHANGELOG.rst
include CONTRIBUTING.rst
include LICENSE
include README.rst

include tox.ini .travis.yml .appveyor.yml .readthedocs.yml

global-exclude *.py[cod] __pycache__/* *.so *.dylib
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
========
Overview
========

SmartSim Infrastructure Library Clients
50 changes: 50 additions & 0 deletions build_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh

if [[ ! -d "./third-party" ]]; then
mkdir third-party
fi
cd third-party

# Install Hiredis
if ls ./hiredis/install/lib/libhiredis* 1>/dev/null 2>&1; then
echo "Hiredis has already been downloaded and installed"
export HIREDIS_INSTALL_PATH="$(pwd)/hiredis/install"
export LD_LIBRARY_PATH="$HIREDIS_INSTALL_PATH/lib":$LD_LIBRARY_PATH
else
if [[ ! -d "./hiredis" ]]; then
git clone https://github.com/redis/hiredis.git hiredis --branch master --depth=1
echo "Hiredis downloaded"
fi
cd hiredis
make PREFIX="$(pwd)/install"
make PREFIX="$(pwd)/install" install
cd ../
export HIREDIS_INSTALL_PATH="$(pwd)/hiredis/install"
export LD_LIBRARY_PATH="$HIREDIS_INSTALL_PATH/lib":$LD_LIBRARY_PATH
echo "Finished installing Hiredis"
fi

#Install Redis-plus-plus
if ls ./redis-plus-plus/install/lib/libredis++* 1>/dev/null 2>&1; then
echo "Redis-plus-plus has already been downloaded and installed"
export REDISPP_INSTALL_PATH="$(pwd)/redis-plus-plus/install"
export LD_LIBRARY_PATH="$REDISPP_INSTALL_PATH/lib":$LD_LIBRARY_PATH
else
if [[ ! -d "./redis-plus-plus" ]]; then
git clone https://github.com/sewenew/redis-plus-plus.git redis-plus-plus --branch master --depth=1
echo "Redis-plus-plus downloaded"
fi
cd redis-plus-plus
ex -s -c '2i|SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)' -c x CMakeLists.txt
mkdir compile
cd compile
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${HIREDIS_INSTALL_PATH}" -DCMAKE_INSTALL_PREFIX="$(pwd)/../install" ..
make -j 2
make install
cd ../../
export REDISPP_INSTALL_PATH="$(pwd)/redis-plus-plus/install"
export LD_LIBRARY_PATH="$REDISPP_INSTALL_PATH/lib":$LD_LIBRARY_PATH
echo "Finished installing Redis-plus-plus"
fi

cd ../
10 changes: 10 additions & 0 deletions cmake/modules/FindDOCTEST.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
find_path(DOCTEST_INCLUDE_DIR doctest.h)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DOCTEST DEFAULT_MSG DOCTEST_INCLUDE_DIR)

if(DOCTEST_FOUND)
set(DOCTEST_INCLUDE_DIRS ${DOCTEST_INCLUDE_DIR})
endif(DOCTEST_FOUND)

mark_as_advanced( DOCTEST_INCLUDE_DIR)
52 changes: 52 additions & 0 deletions cmake/modules/FindNUMPY.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Find the Python NumPy package
# PYTHON_NUMPY_INCLUDE_DIR
# NUMPY_FOUND
# will be set by this script


find_package(pybind11 REQUIRED)
include_directories(${pybind11_INCLUDE_DIRS})


if(NUMPY_FIND_QUIETLY)
find_package(PythonInterp)
else()
find_package(PythonInterp QUIET)
set(_numpy_out 1)
endif()

if (PYTHON_EXECUTABLE)
# write a python script that finds the numpy path
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/FindNumpyPath.py
"from __future__ import print_function\n"
"try: import numpy; print(numpy.get_include())\nexcept:pass\n")

# execute the find script
exec_program("${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}
ARGS "FindNumpyPath.py"
OUTPUT_VARIABLE NUMPY_PATH)
elseif(_numpy_out)
message(STATUS "Python executable not found.")
endif(PYTHON_EXECUTABLE)






find_path(PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h
"${NUMPY_PATH}"
"${PYTHON_INCLUDE_PATH}"
/usr/include/python2.7/
/usr/include/python2.6/
/usr/include/python2.5/
/usr/include/python2.4/)

#message(STATUS "the numpy path is: ${NUMPY_PATH}")

if(PYTHON_NUMPY_INCLUDE_DIR)
set(PYTHON_NUMPY_FOUND 1 CACHE INTERNAL "Python numpy found")
endif(PYTHON_NUMPY_INCLUDE_DIR)

#include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( NUMPY DEFAULT_MSG PYTHON_NUMPY_INCLUDE_DIR)
Loading

0 comments on commit eb584cf

Please sign in to comment.