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

Working on distributed LRA implementation #994

Merged
merged 11 commits into from Jul 27, 2019
25 changes: 25 additions & 0 deletions .circleci/config.yml
Expand Up @@ -405,6 +405,27 @@ jobs:
path: tests.unit.plugins.controls
- store_artifacts:
path: tests.unit.plugins.controls
tests.unit.plugins.dist_matrixops:
<<: *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_matrixops
- run:
name: Build DistMatrixOps primitive plugin unit tests
command: cmake --build . -- -j1 tests.unit.plugins.dist_matrixops
- run:
name: Run DistMatrixOps primitive plugin unit tests
command: ctest -T test --no-compress-output --output-on-failure -R tests.unit.plugins.dist_matrixops
- <<: *convert_xml
- store_test_results:
path: tests.unit.plugins.dist_matrixops
- store_artifacts:
path: tests.unit.plugins.dist_matrixops
tests.unit.plugins.fileio_solvers:
<<: *docker_config
working_directory: /phylanx/build
Expand Down Expand Up @@ -654,6 +675,9 @@ workflows:
- tests.unit.plugins.controls:
requires:
- build
- tests.unit.plugins.dist_matrixops:
requires:
- build
- tests.unit.plugins.fileio_solvers:
requires:
- build
Expand Down Expand Up @@ -688,6 +712,7 @@ workflows:
- tests.unit.plugins.arithmetics
- tests.unit.plugins.booleans
- tests.unit.plugins.controls
- tests.unit.plugins.dist_matrixops
- tests.unit.plugins.fileio_solvers
- tests.unit.plugins.keras_support
- tests.unit.plugins.listops
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -17,3 +17,5 @@ build*/
.vscode/
cmake-build-*
phylanx.egg-info/
/tests/unit/execution_tree/images
/tests/unit/plugins/controls/images
198 changes: 198 additions & 0 deletions cmake/Phylanx_AddLibrary.cmake
@@ -0,0 +1,198 @@
# Copyright (c) 2019 Hartmut Kaiser
#
# 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)

function(add_phylanx_library name)
# retrieve arguments
set(options EXCLUDE_FROM_ALL NOLIBS AUTOGLOB STATIC PLUGIN NONAMEPREFIX)
set(one_value_args FOLDER SOURCE_ROOT HEADER_ROOT SOURCE_GLOB HEADER_GLOB OUTPUT_SUFFIX INSTALL_SUFFIX)
set(multi_value_args SOURCES HEADERS AUXILIARY DEPENDENCIES COMPONENT_DEPENDENCIES COMPILER_FLAGS LINK_FLAGS)
cmake_parse_arguments(${name} "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})

if(NOT ${name}_SOURCE_ROOT)
set(${name}_SOURCE_ROOT ".")
endif()
phylanx_debug("add_library.${name}" "${name}_SOURCE_ROOT: ${${name}_SOURCE_ROOT}")

if(NOT ${name}_HEADER_ROOT)
set(${name}_HEADER_ROOT ".")
endif()
phylanx_debug("add_library.${name}" "${name}_HEADER_ROOT: ${${name}_HEADER_ROOT}")

if(${${name}_AUTOGLOB})
if(NOT ${name}_SOURCE_GLOB)
set(${name}_SOURCE_GLOB "${${name}_SOURCE_ROOT}/*.cpp")
endif()
phylanx_debug("add_library.${name}" "${name}_SOURCE_GLOB: ${${name}_SOURCE_GLOB}")

add_phylanx_library_sources(${name}
GLOB_RECURSE GLOBS "${${name}_SOURCE_GLOB}")

set(${name}_SOURCES ${${name}_SOURCES})
add_phylanx_source_group(
NAME ${name}
CLASS "Source Files"
ROOT ${${name}_SOURCE_ROOT}
TARGETS ${${name}_SOURCES})

if(NOT ${name}_HEADER_GLOB)
set(${name}_HEADER_GLOB "${${name}_HEADER_ROOT}/*.hpp"
"${${name}_HEADER_ROOT}/*.h")
endif()
phylanx_debug("add_library.${name}" "${name}_HEADER_GLOB: ${${name}_HEADER_GLOB}")

add_phylanx_library_headers(${name}
GLOB_RECURSE GLOBS "${${name}_HEADER_GLOB}")

set(${name}_HEADERS ${${name}_HEADERS})
add_phylanx_source_group(
NAME ${name}
CLASS "Header Files"
ROOT ${${name}_HEADER_ROOT}
TARGETS ${${name}_HEADERS})
else()
add_phylanx_library_sources_noglob(${name}
SOURCES "${${name}_SOURCES}")

add_phylanx_source_group(
NAME ${name}
CLASS "Source Files"
ROOT ${${name}_SOURCE_ROOT}
TARGETS ${${name}_SOURCES})

add_phylanx_library_headers_noglob(${name}
HEADERS "${${name}_HEADERS}")

add_phylanx_source_group(
NAME ${name}
CLASS "Header Files"
ROOT ${${name}_HEADER_ROOT}
TARGETS ${${name}_HEADERS})
endif()

phylanx_debug("DEBUG" "add_library.${name}" "Sources for ${name}" ${name}_SOURCES)
phylanx_debug("DEBUG" "add_library.${name}" "Headers for ${name}" ${name}_HEADERS)
phylanx_debug("DEBUG" "add_library.${name}" "Dependencies for ${name}" ${name}_DEPENDENCIES)
phylanx_debug("DEBUG" "add_library.${name}" "Component dependencies for ${name}" ${name}_COMPONENT_DEPENDENCIES)
phylanx_debug("Add primitive plugin ${name}: ${name}_HEADER_ROOT:" ${${name}_HEADER_ROOT})
phylanx_debug("Add primitive plugin ${name}: ${name}_SOURCE_ROOT:" ${${name}_SOURCE_ROOT})

set(exclude_from_all)
set(install_options)
if(${name}_EXCLUDE_FROM_ALL)
set(exclude_from_all EXCLUDE_FROM_ALL)
else()
if(${name}_PLUGIN AND NOT HPX_WITH_STATIC_LINKING)
if(MSVC)
set(install_destination ${CMAKE_INSTALL_BINDIR}/phylanx)
else()
set(install_destination ${CMAKE_INSTALL_LIBDIR}/phylanx)
endif()
set(${name}_OUTPUT_SUFFIX phylanx)
else()
set(install_destination ${CMAKE_INSTALL_LIBDIR})
endif()
if(${name}_INSTALL_SUFFIX)
set(install_destination ${${name}_INSTALL_SUFFIX})
endif()
set(_target_flags
INSTALL
INSTALL_FLAGS
DESTINATION ${install_destination}
)
endif()

if(${name}_PLUGIN)
set(_target_flags ${_target_flags} PLUGIN)
endif()
if(${name}_NONAMEPREFIX)
set(_target_flags ${_target_flags} NONAMEPREFIX)
endif()

if(${name}_STATIC)
set(${name}_linktype STATIC)
else()
if(HPX_WITH_STATIC_LINKING)
set(${name}_linktype STATIC)
else()
set(${name}_linktype SHARED)
endif()
endif()

# Manage files with .cu extension in case When Cuda Clang is used
if(PHYLANX_WITH_CUDA_CLANG)
foreach(source ${${name}_SOURCES})
get_filename_component(extension ${source} EXT)
if(${extension} STREQUAL ".cu")
SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES
LANGUAGE CXX)
endif()
endforeach()
endif()

if(PHYLANX_WITH_CUDA AND NOT PHYLANX_WITH_CUDA_CLANG)
cuda_add_library(${name} ${${name}_linktype} ${exclude_from_all}
${${name}_SOURCES} ${${name}_HEADERS} ${${name}_AUXILIARY})
else()
add_library(${name} ${${name}_linktype} ${exclude_from_all}
${${name}_SOURCES} ${${name}_HEADERS} ${${name}_AUXILIARY})
endif()

if(${name}_OUTPUT_SUFFIX)
if(MSVC)
set_target_properties(${name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release/bin/${${name}_OUTPUT_SUFFIX}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release/lib/${${name}_OUTPUT_SUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release/lib/${${name}_OUTPUT_SUFFIX}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug/bin/${${name}_OUTPUT_SUFFIX}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug/lib/${${name}_OUTPUT_SUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug/lib/${${name}_OUTPUT_SUFFIX}"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/MinSizeRel/bin/${${name}_OUTPUT_SUFFIX}"
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/MinSizeRel/lib/${${name}_OUTPUT_SUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/MinSizeRel/lib/${${name}_OUTPUT_SUFFIX}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/RelWithDebInfo/bin/${${name}_OUTPUT_SUFFIX}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/RelWithDebInfo/lib/${${name}_OUTPUT_SUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/RelWithDebInfo/lib/${${name}_OUTPUT_SUFFIX}")
else()
set_target_properties(${name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${${name}_OUTPUT_SUFFIX}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${${name}_OUTPUT_SUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${${name}_OUTPUT_SUFFIX}")
endif()
endif()

# get public and private compile options that hpx needs
if(${${name}_NOLIBS})
set(_target_flags ${_target_flags} NOLIBS)
endif()

phylanx_setup_target(
${name}
TYPE LIBRARY
NAME ${name}
EXPORT
FOLDER ${${name}_FOLDER}
COMPILE_FLAGS ${${name}_COMPILE_FLAGS}
LINK_FLAGS ${${name}_LINK_FLAGS}
DEPENDENCIES ${${name}_DEPENDENCIES}
COMPONENT_DEPENDENCIES ${${name}_COMPONENT_DEPENDENCIES}
${_target_flags}
${install_optional}
)

target_link_libraries(${name}
${HPX_TLL_PUBLIC}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES})
target_link_libraries(${name}
${HPX_TLL_PRIVATE}
blaze::blaze)
if(PHYLANX_WITH_BLAZE_TENSOR)
target_link_libraries(${name}
${HPX_TLL_PRIVATE}
BlazeTensor::BlazeTensor)
endif()

endfunction()

15 changes: 9 additions & 6 deletions cmake/Phylanx_AddPrimitivePlugin.cmake
Expand Up @@ -3,7 +3,7 @@
# 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)

macro(add_phylanx_primitive_plugin name)
function(add_phylanx_primitive_plugin name)
# retrieve arguments
set(options EXCLUDE_FROM_ALL AUTOGLOB PLUGIN STATIC)
set(one_value_args INI FOLDER SOURCE_ROOT HEADER_ROOT SOURCE_GLOB HEADER_GLOB OUTPUT_SUFFIX)
Expand Down Expand Up @@ -93,13 +93,13 @@ macro(add_phylanx_primitive_plugin name)
else()
if(${name}_PLUGIN AND NOT PHYLANX_WITH_STATIC_LINKING)
if(MSVC)
set(install_destination bin/phylanx)
set(install_destination ${CMAKE_INSTALL_BINDIR}/phylanx)
else()
set(install_destination lib/phylanx)
endif()
set(install_destination ${CMAKE_INSTALL_LIBDIR}/phylanx)
endif()
set(${name}_OUTPUT_SUFFIX phylanx)
else()
set(install_destination lib)
set(install_destination ${CMAKE_INSTALL_LIBDIR})
endif()
if(${name}_INSTALL_SUFFIX)
set(install_destination ${${name}_INSTALL_SUFFIX})
Expand All @@ -115,6 +115,9 @@ macro(add_phylanx_primitive_plugin name)
if(${name}_PLUGIN)
set(_target_flags ${_target_flags} PLUGIN)
endif()
if(${name}_NONAMEPREFIX)
set(_target_flags ${_target_flags} NONAMEPREFIX)
endif()

if(${${name}_STATIC})
set(${name}_lib_linktype STATIC)
Expand Down Expand Up @@ -198,5 +201,5 @@ macro(add_phylanx_primitive_plugin name)
BlazeTensor::BlazeTensor)
endif()

endmacro()
endfunction()

1 change: 1 addition & 0 deletions cmake/Phylanx_Utils.cmake
Expand Up @@ -12,6 +12,7 @@ phylanx_include(
AddCompileFlag
AddDefinitions
AddExecutable
AddLibrary
AddLibraryHeaders
AddLibrarySources
AddLinkFlag
Expand Down
5 changes: 4 additions & 1 deletion examples/algorithms/lra/CMakeLists.txt
@@ -1,14 +1,17 @@
# Copyright (c) 2017 Hartmut Kaiser
# Copyright (c) 2017-2019 Hartmut Kaiser
#
# 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(example_programs
lra
lra_csv
lra_csv_distributed
lra_csv_instrumented
)

set(lra_csv_distributed_PARAMETERS LOCALITIES 2)

foreach(example_program ${example_programs})

set(${example_program}_FLAGS DEPENDENCIES iostreams_component)
Expand Down
2 changes: 1 addition & 1 deletion examples/algorithms/lra/lra_csv.cpp
Expand Up @@ -140,7 +140,7 @@ int hpx_main(boost::program_options::variables_map& vm)
std::cout << "Result: \n"
<< phylanx::execution_tree::extract_numeric_value(result)
<< std::endl
<< "Calculated in :" << elapsed << " seconds" << std::endl;
<< "Calculated in: " << elapsed << " seconds" << std::endl;

return hpx::finalize();
}
Expand Down