Skip to content

Commit

Permalink
enable onnx/tf spec via cmake option
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiting Zhu <zhitingz@cs.utexas.edu>
  • Loading branch information
photoszzt committed Jul 19, 2020
1 parent 28cf533 commit 52a9476
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -16,6 +16,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

###### options ######
option(AVA_GEN_TF_SPEC "Enable cuda spec used by tensorflow" OFF)
option(AVA_GEN_ONNXRT_SPEC "Enable cuda spec used by onnxruntime" OFF)
message(STATUS "ava gen tf spec" ${AVA_GEN_TF_SPEC})
message("ava gen onnxrt spec true" ${AVA_GEN_ONNXRT_SPEC})

# Always include debug info
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-g>")

Expand Down Expand Up @@ -218,6 +224,8 @@ ExternalProject_Add(ava-spec
-Dlibconfig++_DIR:PATH=${EXTERNAL_BINARY_DIR}/libconfig/lib/cmake/libconfig
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DAVA_GEN_TF_SPEC:BOOL=${AVA_GEN_TF_SPEC}
-DAVA_GEN_ONNXRT_SPEC:BOOL=${AVA_GEN_ONNXRT_SPEC}
BUILD_ALWAYS ON
DEPENDS flatbuffers libconfig
)
Expand Down
2 changes: 2 additions & 0 deletions cava/.gitignore
Expand Up @@ -25,3 +25,5 @@ gti_nw/
cudart_nw/
onnx_dump_nw/
onnx_opt_nw/
tf_dump_nw
tf_opt_nw
15 changes: 15 additions & 0 deletions cava/CMakeLists.txt
Expand Up @@ -86,3 +86,18 @@ ExternalProject_Add(cu_nw
#)

###### Define your compilation below ######
message(STATUS "Whether to compile tensorflow spec")
if(AVA_GEN_TF_SPEC)
message(STATUS "ON")
include(samples/tensorflow/CMakeLists.txt)
else()
message(STATUS "OFF")
endif()

message(STATUS "Whether to compile onnxruntime spec")
if(AVA_GEN_ONNXRT_SPEC)
message(STATUS "ON")
include(samples/onnxruntime/CMakeLists.txt)
else()
message(STATUS "OFF")
endif()
15 changes: 1 addition & 14 deletions cava/samples/onnxruntime/CMakeLists.txt
Expand Up @@ -8,23 +8,10 @@ foreach(var ${vars})
endif()
endforeach()

project(ava-spec)
project(ava-spec-onnxruntime)

include(ExternalProject)

###### Build customized LLVM ######

ExternalProject_Add(cava
PREFIX ava-llvm
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm/build
URL "https://github.com/utcs-scea/ava-llvm/releases/download/v7.1.0/ava-llvm-release-7.1.0.tar.gz"
URL_HASH MD5=400832522ed255314d6a5848e8f7af6c
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
UPDATE_DISCONNECTED ON
)

###### Compile onnxruntime/onnx_dump.c ######

find_package(PkgConfig REQUIRED)
Expand Down
15 changes: 1 addition & 14 deletions cava/samples/tensorflow/CMakeLists.txt
Expand Up @@ -8,23 +8,10 @@ foreach(var ${vars})
endif()
endforeach()

project(ava-spec)
project(ava-spec-tf)

include(ExternalProject)

###### Build customized LLVM ######

ExternalProject_Add(cava
PREFIX ava-llvm
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm/build
URL "https://github.com/utcs-scea/ava-llvm/releases/download/v7.1.0/ava-llvm-release-7.1.0.tar.gz"
URL_HASH MD5=400832522ed255314d6a5848e8f7af6c
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
UPDATE_DISCONNECTED ON
)

###### Compile tensorflow/tf_dump.c ######

find_package(PkgConfig REQUIRED)
Expand Down

0 comments on commit 52a9476

Please sign in to comment.