Skip to content

Commit

Permalink
Use target_compile_definitions instead of CMAKE_CXX_FLAGS
Browse files Browse the repository at this point in the history
Summary: Better restrict preprocessor flag definitions for destroying cuDNN and NCCL handles to interface definitions on respective targets so we don't pollute global preprocessor definitions

Reviewed By: vineelpratap

Differential Revision: D13560905

fbshipit-source-id: 6a15dca7806e22be9ce413e8a5a6d639965791db
  • Loading branch information
jacobkahn authored and jacobkahn committed Dec 30, 2018
1 parent d82079f commit 8a86e95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include(CTest)

# ----------------------------- Setup -----------------------------
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_CXX_FLAGS "-DNO_CUDNN_DESTROY_HANDLE -DNO_NCCL_COMM_DESTROY_HANDLE")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(FLASHLIGHT_PROJECT_COMPONENT_SRC_DIR "${CMAKE_SOURCE_DIR}/flashlight") # module root
Expand Down
8 changes: 7 additions & 1 deletion flashlight/autograd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ if (FLASHLIGHT_USE_CUDA)
${CUDA_INCLUDE_DIRS}
${CUDNN_INCLUDE_DIRS}
${ArrayFire_INCLUDE_DIRS}
)
)

target_compile_definitions(
Autograd
INTERFACE
"-DNO_CUDNN_DESTROY_HANDLE"
)
endif ()


Expand Down
6 changes: 6 additions & 0 deletions flashlight/distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ if (USE_NCCL)
${MPI_CXX_INCLUDE_PATH}
${NCCL_INCLUDE_DIRS}
)

target_compile_definitions(
Distributed
INTERFACE
"-DNO_NCCL_COMM_DESTROY_HANDLE"
)
endif ()

# Distributed
Expand Down

0 comments on commit 8a86e95

Please sign in to comment.