Skip to content

Commit

Permalink
Optimised computational performance
Browse files Browse the repository at this point in the history
- Removed std::fma in rollback, enhancing iteration speed
- Refactored tape container for efficient joint operations
- Combined pushing full statements to tape at once
- Added pre-checks for tape existence, reducing overhead

Co-authored-by: Zakaria Farini <zfarini@student.1337.ma>
Co-authored-by: Abdelhay Bouramdane <abouramd@student.1337.ma>
Co-authored-by: Zakaria Sabri <thatfor1337@gmail.com>
Co-authored-by: Mouad El Mekaoui <mouad.elmekaoui@gmail.com>
Co-authored-by: El Mokhtar Ouhrich <eouhrich@c4r7p3.1337.ma>
Co-authored-by: Abderrahim Indjaren <rahimos.123@gmail.com>
Co-authored-by: Salaheddine Ouahidi <ouahidi.se@proton.me>
Co-authored-by: Yasser Ait Nasser <yasseraitnasser4@gmail.com>
Co-authored-by: Ayoub Ben hamou <ayoubbenhamou0731@gmail.com>
Co-authored-by: Oussama Khiar <ossama.khiar@gmail.com>
Co-authored-by: Omar Belaizi <omarprince823@gmail.com>
Co-authored-by: Reda Ghouzraf <Rghouzra@student.1337.ma>
Co-authored-by: Yahya Rhiba <76631430+yrhiba@users.noreply.github.com>
Co-authored-by: Abdelouahed Rabiai <abdell.rabiai@gmail.com>
Co-authored-by: Othmane Rekabe <orekab3@gmail.com>
Co-authored-by: Othmane Chouikhane <othman-chouikhane@outlook.fr>
Co-authored-by: Mohamed Khames <mohamed.james1949@gmail.com>
Co-authored-by: Mouad El Asri <elasri.mouad.2002@gmail.com>
Co-authored-by: Hasnaa Et-Taleby <ettalebyhasnaa99@gmail.com>
Co-authored-by: Jawad Chakir <105322451+jchakir@users.noreply.github.com>
Co-authored-by: Hamza Barrak <hamzabarrak83@gmail.com>
Co-authored-by: Mohammed Berroukham <mberrouk@student.1337.ma>
Co-authored-by: Soufiane essarhir <soufianeessarhir@gmail.com>
Co-authored-by: Ibrahim Esseddyq <ibrahim.essedyq@gmail.com>
Co-authored-by: Rida Rhnizar <ridarhnizar1337@gmail.com>
Co-authored-by: Mohammed Zeroual <mohammedzeroual200@gmail.com>
  • Loading branch information
1 parent aaf5626 commit a855274
Show file tree
Hide file tree
Showing 30 changed files with 1,220 additions and 293 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ jobs:
compiler: [msvc, clang]
config: [Release, Debug]
standard: ["11", "17"]
memory: ["default", "lowmem"]
include:
- config: Debug
sccache: "false"
cmake_extra: ""
- config: Release
sccache: "true"
cmake_extra: -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake_extra: -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- memory: "lowmem"
cmake_mem_flag: -DXAD_REDUCED_MEMORY=ON
- compiler: clang
cxx: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe
cc: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe
Expand Down Expand Up @@ -57,7 +60,7 @@ jobs:
if: ${{ matrix.sccache == 'true' }}
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: windows-${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }}
key: windows-${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }}-${{ matrix.memory }}
variant: sccache
- name: configure
shell: cmd
Expand All @@ -71,6 +74,7 @@ jobs:
-DCMAKE_C_COMPILER="${{ matrix.cc }}" ^
-DCMAKE_CXX_STANDARD="${{ matrix.standard }}" ^
${{ matrix.cmake_extra }} ^
${{ matrix.cmake_mem_flag }} ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: build
shell: cmd
Expand All @@ -88,7 +92,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (windows ${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }})
name: Test Results (windows ${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }}-${{ matrix.memory }})
path: build/test_results.xml
- name: install
shell: cmd
Expand Down Expand Up @@ -125,6 +129,7 @@ jobs:
config: [Release, Debug]
reuse_slots: [OFF, ON]
standard: ["11", "17"]
memory: ["default", "lowmem"]
include:
- compiler: clang-11
cxx: clang++-11
Expand All @@ -146,6 +151,8 @@ jobs:
cxx: clang++-15
cc: clang-15
os: ubuntu-22.04
- memory: lowmem
cmake_mem_flag: -DXAD_REDUCED_MEMORY=ON
exclude:
- config: Debug
reuse_slots: ON
Expand All @@ -163,7 +170,7 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}-${{ matrix.memory }}
- name: configure
run: |
mkdir build
Expand All @@ -175,6 +182,7 @@ jobs:
-DCMAKE_CXX_STANDARD=${{ matrix.standard }} \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DXAD_TAPE_REUSE_SLOTS=${{ matrix.reuse_slots }} \
${{ matrix.cmake_mem_flag }} \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
- name: build
run: |
Expand All @@ -188,7 +196,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }})
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}-${{ matrix.memory }})
path: build/test_results.xml
- name: install
run: |
Expand Down Expand Up @@ -223,6 +231,7 @@ jobs:
config: [Release, Debug]
reuse_slots: [OFF, ON]
standard: [c++11, c++17]
memory: ["default", "lowmem"]
exclude:
- config: Debug
reuse_slots: ON
Expand All @@ -233,6 +242,8 @@ jobs:
- compiler: gcc7
standard: c++17
include:
- memory: lowmem
cmake_mem_flag: -DXAD_REDUCED_MEMORY=ON
- config: Debug
compiler: gcc11
coverage: true
Expand Down Expand Up @@ -277,7 +288,7 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}-${{ matrix.memory }}
- name: configure
run: |
mkdir build
Expand All @@ -290,6 +301,7 @@ jobs:
-DCMAKE_CXX_FLAGS="-std=${{ matrix.standard }} ${{ matrix.coverage_cxx_flags }}" \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \
-DXAD_TAPE_REUSE_SLOTS=${{ matrix.reuse_slots }} \
${{ matrix.cmake_mem_flag }} \
-DCMAKE_INSTALL_PREFIX=${{ env.GITHUB_WORKSPACE }}/install
- name: build
run: |
Expand All @@ -309,7 +321,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }})
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}-${{ matrix.memory }})
path: ${{ env.GITHUB_WORKSPACE }}/build/test_results.xml
- name: coverage tests
if: ${{ matrix.coverage }}
Expand All @@ -323,7 +335,7 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: linux-${{ matrix.compiler }}-${{ matrix.reuse_slots }}
flag-name: linux-${{ matrix.compiler }}-${{ matrix.reuse_slots }}-${{ matrix.memory }}
path-to-lcov: ${{env.GITHUB_WORKSPACE }}/build/coverage/lcov.info
parallel: true
- name: install
Expand Down Expand Up @@ -354,7 +366,10 @@ jobs:
os: [macos-13, macos-latest]
compiler: [default, clang15]
standard: [c++11, c++17]
memory: ["default", "lowmem"]
include:
- memory: lowmem
cmake_mem_flag: -DXAD_REDUCED_MEMORY=ON
- config: Release
os: macos-13
compiler: default
Expand Down Expand Up @@ -399,7 +414,7 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: macos-${{ matrix.config }}
key: macos-${{ matrix.config }}-${{ matrix.compiler }}-${{ matrix.standard }}-${{ matrix.memory }}
- name: configure
run: |
mkdir build
Expand All @@ -408,6 +423,7 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_FLAGS="-std=${{matrix.standard }} ${{ matrix.coverage_cxx_flags }}" \
${{ matrix.cmake_mem_flag }} \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install \
${{ matrix.compiler == 'clang15' && ' -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@15)/bin/clang++ -DCMAKE_C_COMPILER=clang' || '' }}
Expand All @@ -429,7 +445,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (macos ${{ matrix.config }})
name: Test Results (macos ${{ matrix.config }}-${{ matrix.compiler }}-${{ matrix.standard }}-${{ matrix.memory }})
path: build/test_results.xml
- name: coverage tests
if: ${{ matrix.coverage }}
Expand All @@ -443,7 +459,7 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: macos
flag-name: macos-${{ matrix.compiler }}-${{ matrix.standard }}-${{ matrix.memory }}
path-to-lcov: build/coverage/lcov.info
parallel: true
- name: install
Expand Down
5 changes: 5 additions & 0 deletions cmake/XADSetupOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ else()
set(XAD_USE_STRONG_INLINE ON CACHE BOOL "Use forced inlining for higher preformance, at a higher compile time cost" FORCE)
endif()
option(XAD_ALLOW_INT_CONVERSION "Add real->int conversion operator, potentially missing to track dependencies" ON)
option(XAD_REDUCED_MEMORY "Reduce memory required for tape, at a slight performance cost" OFF)

if(XAD_REDUCED_MEMORY)
message(STATUS "Using reduced memory for tape storage at a slight performance cost")
endif()
8 changes: 2 additions & 6 deletions cmake/XADSetupTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,14 @@ if (NOT TARGET GTest::gmock_main)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
set(_gtest_tag release-1.10.0)
else()
set(_gtest_tag release-1.11.0)
set(_gtest_tag v1.15.2)
endif()
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG ${_gtest_tag}
)
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
FetchContent_MakeAvailable(googletest)

set_target_properties(gtest gtest_main gmock gmock_main PROPERTIES
FOLDER "test/gtest")
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ set(public_headers
XAD/Literals.hpp
XAD/Macros.hpp
XAD/MathFunctions.hpp
XAD/OperationsContainer.hpp
XAD/OperationsContainerPaired.hpp
XAD/ReusableRange.hpp
XAD/StdCompatibility.hpp
XAD/Tape.hpp
Expand Down
Loading

0 comments on commit a855274

Please sign in to comment.