diff --git a/.gitlab/ci/build.gitlab-ci.yml b/.gitlab/ci/build.gitlab-ci.yml index 68fcb6b4bc0dac08c4f0029ec1f2d3404226c1c2..365b6ddf4d009476122188adf1770243022ee663 100644 --- a/.gitlab/ci/build.gitlab-ci.yml +++ b/.gitlab/ci/build.gitlab-ci.yml @@ -23,6 +23,98 @@ build:ubuntu_cpp: - build_cpp/ - install_cpp/ +build:ubuntu_cpp_g++10: + stage: build + needs: [] + tags: + - docker + + script: + # Download dependencies + # aidge_core + - 'curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/main/download?job=build:ubuntu_cpp"' + - unzip -o build_artifacts.zip -d . + - rm -rf build_cpp + + # Build current module + - export CMAKE_PREFIX_PATH=../install_cpp + - apt install -y g++-10 + - mkdir -p build_cpp + - mkdir -p install_cpp + - cd build_cpp + - export CXX=/usr/bin/g++-10 + - cmake -DCMAKE_INSTALL_PREFIX:PATH=../install_cpp -DCMAKE_BUILD_TYPE=Debug -DWERROR=ON -DCOVERAGE=ON .. + - make -j4 all install + +build:ubuntu_cpp_g++12: + stage: build + needs: [] + tags: + - docker + + script: + # Download dependencies + # aidge_core + - 'curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/main/download?job=build:ubuntu_cpp"' + - unzip -o build_artifacts.zip -d . + - rm -rf build_cpp + + # Build current module + - export CMAKE_PREFIX_PATH=../install_cpp + - apt install -y g++-12 + - mkdir -p build_cpp + - mkdir -p install_cpp + - cd build_cpp + - export CXX=/usr/bin/g++-12 + - cmake -DCMAKE_INSTALL_PREFIX:PATH=../install_cpp -DCMAKE_BUILD_TYPE=Debug -DWERROR=ON -DCOVERAGE=ON .. + - make -j4 all install + +build:ubuntu_cpp_clang12: + stage: build + needs: [] + tags: + - docker + + script: + # Download dependencies + # aidge_core + - 'curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/main/download?job=build:ubuntu_cpp"' + - unzip -o build_artifacts.zip -d . + - rm -rf build_cpp + + # Build current module + - export CMAKE_PREFIX_PATH=../install_cpp + - apt install -y clang-12 + - mkdir -p build_cpp + - mkdir -p install_cpp + - cd build_cpp + - export CXX=/usr/bin/clang++-12 + - cmake -DCMAKE_INSTALL_PREFIX:PATH=../install_cpp -DCMAKE_BUILD_TYPE=Debug -DWERROR=ON -DCOVERAGE=ON .. + - make -j4 all install + +build:ubuntu_cpp_clang15: + stage: build + needs: [] + tags: + - docker + + script: + # Download dependencies + # aidge_core + - 'curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/main/download?job=build:ubuntu_cpp"' + - unzip -o build_artifacts.zip -d . + - rm -rf build_cpp + + # Build current module + - export CMAKE_PREFIX_PATH=../install_cpp + - apt install -y clang-15 + - mkdir -p build_cpp + - mkdir -p install_cpp + - cd build_cpp + - export CXX=/usr/bin/clang++-15 + - cmake -DCMAKE_INSTALL_PREFIX:PATH=../install_cpp -DCMAKE_BUILD_TYPE=Debug -DWERROR=ON -DCOVERAGE=ON .. + - make -j4 all install + build:ubuntu_python: stage: build needs: [] @@ -84,3 +176,42 @@ build:windows_cpp: paths: - build_cpp/ - install_cpp/ + +build:windows_python: + stage: build + needs: [] + tags: + - windows + + image: buildtools + before_script: + # Install Chocolatey + - Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + # Install dependencies + - choco install cmake.install --installargs '"ADD_CMAKE_TO_PATH=System"' -Y + - choco install git -Y + - choco install python -Y + # Update PATH + - $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + script: + # Download dependencies + # aidge_core (CPP) + - 'curl "https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/main/download?job=build:windows_cpp" -o build_artifacts.zip' + - Expand-Archive -Path .\build_artifacts.zip -DestinationPath . -Force + - Remove-Item .\build_cpp\ -Recurse + # aidge_core (Python) + - 'curl "https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/main/download?job=build:windows_python" -o build_artifacts.zip' + - Expand-Archive -Path .\build_artifacts.zip -DestinationPath . -Force + + - python -m pip install virtualenv + - virtualenv venv + - venv\Scripts\Activate.ps1 + # Numpy dependancy for unit test + - python -m pip install numpy + - $env:AIDGE_INSTALL = "$pwd" + "install" + - $env:CMAKE_PREFIX_PATH = "../install_cpp" + - python -m pip install . + artifacts: + expire_in: 1 week + paths: + - venv/ diff --git a/include/aidge/backend/cpu/operator/AddImpl.hpp b/include/aidge/backend/cpu/operator/AddImpl.hpp index 6e1cd03a3af81ee85f4f9e0e212af7c02089734e..99c83e2c6f91d50475ff7896dbe286286f7c8e2d 100644 --- a/include/aidge/backend/cpu/operator/AddImpl.hpp +++ b/include/aidge/backend/cpu/operator/AddImpl.hpp @@ -74,12 +74,12 @@ class AddImpl_cpu : public OperatorImpl { return std::accumulate(inputDims.begin(), inputDims.end(), NbElts_t(1), std::multiplies<NbElts_t>()); } - NbElts_t getNbRequiredProtected(const IOIndex_t inputIdx) const override final { + NbElts_t getNbRequiredProtected(const IOIndex_t /*inputIdx*/) const override final { // for the direct convolution algorithm, convolutions can be in-place, if there is no padding! return 0; } - NbElts_t getRequiredMemory(const IOIndex_t outputIdx, const std::vector<DimSize_t>& inputsSize) const override final { + NbElts_t getRequiredMemory(const IOIndex_t outputIdx, const std::vector<DimSize_t>& /*inputsSize*/) const override final { // Requires the whole tensors, regardless of available data on inputs assert(outputIdx == 0 && "operator has only one output"); (void) outputIdx; @@ -99,11 +99,11 @@ class AddImpl_cpu : public OperatorImpl { } void updateConsummerProducer() override final; - void forward() { + void forward() override { // nothing } - void backward() { printf("Not implemented yet.\n"); } + void backward() override { printf("Not implemented yet.\n"); } }; template <> @@ -133,9 +133,9 @@ class AddImpl_cpu<1> : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t /*outputIdx*/) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; template <> @@ -165,9 +165,9 @@ class AddImpl_cpu<2> : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t /*outputIdx*/) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; template <> @@ -196,9 +196,9 @@ class AddImpl_cpu<3> : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/AvgPoolingImpl.hpp b/include/aidge/backend/cpu/operator/AvgPoolingImpl.hpp index cfbcadfe6b719369618955a14c4cde5733ef6773..635c246c95d5625f9cb703e34d4d1fbbda833998 100644 --- a/include/aidge/backend/cpu/operator/AvgPoolingImpl.hpp +++ b/include/aidge/backend/cpu/operator/AvgPoolingImpl.hpp @@ -56,9 +56,9 @@ class AvgPoolingImpl2D_cpu : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/BatchNormImpl.hpp b/include/aidge/backend/cpu/operator/BatchNormImpl.hpp index 30557f6cbba05829b3cc9e17364ae4d933a568cf..f46113543d7c4a9d55dc7710fec74cca7fb3814d 100644 --- a/include/aidge/backend/cpu/operator/BatchNormImpl.hpp +++ b/include/aidge/backend/cpu/operator/BatchNormImpl.hpp @@ -71,9 +71,9 @@ class BatchNormImpl2D_cpu : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/ConvDepthWiseImpl.hpp b/include/aidge/backend/cpu/operator/ConvDepthWiseImpl.hpp index 2826b635590c5d19f34c8e4beee20fc8dba2183b..a5a144f50d6fbe1eb6c63827cad6a654777b60ae 100644 --- a/include/aidge/backend/cpu/operator/ConvDepthWiseImpl.hpp +++ b/include/aidge/backend/cpu/operator/ConvDepthWiseImpl.hpp @@ -58,9 +58,9 @@ class ConvDepthWiseImpl2D_cpu : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp index 669bdbc898528b0f96a59dd3c6f8e438ae1291e4..d8bcff3e8c03b3c31a00cdf60832cbc671737dc2 100644 --- a/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp @@ -9,7 +9,7 @@ * ********************************************************************************/ -#ifndef AIDGE_CPU_OPERATOR_CONVDEPTHWISEIMP_FORWARD_KERNEL_H_ +#ifndef AIDGE_CPU_OPERATOR_CONVDEPTHWISEIMPL_FORWARD_KERNEL_H_ #define AIDGE_CPU_OPERATOR_CONVDEPTHWISEIMPL_FORWARD_KERNEL_H_ #include "aidge/utils/Registrar.hpp" diff --git a/include/aidge/backend/cpu/operator/ConvImpl.hpp b/include/aidge/backend/cpu/operator/ConvImpl.hpp index b9411fe0f1ac079d9857cc8f2178fc98fadc3a77..fba1fd6aad72189ea9e18b5da0d1fc2613d0cc69 100644 --- a/include/aidge/backend/cpu/operator/ConvImpl.hpp +++ b/include/aidge/backend/cpu/operator/ConvImpl.hpp @@ -58,9 +58,9 @@ class ConvImpl2D_cpu : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/FCImpl.hpp b/include/aidge/backend/cpu/operator/FCImpl.hpp index 1dfa40439dbba9cdd4fe3436fea30f771678c1ff..875456d185bf28ec06c2491bd5c57ce7e6236e49 100644 --- a/include/aidge/backend/cpu/operator/FCImpl.hpp +++ b/include/aidge/backend/cpu/operator/FCImpl.hpp @@ -51,9 +51,9 @@ class FCImpl_cpu : public OperatorImpl { NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const override final; NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/LeakyReLUImpl.hpp b/include/aidge/backend/cpu/operator/LeakyReLUImpl.hpp index 386ef999fddbda184edee88723d213f53ff62ded..dc895c2758bda2aa766227eb628e990316a5bd52 100644 --- a/include/aidge/backend/cpu/operator/LeakyReLUImpl.hpp +++ b/include/aidge/backend/cpu/operator/LeakyReLUImpl.hpp @@ -50,9 +50,9 @@ class LeakyReLUImpl_cpu : public OperatorImpl { NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const override final; NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/MatMulImpl.hpp b/include/aidge/backend/cpu/operator/MatMulImpl.hpp index bf8e31efd253ee8855f3473ef0b4a60c59a04b5f..504406c7a7f2741abfa68d934c20e15bfcce59dd 100644 --- a/include/aidge/backend/cpu/operator/MatMulImpl.hpp +++ b/include/aidge/backend/cpu/operator/MatMulImpl.hpp @@ -64,8 +64,8 @@ public: void updateConsummerProducer() override final; - void forward(); - void backward(); + void forward() override; + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/MaxPoolingImpl.hpp b/include/aidge/backend/cpu/operator/MaxPoolingImpl.hpp index ef7835c742235f96e36423b9f5388efc4649199f..ca4480653b8315ab3d986eac1c460e2d7c17b844 100644 --- a/include/aidge/backend/cpu/operator/MaxPoolingImpl.hpp +++ b/include/aidge/backend/cpu/operator/MaxPoolingImpl.hpp @@ -56,9 +56,9 @@ class MaxPoolingImpl2D_cpu : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/ProducerImpl.hpp b/include/aidge/backend/cpu/operator/ProducerImpl.hpp index 032172dbf0995fc62ce631aa5eba1cabf2374ad3..f23dfc2656ae5c91c8879f24474efc2eb0b04231 100644 --- a/include/aidge/backend/cpu/operator/ProducerImpl.hpp +++ b/include/aidge/backend/cpu/operator/ProducerImpl.hpp @@ -39,9 +39,9 @@ class ProducerImpl_cpu : public OperatorImpl { NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/ReLUImpl.hpp b/include/aidge/backend/cpu/operator/ReLUImpl.hpp index 537bdeeaf89b388a82e819330649c2ae3445c590..dd785d1d4231eff562fce8a814934aefd715c23f 100644 --- a/include/aidge/backend/cpu/operator/ReLUImpl.hpp +++ b/include/aidge/backend/cpu/operator/ReLUImpl.hpp @@ -50,9 +50,9 @@ class ReLUImpl_cpu : public OperatorImpl { NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const override final; NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/ScalingImpl.hpp b/include/aidge/backend/cpu/operator/ScalingImpl.hpp index 37549349b9f5ffbf443d976135db05b4cec209b7..58ca58510e7e89faac95ef5df637aaf3ac8ed98d 100644 --- a/include/aidge/backend/cpu/operator/ScalingImpl.hpp +++ b/include/aidge/backend/cpu/operator/ScalingImpl.hpp @@ -54,9 +54,9 @@ class ScalingImpl_cpu : public OperatorImpl { void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/include/aidge/backend/cpu/operator/SoftmaxImpl.hpp b/include/aidge/backend/cpu/operator/SoftmaxImpl.hpp index 08567ab98e55233f1f578e82cb39ac5681f0a839..e2b30a59d9a15627e8d71e7c0b7f031dcf79964d 100644 --- a/include/aidge/backend/cpu/operator/SoftmaxImpl.hpp +++ b/include/aidge/backend/cpu/operator/SoftmaxImpl.hpp @@ -50,9 +50,9 @@ class SoftmaxImpl_cpu : public OperatorImpl { NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const override final; NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; void updateConsummerProducer() override final; - void forward(); + void forward() override; - void backward(); + void backward() override; }; namespace { diff --git a/setup.py b/setup.py index 16305afdfdfa5de2e328460d9e96c77eb96a9d98..b88329e54feab78e39bd79be0a129030098e216a 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,8 @@ class CMakeBuild(build_ext): self.spawn(['cmake', str(cwd), param_py, '-DTEST=OFF', f'-DCMAKE_INSTALL_PREFIX:PATH={install_path}']) if not self.dry_run: - self.spawn(['make', 'all', 'install', '-j', max_jobs]) + self.spawn(['cmake', '--build', '.', '--config', 'Debug', '-j', max_jobs]) + self.spawn(['cmake', '--install', '.', '--config', 'Debug']) os.chdir(str(cwd)) aidge_package = build_lib / (get_project_name()) @@ -81,7 +82,7 @@ class CMakeBuild(build_ext): # Copy all shared object files from build_temp/lib to aidge_package for root, _, files in os.walk(build_temp.absolute()): for file in files: - if file.endswith('.so') 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) shutil.copy(currentFile, str(aidge_package.absolute())) @@ -100,7 +101,6 @@ if __name__ == '__main__': long_description_content_type="text/markdown", long_description="\n".join(DOCLINES[2:]), classifiers=[c for c in CLASSIFIERS.split('\n') if c], - platforms=["Linux"], packages=find_packages(where="."), include_package_data=True, ext_modules=[CMakeExtension(get_project_name())],