forked from jiuyuan/InfiniTensor
Fix: add building option for NNet (#162)
Signed-off-by: YdrMaster <ydrml@hotmail.com>
This commit is contained in:
parent
1184fa131f
commit
d0f9792613
|
@ -5,6 +5,7 @@ option(USE_KUNLUN "Support KUNLUN XPU" OFF)
|
||||||
option(USE_INTELCPU "Support INTELCPU" OFF)
|
option(USE_INTELCPU "Support INTELCPU" OFF)
|
||||||
option(USE_BACKTRACE "Print backtrace on exception and segmentation fault" ON)
|
option(USE_BACKTRACE "Print backtrace on exception and segmentation fault" ON)
|
||||||
option(USE_PROTOBUF "Serialize and deserialize tensors" OFF)
|
option(USE_PROTOBUF "Serialize and deserialize tensors" OFF)
|
||||||
|
option(BUILD_NNET "Build nnet" OFF)
|
||||||
option(BUILD_DIST "Build project for distributed running" OFF)
|
option(BUILD_DIST "Build project for distributed running" OFF)
|
||||||
option(BUILD_TEST "Build tests" OFF)
|
option(BUILD_TEST "Build tests" OFF)
|
||||||
|
|
||||||
|
@ -123,7 +124,13 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -UNDEBUG")
|
||||||
|
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
file(GLOB_RECURSE SRC src/ffi/*.cc src/core/*.cc src/kernels/cpu/*.cc src/nnet/*.cc src/operators/*.cc src/utils/*.cc)
|
file(GLOB_RECURSE SRC src/ffi/*.cc src/core/*.cc src/kernels/cpu/*.cc src/operators/*.cc src/utils/*.cc)
|
||||||
|
|
||||||
|
if(BUILD_NNET)
|
||||||
|
add_compile_definitions(BUILD_NNET=1)
|
||||||
|
file(GLOB_RECURSE SRC_NNET src/nnet/*.cc)
|
||||||
|
list (APPEND SRC ${SRC_NNET})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(USE_CUDA)
|
if(USE_CUDA)
|
||||||
file(GLOB_RECURSE SRC_CUDA src/cuda/*.cc src/cuda/*.cu src/kernels/cuda/*.cc src/kernels/cuda/*.cu)
|
file(GLOB_RECURSE SRC_CUDA src/cuda/*.cc src/cuda/*.cu src/kernels/cuda/*.cc src/kernels/cuda/*.cu)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BUILD_NNET
|
||||||
|
|
||||||
#include "operators/membound.h"
|
#include "operators/membound.h"
|
||||||
#include "core/kernel.h"
|
#include "core/kernel.h"
|
||||||
#include "nnet/Visitor/Interpreter.h"
|
#include "nnet/Visitor/Interpreter.h"
|
||||||
|
@ -82,3 +84,5 @@ REGISTER_KERNEL(Device::CPU, OpType::MemBound, DataType::UInt32,
|
||||||
MemboundInterpreter, "MemboundInterpreter_CPU");
|
MemboundInterpreter, "MemboundInterpreter_CPU");
|
||||||
|
|
||||||
} // namespace infini
|
} // namespace infini
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BUILD_NNET
|
||||||
|
|
||||||
#include "operators/membound.h"
|
#include "operators/membound.h"
|
||||||
#include "nnet/Visitor/CheckOOBVisitor.h"
|
#include "nnet/Visitor/CheckOOBVisitor.h"
|
||||||
#include "nnet/Visitor/HashVisitor.h"
|
#include "nnet/Visitor/HashVisitor.h"
|
||||||
|
@ -84,3 +86,5 @@ bool MemBoundObj::checkOOB(nnet::Expr expr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace infini
|
} // namespace infini
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue