From 7e08614e6c5064621ceaf2502c4f186e6f862acf Mon Sep 17 00:00:00 2001 From: youben11 Date: Tue, 30 Aug 2022 15:47:30 +0100 Subject: [PATCH] build: add options to build with CUDA support --- compiler/CMakeLists.txt | 3 +++ compiler/Makefile | 10 +++++++++- compiler/lib/Runtime/CMakeLists.txt | 1 - 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt index c25367986..40d72236e 100644 --- a/compiler/CMakeLists.txt +++ b/compiler/CMakeLists.txt @@ -60,6 +60,9 @@ set_target_properties(Concrete PROPERTIES IMPORTED_LOCATION ${CONCRETE_FFI_RELEA #-------------------------------------------------------------------------------- option(CONCRETELANG_CUDA_SUPPORT "Support Concrete CUDA Execution." OFF) if(CONCRETELANG_CUDA_SUPPORT) + if (NOT DEFINED CONCRETE_CORE_PATH) + message(FATAL_ERROR "Compiling with CUDA support requires setting CONCRETE_CORE_PATH") + endif() message(STATUS "Building with Concrete CUDA execution support") include_directories(${CONCRETE_CORE_PATH}/concrete-cuda/cuda/include) add_library(ConcreteCUDA STATIC IMPORTED) diff --git a/compiler/Makefile b/compiler/Makefile index 490c0137a..d90ad9ad8 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -6,6 +6,8 @@ DATAFLOW_EXECUTION_ENABLED=OFF TIMING_ENABLED=OFF CC_COMPILER= CXX_COMPILER= +CUDA_SUPPORT=OFF +CONCRETE_CORE_PATH?= CONCRETE_OPTIMIZER_DIR ?= $(shell pwd)/concrete-optimizer @@ -59,6 +61,10 @@ else PYTHON_TESTS_MARKER="not parallel" endif +ifneq ($(CONCRETE_CORE_PATH),) + CONCRETE_CORE_PATH_OPTION=-DCONCRETE_CORE_PATH=$(CONCRETE_CORE_PATH) +endif + all: concretecompiler python-bindings build-tests build-benchmarks build-mlbench doc # concrete-core-ffi ####################################### @@ -121,7 +127,9 @@ $(BUILD_DIR)/configured.stamp: -DLLVM_EXTERNAL_PROJECTS=concretelang \ -DLLVM_EXTERNAL_CONCRETELANG_SOURCE_DIR=. \ -DPython3_EXECUTABLE=${Python3_EXECUTABLE} \ - -DCONCRETE_OPTIMIZER_DIR=${CONCRETE_OPTIMIZER_DIR} + -DCONCRETE_OPTIMIZER_DIR=${CONCRETE_OPTIMIZER_DIR} \ + $(CONCRETE_CORE_PATH_OPTION) \ + -DCONCRETELANG_CUDA_SUPPORT=${CUDA_SUPPORT} touch $@ build-initialized: concrete-optimizer-lib concrete-core-ffi $(BUILD_DIR)/configured.stamp diff --git a/compiler/lib/Runtime/CMakeLists.txt b/compiler/lib/Runtime/CMakeLists.txt index 615dfd3c5..5b6bcac75 100644 --- a/compiler/lib/Runtime/CMakeLists.txt +++ b/compiler/lib/Runtime/CMakeLists.txt @@ -23,7 +23,6 @@ if(CONCRETELANG_CUDA_SUPPORT) ConcretelangRuntime PRIVATE ConcreteCUDA - -L/usr/local/cuda/lib64 cudart ) endif()