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

[WIP] Change the CMakeLists.txt to output phylanx wheel #1204

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0a0b597
Adding a modulus operation
stevenrbrandt Jun 23, 2020
c959c32
Merge branch 'master' into mod-operation
stevenrbrandt Jun 23, 2020
762e888
Formatting
rtohid Jun 23, 2020
a55dd9f
Get rid of class named "base," add a python test.
stevenrbrandt Jun 24, 2020
7ba9545
Merge branch 'master' into mod-operation
stevenrbrandt Jun 24, 2020
6bb5907
Merge branch 'mod-operation' of https://github.com/STEllAR-GROUP/phyl…
stevenrbrandt Jun 24, 2020
f334a4b
Add missing file
stevenrbrandt Jun 24, 2020
bdf8876
Remove trailing whitespace
stevenrbrandt Jun 25, 2020
4ac3157
Added space
stevenrbrandt Jun 25, 2020
cd73889
Add copyright to test file.
stevenrbrandt Jun 25, 2020
1f65041
Merge branch 'master' into mod-operation
stevenrbrandt Jun 27, 2020
2a0404c
Change the CMakeLists.txt to output phylanx wheel
git-kale Jun 28, 2020
8a20cef
Initial commit to dist_keras_support
taless474 Jun 27, 2020
f10598c
Add tests for data parallelization
taless474 Jun 29, 2020
6dd4d08
Initial attempt to implement spatial parallelization with same padding
taless474 Jun 30, 2020
518dbb5
Add spatial parallelization having causal padding
taless474 Jul 1, 2020
5ef1f38
Add more tests
taless474 Jul 1, 2020
2b4df10
Modify to use the given name for the result
taless474 Jul 1, 2020
d48b611
Merge pull request #1205 from STEllAR-GROUP/conv1d_d
hkaiser Jul 2, 2020
b2405da
Merge pull request #1197 from STEllAR-GROUP/mod-operation
hkaiser Jul 2, 2020
9adfa99
Use shared_ptr to an array only if it's supported
hkaiser Jul 2, 2020
c553b3f
Merge pull request #1207 from STEllAR-GROUP/fixing_shared_ptr_array
hkaiser Jul 3, 2020
8e728ac
Properly propagate annotations for logical operations primitives
hkaiser Jul 14, 2020
f417cb7
Merge pull request #1210 from STEllAR-GROUP/logical_ops_annotations
hkaiser Jul 17, 2020
9fe37b4
Moving mod_operation to arithmetics plugin
hkaiser Jul 17, 2020
d9bf0d4
Merge pull request #1212 from STEllAR-GROUP/moving_mod_operation
hkaiser Jul 18, 2020
e7a26eb
Adding timer() primitive
hkaiser Jul 17, 2020
022a351
Fixing empty argument function invocation
hkaiser Jul 19, 2020
e1e5680
Merge pull request #1213 from STEllAR-GROUP/timer_primitive
hkaiser Jul 22, 2020
9523c0b
Adding long_description of Phylanx package
git-kale Jul 28, 2020
1e31a40
Merge branch 'phylanx-wheel' of https://github.com/git-kale/phylanx i…
git-kale Jul 28, 2020
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
25 changes: 25 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,27 @@ jobs:
path: tests.unit.plugins.controls
- store_artifacts:
path: tests.unit.plugins.controls
tests.unit.plugins.dist_keras_support:
<<: *docker_config
working_directory: /phylanx/build
steps:
- <<: *attach_phylanx_tree
- <<: *avoid_cmake_rerun
- <<: *justify_building_all
- run:
name: Justify build
command: ninja -n -d explain tests.unit.plugins.dist_keras_support
- run:
name: Build DistKerasSupport primitive plugin unit tests
command: cmake --build . -- -j1 tests.unit.plugins.dist_keras_support
- run:
name: Run DistKerasSupport primitive plugin unit tests
command: ctest -T test --no-compress-output --output-on-failure -R tests.unit.plugins.dist_keras_support
- <<: *convert_xml
- store_test_results:
path: tests.unit.plugins.dist_keras_support
- store_artifacts:
path: tests.unit.plugins.dist_keras_support
tests.unit.plugins.dist_matrixops:
<<: *docker_config
working_directory: /phylanx/build
Expand Down Expand Up @@ -678,6 +699,9 @@ workflows:
- tests.unit.plugins.controls:
requires:
- build
- tests.unit.plugins.dist_keras_support:
requires:
- build
- tests.unit.plugins.dist_matrixops:
requires:
- build
Expand Down Expand Up @@ -715,6 +739,7 @@ workflows:
- tests.unit.plugins.arithmetics
- tests.unit.plugins.booleans
- tests.unit.plugins.controls
- tests.unit.plugins.dist_keras_support
- tests.unit.plugins.dist_matrixops
- tests.unit.plugins.fileio_solvers
- tests.unit.plugins.keras_support
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ endif()
phylanx_info("CMake version: " ${CMAKE_VERSION})
phylanx_info("Phylanx version: " ${PHYLANX_VERSION})

# ##############################################################################
# C++ feature tests
# ##############################################################################
include(Phylanx_PerformCxxFeatureTests)
phylanx_perform_cxx_feature_tests()

################################################################################
# Locate HPX as we need to ensure to use at least the same C++ dialect as HPX uses
phylanx_setup_hpx()
Expand Down
246 changes: 246 additions & 0 deletions cmake/Phylanx_AddConfigTests.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
# Copyright (c) 2011 Bryce Lelbach
# Copyright (c) 2014 Thomas Heller
# Copyright (c) 2020 Hartmut Kaiser
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

set(PHYLANX_ADDCONFIGTEST_LOADED TRUE)

include(CheckLibraryExists)

function(add_phylanx_config_test variable)
set(options FILE EXECUTE)
set(one_value_args SOURCE ROOT CMAKECXXFEATURE)
set(multi_value_args
INCLUDE_DIRECTORIES
LINK_DIRECTORIES
COMPILE_DEFINITIONS
LIBRARIES
ARGS
DEFINITIONS
REQUIRED
)
cmake_parse_arguments(
${variable} "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}
)

set(_run_msg)
# Check CMake feature tests if the user didn't override the value of this
# variable:
if(NOT DEFINED ${variable})
if(${variable}_CMAKECXXFEATURE)
# We don't have to run our own feature test if there is a corresponding
# cmake feature test and cmake reports the feature is supported on this
# platform.
list(FIND CMAKE_CXX_COMPILE_FEATURES ${${variable}_CMAKECXXFEATURE} __pos)
if(NOT ${__pos} EQUAL -1)
set(${variable}
TRUE
CACHE INTERNAL ""
)
set(_run_msg "Success (cmake feature test)")
endif()
endif()
endif()

if(NOT DEFINED ${variable})
file(MAKE_DIRECTORY
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/config_tests"
)

string(TOLOWER "${variable}" variable_lc)
if(${variable}_FILE)
if(${variable}_ROOT)
set(test_source "${${variable}_ROOT}/share/phylanx/${${variable}_SOURCE}")
else()
set(test_source "${PROJECT_SOURCE_DIR}/${${variable}_SOURCE}")
endif()
else()
set(test_source
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/config_tests/${variable_lc}.cpp"
)
file(WRITE "${test_source}" "${${variable}_SOURCE}\n")
endif()
set(test_binary
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/config_tests/${variable_lc}
)

get_directory_property(CONFIG_TEST_INCLUDE_DIRS INCLUDE_DIRECTORIES)
get_directory_property(CONFIG_TEST_LINK_DIRS LINK_DIRECTORIES)
set(COMPILE_DEFINITIONS_TMP)
set(CONFIG_TEST_COMPILE_DEFINITIONS)
get_directory_property(COMPILE_DEFINITIONS_TMP COMPILE_DEFINITIONS)
foreach(def IN LISTS COMPILE_DEFINITIONS_TMP
${variable}_COMPILE_DEFINITIONS
)
set(CONFIG_TEST_COMPILE_DEFINITIONS
"${CONFIG_TEST_COMPILE_DEFINITIONS} -D${def}"
)
endforeach()
get_property(
PHYLANX_TARGET_COMPILE_OPTIONS_PUBLIC_VAR GLOBAL
PROPERTY phylanx_TARGET_COMPILE_OPTIONS_PUBLIC
)
get_property(
PHYLANX_TARGET_COMPILE_OPTIONS_PRIVATE_VAR GLOBAL
PROPERTY phylanx_TARGET_COMPILE_OPTIONS_PRIVATE
)
set(PHYLANX_TARGET_COMPILE_OPTIONS_VAR
${PHYLANX_TARGET_COMPILE_OPTIONS_PUBLIC_VAR}
${PHYLANX_TARGET_COMPILE_OPTIONS_PRIVATE_VAR}
)
foreach(_flag ${PHYLANX_TARGET_COMPILE_OPTIONS_VAR})
if(NOT "${_flag}" MATCHES "^\\$.*")
set(CONFIG_TEST_COMPILE_DEFINITIONS
"${CONFIG_TEST_COMPILE_DEFINITIONS} ${_flag}"
)
endif()
endforeach()

set(CONFIG_TEST_INCLUDE_DIRS ${CONFIG_TEST_INCLUDE_DIRS}
${${variable}_INCLUDE_DIRECTORIES}
)
set(CONFIG_TEST_LINK_DIRS ${CONFIG_TEST_LINK_DIRS}
${${variable}_LINK_DIRECTORIES}
)

if(${variable}_EXECUTE)
if(NOT CMAKE_CROSSCOMPILING)
# cmake-format: off
try_run(
${variable}_RUN_RESULT ${variable}_COMPILE_RESULT
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/config_tests
${test_source}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${CONFIG_TEST_INCLUDE_DIRS}"
"-DLINK_DIRECTORIES=${CONFIG_TEST_LINK_DIRS}"
"-DLINK_LIBRARIES=${CONFIG_TEST_LINK_LIBRARIES}"
"-DCOMPILE_DEFINITIONS=${CONFIG_TEST_COMPILE_DEFINITIONS}"
CXX_STANDARD ${phylanx_CXX_STANDARD}
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS FALSE
RUN_OUTPUT_VARIABLE ${variable}_OUTPUT
ARGS ${${variable}_ARGS}
)
# cmake-format: on
if(${variable}_COMPILE_RESULT AND NOT ${variable}_RUN_RESULT)
set(${variable}_RESULT TRUE)
else()
set(${variable}_RESULT FALSE)
endif()
else()
set(${variable}_RESULT FALSE)
endif()
else()
# cmake-format: off
try_compile(
${variable}_RESULT
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/config_tests
${test_source}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${CONFIG_TEST_INCLUDE_DIRS}"
"-DLINK_DIRECTORIES=${CONFIG_TEST_LINK_DIRS}"
"-DLINK_LIBRARIES=${CONFIG_TEST_LINK_LIBRARIES}"
"-DCOMPILE_DEFINITIONS=${CONFIG_TEST_COMPILE_DEFINITIONS}"
OUTPUT_VARIABLE ${variable}_OUTPUT
CXX_STANDARD ${phylanx_CXX_STANDARD}
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS FALSE
COPY_FILE ${test_binary}
)
# cmake-format: on
phylanx_debug("Compile test: ${variable}")
phylanx_debug("Compilation output: ${${variable}_OUTPUT}")
endif()

set(_run_msg "Success")
else()
set(${variable}_RESULT ${${variable}})
if(NOT _run_msg)
set(_run_msg "pre-set to ${${variable}}")
endif()
endif()

string(TOUPPER "${variable}" variable_uc)
set(_msg "Performing Test ${variable_uc}")

if(${variable}_RESULT)
set(_msg "${_msg} - ${_run_msg}")
else()
set(_msg "${_msg} - Failed")
endif()

set(${variable}
${${variable}_RESULT}
CACHE INTERNAL ""
)
phylanx_info(${_msg})

if(${variable}_RESULT)
foreach(definition ${${variable}_DEFINITIONS})
phylanx_add_config_define(${definition})
endforeach()
elseif(${variable}_REQUIRED)
phylanx_warn("Test failed, detailed output:\n\n${${variable}_OUTPUT}")
phylanx_error(${${variable}_REQUIRED})
endif()
endfunction()

# Makes it possible to provide a feature test that is able to test the compiler
# to build parts of phylanx directly when the given definition is defined.
function(add_phylanx_in_framework_config_test variable)
# Generate the config only if the test wasn't executed yet
if(NOT DEFINED ${variable})
# Location to generate the config headers to
set(${variable}_GENERATED_DIR
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/config_tests/header-${variable}"
)
generate_config_defines_header(${${variable}_GENERATED_DIR})
endif()

set(options)
set(one_value_args)
set(multi_value_args DEFINITIONS INCLUDE_DIRECTORIES COMPILE_DEFINITIONS)
cmake_parse_arguments(
${variable} "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}
)

# We call the generic feature test method while modifying some existing parsed
# arguments in order to alter the INCLUDE_DIRECTORIES and the
# COMPILE_DEFINITIONS. It's important here not to link the config test against
# an executable because otherwise this will result in unresolved references to
# the phylanx library, that wasn't built as of now.
add_phylanx_config_test(
${variable} ${${variable}_UNPARSED_ARGUMENTS}
DEFINITIONS ${${variable}_DEFINITIONS}
COMPILE_DEFINITIONS
${${variable}_COMPILE_DEFINITIONS}
# We add the definitions we test to the existing compile definitions.
${${variable}_DEFINITIONS}
# Add PHYLANX_NO_VERSION_CHECK to make header only parts of phylanx available
# without requiring to link against the phylanx sources. We can remove this
# workaround as soon as CMake 3.6 is the minimal required version and
# supports: CMAKE_TRY_COMPILE_TARGET_TYPE = STATIC_LIBRARY when using
# try_compile to not to throw errors on unresolved symbols.
PHYLANX_NO_VERSION_CHECK
INCLUDE_DIRECTORIES
${${variable}_INCLUDE_DIRECTORIES}
# We add the generated headers to the include dirs
${${variable}_GENERATED_DIR}
)

if(DEFINED ${variable}_GENERATED_DIR)
# Cleanup the generated header
file(REMOVE_RECURSE "${${variable}_GENERATED_DIR}")
endif()
endfunction()

# ##############################################################################
function(phylanx_check_for_cxx17_shared_ptr_array)
add_phylanx_config_test(
PHYLANX_WITH_CXX17_SHARED_PTR_ARRAY
SOURCE cmake/tests/cxx17_shared_ptr_array.cpp FILE ${ARGN}
)
endfunction()
16 changes: 16 additions & 0 deletions cmake/Phylanx_PerformCxxFeatureTests.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2020 Hartmut Kaiser
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

include(Phylanx_AddConfigTests)

# ##############################################################################
# C++ feature tests
# ##############################################################################
function(phylanx_perform_cxx_feature_tests)
phylanx_check_for_cxx17_shared_ptr_array(
DEFINITIONS PHYLANX_HAVE_CXX17_SHARED_PTR_ARRAY
)
endfunction()
6 changes: 5 additions & 1 deletion cmake/templates/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class CopyBuildExt(build_ext):
print("copying {} -> {}".format(source_path, extdir))
shutil.copyfile(source_path, os.path.join(extdir, filename))

with open(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+'/README.md') as f:
README = f.read()

setup_args = {
'name': 'phylanx',
Expand All @@ -63,7 +65,8 @@ setup_args = {
'author_email': '[email protected]',
'url': 'phylanx.stellar-group.org',
'description': 'A Python wrapper for the Phylanx execution engine',
'long_description': '',
'long_description': README,
'long_description_content_type':'text/markdown',
'packages': ['phylanx', 'phylanx.ast', 'phylanx.execution_tree',
'phylanx.core', 'phylanx.util', 'phylanx.plugins'],
'package_dir': {'': '@PYTHON_PACKAGE_BASE_DIR@'},
Expand All @@ -72,6 +75,7 @@ setup_args = {
'@PYTHON_PACKAGE_BASE_DIR@',
'@PYTHON_BINARY_BASE_DIR@')
],
'install_requires': ['numpy'],
'cmdclass': {
'build_ext': CopyBuildExt
},
Expand Down
14 changes: 14 additions & 0 deletions cmake/tests/cxx17_shared_ptr_array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2020 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <memory>

int main()
{
std::shared_ptr<int[]> p (new int[10]);

return 0;
}
2 changes: 1 addition & 1 deletion examples/algorithms/kmeans/kmeans_fix_points.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2018 Parsa Amini
// Copyright (c) 2018-2010 Hartmut Kaiser
// Copyright (c) 2018-2020 Hartmut Kaiser
// Copyright (c) 2020 Bita Hasheminezhad
//
// Distributed under the Boost Software License, Version 1.0.0. (See accompanying
Expand Down
2 changes: 1 addition & 1 deletion examples/algorithms/kmeans/kmeans_fix_points_3d.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2018 Parsa Amini
// Copyright (c) 2018-2010 Hartmut Kaiser
// Copyright (c) 2018-2020 Hartmut Kaiser
// Copyright (c) 2020 Bita Hasheminezhad
//
// Distributed under the Boost Software License, Version 1.0.0. (See accompanying
Expand Down
2 changes: 1 addition & 1 deletion examples/interpreter/physl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <phylanx/execution_tree/compiler/primitive_name.hpp>

#include <hpx/hpx_main.hpp>
#include <hpx/include/iostreams.hpp>
#include <hpx/distributed/iostream.hpp>

#include <fstream>
#include <iostream>
Expand Down
Loading