Skip to content

Commit

Permalink
Workflow support (#82)
Browse files Browse the repository at this point in the history
Provides support for deployment of workflows. 
---------

Signed-off-by: Loic Pottier <[email protected]>
Co-authored-by: Loic Pottier <[email protected]>
  • Loading branch information
koparasy and lpottier authored Sep 18, 2024
1 parent ee7a544 commit c15e5a7
Show file tree
Hide file tree
Showing 54 changed files with 5,035 additions and 439 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ cmake_minimum_required(VERSION 3.18)
project(AMS VERSION 0.1.0 LANGUAGES CXX C)
cmake_policy(SET CMP0074 NEW)

set(CMAKE_CXX_STANDARD 14)
# NOTE: This may break some of our integrations with the applications. But flux requires > C++20, RMQ requires C++17 and although AMS does not have
# any restrictions on the CXX standard the application may impose those. The solution would be to compile RMQ with an older GCC version (8) and
# have flux to be an external of the system environment
set(CMAKE_CXX_STANDARD 17)

# Enable this to get compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
55 changes: 4 additions & 51 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,8 @@
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

file(GLOB_RECURSE AMS_CURRENT_EXAMPLE_INCLUDES "*.hpp")

set(AMS_EXAMPLE_SRC ${MINIAPP_INCLUDES} main.cpp app/eos_ams.cpp)


function(ADDExec binary_name definitions)
if (WITH_RZ)
list(APPEND AMS_EXAMPLE_SRC ${RZ_AMS_SOURCES} ${AMS_CURRENT_EXAMPLE_INCLUDES})
endif()

target_include_directories(${binary_name} PRIVATE ${AMS_EXAMPLE_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/include)
target_compile_definitions(${binary_name} PRIVATE ${definitions})
target_link_directories(${binary_name} PRIVATE ${AMS_EXAMPLE_LIB_DIRS})
target_link_libraries(${binary_name} PUBLIC AMS ${AMS_EXAMPLE_LIBRARIES})

if (WITH_CUDA)
set_source_files_properties(main.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "--expt-extended-lambda")
set_source_files_properties(app/eos_ams.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(app/eos_ams.cpp PROPERTIES COMPILE_FLAGS "--expt-extended-lambda")
set_target_properties(${binary_name} PROPERTIES CUDA_ARCHITECTURES "${AMS_CUDA_ARCH}")

if (WITH_RZ)
set_source_files_properties(${RZ_AMS_SOURCES} PROPERTIES LANGUAGE CUDA)
set_source_files_properties(${RZ_AMS_SOURCES} PROPERTIES COMPILE_FLAGS "--expt-extended-lambda")
set_property(TARGET ${binary_name} PROPERTY CUDA_SEPARABLE_COMPILATION ON)
endif()

if (WITH_PERFFLOWASPECT)
set_property(SOURCE ${AMS_EXAMPLE_SRC} APPEND_STRING PROPERTY COMPILE_FLAGS " -Xcompiler=-Xclang -Xcompiler=-load -Xcompiler=-Xclang -Xcompiler=${PERFFLOWASPECT_LIB_DIR}/libWeavePass.so")
endif()
endif()
endfunction()

add_executable(no_ams_example ${AMS_EXAMPLE_SRC} ${MINIAPP_INCLUDES})
ADDExec(no_ams_example "${AMS_EXAMPLE_DEFINES}")

list(APPEND AMS_EXAMPLE_DEFINES "-DUSE_AMS")
add_executable(ams_example ${AMS_EXAMPLE_SRC} ${MINIAPP_INCLUDES})
ADDExec(ams_example "${AMS_EXAMPLE_DEFINES}")

if (WITH_WORKFLOW)
set(TRAIN_DEVICE "cpu")
if (WITH_CUDA)
set(TRAIN_DEVICE "gpu")
endif()
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/prune.py" "${CMAKE_CURRENT_BINARY_DIR}/prune.py")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/train.py" "${CMAKE_CURRENT_BINARY_DIR}/train.py")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/sub_selection.py" "${CMAKE_CURRENT_BINARY_DIR}/sub_selection.py")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/example_run.sh" "${CMAKE_CURRENT_BINARY_DIR}/example_run.sh" @ONLY)
add_subdirectory(ideal_gas)
if (WITH_CUDA)
add_subdirectory(bnm_opt)
endif()

27 changes: 27 additions & 0 deletions examples/bnm_opt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021-2023 Lawrence Livermore National Security, LLC and other
# AMSLib Project Developers
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set(binomial_options_src binomial_options.cpp kernel.cpp)

function(ADDExec binary_name definitions)
target_include_directories(${binary_name} PUBLIC "${AMS_EXAMPLE_INCLUDES}")
target_compile_definitions(${binary_name} PRIVATE ${definitions})
target_compile_definitions(${binary_name} PRIVATE ${AMS_EXAMPLE_DEFINES})
target_link_directories(${binary_name} PRIVATE ${AMS_EXAMPLE_LIB_DIRS})
target_link_libraries(${binary_name} PUBLIC AMS ${AMS_EXAMPLE_LIBRARIES})

if (WITH_CUDA)
set_source_files_properties(kernel.cpp PROPERTIES LANGUAGE CUDA)
set_target_properties(${binary_name} PROPERTIES CUDA_ARCHITECTURES "${AMS_CUDA_ARCH}")
endif()
endfunction()

add_executable(no_ams_bo ${binomial_options_src} ${MINIAPP_INCLUDES})
ADDExec(no_ams_bo minibude "${AMS_EXAMPLE_DEFINES}")

list(APPEND AMS_EXAMPLE_DEFINES "-DUSE_AMS")
add_executable(ams_bo ${binomial_options_src} ${MINIAPP_INCLUDES})
ADDExec(ams_bo "${AMS_EXAMPLE_DEFINES}")

40 changes: 40 additions & 0 deletions examples/bnm_opt/binomialOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 1993-2015 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*
*/


#ifndef BINOMIALOPTIONS_COMMON_H
#define BINOMIALOPTIONS_COMMON_H

#include "realtype.h"

////////////////////////////////////////////////////////////////////////////////
// Global types
////////////////////////////////////////////////////////////////////////////////
typedef struct {
real S;
real X;
real T;
real R;
real V;
} TOptionData;


////////////////////////////////////////////////////////////////////////////////
// Global parameters
////////////////////////////////////////////////////////////////////////////////
//Number of time steps
#define NUM_STEPS 2048
//Max option batch size
#define MAX_OPTIONS 1024

#define NUM_ITERATIONS 20

#endif
Loading

0 comments on commit c15e5a7

Please sign in to comment.