Skip to content
Snippets Groups Projects
Commit 3025e25c authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Merge branch 'QualityOfLife' into 'dev'

Remove backend_cpu dependency

See merge request eclipse/aidge/aidge_backend_cuda!8
parents 3e47b059 0841e700
No related branches found
No related tags found
No related merge requests found
Pipeline #40125 failed
...@@ -7,7 +7,7 @@ file(READ "${CMAKE_SOURCE_DIR}/project_name.txt" project) ...@@ -7,7 +7,7 @@ file(READ "${CMAKE_SOURCE_DIR}/project_name.txt" project)
message(STATUS "Project name: ${project}") message(STATUS "Project name: ${project}")
message(STATUS "Project version: ${version}") message(STATUS "Project version: ${version}")
# Note : project name is {project} and python module name is also {project} # Note : project name is {project} and python module name is also {project}
set(module_name _${project}) # target name set(module_name _${project}) # target name
...@@ -36,8 +36,9 @@ enable_language(CUDA) ...@@ -36,8 +36,9 @@ enable_language(CUDA)
find_package(CUDAToolkit REQUIRED) find_package(CUDAToolkit REQUIRED)
find_package(aidge_core REQUIRED) find_package(aidge_core REQUIRED)
find_package(aidge_backend_cpu REQUIRED) if(TEST)
find_package(aidge_backend_cpu REQUIRED)
endif()
############################################## ##############################################
# Create target and set properties # Create target and set properties
...@@ -48,11 +49,17 @@ add_library(${module_name} ${src_files} ${inc_files}) ...@@ -48,11 +49,17 @@ add_library(${module_name} ${src_files} ${inc_files})
target_link_libraries(${module_name} target_link_libraries(${module_name}
PUBLIC PUBLIC
_aidge_core # _ is added because we link the target not the project _aidge_core # _ is added because we link the target not the project
_aidge_backend_cpu # _ is added because we link the target not the project
CUDA::cudart CUDA::cudart
cudnn cudnn
) )
if(TEST)
target_link_libraries(${module_name}
PUBLIC
_aidge_backend_cpu # _ is added because we link the target not the project
)
endif()
#Set target properties #Set target properties
target_include_directories(${module_name} target_include_directories(${module_name}
PUBLIC PUBLIC
...@@ -76,7 +83,7 @@ if (PYBIND) ...@@ -76,7 +83,7 @@ if (PYBIND)
# Handles Python + pybind11 headers dependencies # Handles Python + pybind11 headers dependencies
target_link_libraries(${module_name} target_link_libraries(${module_name}
PUBLIC PUBLIC
pybind11::pybind11 pybind11::pybind11
PRIVATE PRIVATE
Python::Python Python::Python
...@@ -119,8 +126,8 @@ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ...@@ -119,8 +126,8 @@ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT ${project}-targets install(EXPORT ${project}-targets
FILE "${project}-targets.cmake" FILE "${project}-targets.cmake"
DESTINATION ${INSTALL_CONFIGDIR} DESTINATION ${INSTALL_CONFIGDIR}
# COMPONENT ${module_name} # COMPONENT ${module_name}
) )
#Create a ConfigVersion.cmake file #Create a ConfigVersion.cmake file
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
......
...@@ -24,8 +24,8 @@ void thrust_copy(const half_float::half* srcData, half_float::half* dstData, siz ...@@ -24,8 +24,8 @@ void thrust_copy(const half_float::half* srcData, half_float::half* dstData, siz
/** /**
* @brief Abstract class for the TensorImpl_cuda class template. * @brief Abstract class for the TensorImpl_cuda class template.
* @details Its purpose is to provide access to base methods that are specific * @details Its purpose is to provide access to base methods that are specific
* to the implementation (which are therefore not present in the TensorImpl * to the implementation (which are therefore not present in the TensorImpl
* class), but whose data type does not need to be known. * class), but whose data type does not need to be known.
*/ */
class TensorImpl_cuda_ { class TensorImpl_cuda_ {
...@@ -35,7 +35,7 @@ protected: ...@@ -35,7 +35,7 @@ protected:
public: public:
/** /**
* @brief Return the CuDNN tensor descriptor of the tensor. * @brief Return the CuDNN tensor descriptor of the tensor.
* @details This method uses lazy initialization for the descriptor * @details This method uses lazy initialization for the descriptor
* (which is therefore mutable in the derived class). * (which is therefore mutable in the derived class).
* @return cudnnTensorDescriptor_t CuDNN tensor descriptor. * @return cudnnTensorDescriptor_t CuDNN tensor descriptor.
*/ */
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
// native interface // native interface
const future_std::span<T>& data() const { return mData; } const future_std::span<T>& data() const { return mData; }
std::size_t scalarSize() const override { return sizeof(T); } std::size_t scalarSize() const noexcept override { return sizeof(T); }
void copy(const void *src, NbElts_t length, NbElts_t offset = 0) override { void copy(const void *src, NbElts_t length, NbElts_t offset = 0) override {
AIDGE_ASSERT(length <= mData.size() || length <= mNbElts, "copy length is above capacity"); AIDGE_ASSERT(length <= mData.size() || length <= mNbElts, "copy length is above capacity");
......
...@@ -62,10 +62,10 @@ class CMakeBuild(build_ext): ...@@ -62,10 +62,10 @@ class CMakeBuild(build_ext):
os.chdir(str(build_temp)) os.chdir(str(build_temp))
# Impose to use the executable of the python # Impose to use the executable of the python
# used to launch setup.py to setup PythonInterp # used to launch setup.py to setup PythonInterp
param_py = "-DPYTHON_EXECUTABLE=" + sys.executable param_py = "-DPYTHON_EXECUTABLE=" + sys.executable
compile_type = 'Debug' compile_type = 'Debug'
install_path = os.path.join(sys.prefix, "lib", "libAidge") if "AIDGE_INSTALL" not in os.environ else os.environ["AIDGE_INSTALL"] install_path = os.path.join(sys.prefix, "lib", "libAidge") if "AIDGE_INSTALL" not in os.environ else os.environ["AIDGE_INSTALL"]
...@@ -85,11 +85,11 @@ class CMakeBuild(build_ext): ...@@ -85,11 +85,11 @@ class CMakeBuild(build_ext):
for file in files: for file in files:
if (file.endswith('.so') or file.endswith('.pyd')) and (root != str(aidge_package.absolute())): if (file.endswith('.so') or file.endswith('.pyd')) and (root != str(aidge_package.absolute())):
currentFile=os.path.join(root, file) currentFile=os.path.join(root, file)
shutil.copy(currentFile, str(aidge_package.absolute())) shutil.copy(currentFile, str(aidge_package.absolute()))
# Copy version.txt in aidge_package # Copy version.txt in aidge_package
os.chdir(os.path.dirname(__file__)) os.chdir(os.path.dirname(__file__))
shutil.copy("version.txt", str(aidge_package.absolute())) shutil.copy("version.txt", str(aidge_package.absolute()))
if __name__ == '__main__': if __name__ == '__main__':
...@@ -108,7 +108,7 @@ if __name__ == '__main__': ...@@ -108,7 +108,7 @@ if __name__ == '__main__':
cmdclass={ cmdclass={
'build_ext': CMakeBuild, 'build_ext': CMakeBuild,
}, },
install_requires=['aidge_core', 'aidge_backend_cpu'], install_requires=['aidge_core'],
zip_safe=False, zip_safe=False,
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment