Browse Source

Extended determinism check (#1202)

* Added Linux GCC
* Added Emscripten using nodejs
* Updated build script to use the sh/bat files to generate cmake configs
Jorrit Rouwe 1 year ago
parent
commit
b466d504f2
3 changed files with 77 additions and 13 deletions
  1. 1 1
      .github/workflows/build.yml
  2. 71 10
      .github/workflows/determinism_check.yml
  3. 5 2
      Docs/Architecture.md

+ 1 - 1
.github/workflows/build.yml

@@ -13,7 +13,7 @@ on:
       - '**.md'
       - '**.md'
 
 
 env:
 env:
-  EMSCRIPTEN_VERSION: 3.1.62
+  EMSCRIPTEN_VERSION: 3.1.64
   UBUNTU_CLANG_VERSION: clang++-15
   UBUNTU_CLANG_VERSION: clang++-15
   UBUNTU_GCC_VERSION: g++-12
   UBUNTU_GCC_VERSION: g++-12
 
 

+ 71 - 10
.github/workflows/determinism_check.yml

@@ -1,8 +1,12 @@
 name: Determinism Check
 name: Determinism Check
 
 
 env:
 env:
-    CONVEX_VS_MESH_HASH: '0x10139effe747511'
-    RAGDOLL_HASH: '0x777396947c3fff6a'
+  CONVEX_VS_MESH_HASH: '0x10139effe747511'
+  RAGDOLL_HASH: '0x777396947c3fff6a'
+  EMSCRIPTEN_VERSION: 3.1.64
+  UBUNTU_CLANG_VERSION: clang++-15
+  UBUNTU_GCC_VERSION: g++-12
+  UBUNTU_GCC_AARCH64_VERSION: aarch64-linux-gnu-g++-12
 
 
 on:
 on:
   push:
   push:
@@ -17,15 +21,38 @@ on:
       - '**.md'
       - '**.md'
 
 
 jobs:
 jobs:
-  linux:
+  linux_clang:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
-    name: Linux Determinism Check
+    name: Linux Clang Determinism Check
 
 
     steps:
     steps:
     - name: Checkout Code
     - name: Checkout Code
       uses: actions/checkout@v4
       uses: actions/checkout@v4
     - name: Configure CMake
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution -DCMAKE_CXX_COMPILER=clang++ Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
+      working-directory: ${{github.workspace}}/Build
+      run: ./cmake_linux_clang_gcc.sh Distribution ${{env.UBUNTU_CLANG_VERSION}} -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
+    - name: Build
+      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
+    - name: Unit Tests
+      working-directory: ${{github.workspace}}/Build/Linux_Distribution
+      run: ctest --output-on-failure --verbose
+    - name: Test ConvexVsMesh
+      working-directory: ${{github.workspace}}/Build/Linux_Distribution
+      run: ./PerformanceTest -q=LinearCast -t=2 -s=ConvexVsMesh -validate_hash=${CONVEX_VS_MESH_HASH}
+    - name: Test Ragdoll
+      working-directory: ${{github.workspace}}/Build/Linux_Distribution
+      run: ./PerformanceTest -q=LinearCast -t=2 -s=Ragdoll -validate_hash=${RAGDOLL_HASH}
+
+  linux_gcc:
+    runs-on: ubuntu-latest
+    name: Linux GCC Determinism Check
+
+    steps:
+    - name: Checkout Code
+      uses: actions/checkout@v4
+    - name: Configure CMake
+      working-directory: ${{github.workspace}}/Build
+      run: ./cmake_linux_clang_gcc.sh Distribution ${{env.UBUNTU_GCC_VERSION}} -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
     - name: Build
     - name: Build
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
     - name: Unit Tests
@@ -48,7 +75,8 @@ jobs:
     - name: Add msbuild to PATH
     - name: Add msbuild to PATH
       uses: microsoft/setup-msbuild@v2
       uses: microsoft/setup-msbuild@v2
     - name: Configure CMake
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/VS2022_CL -G "Visual Studio 17 2022" -A x64 Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
+      working-directory: ${{github.workspace}}/Build
+      run: ./cmake_vs2022_cl.bat -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
     - name: Build
     - name: Build
       run: msbuild Build\VS2022_CL\JoltPhysics.sln /property:Configuration=Distribution
       run: msbuild Build\VS2022_CL\JoltPhysics.sln /property:Configuration=Distribution
     - name: Unit Tests
     - name: Unit Tests
@@ -72,7 +100,7 @@ jobs:
       uses: microsoft/setup-msbuild@v2
       uses: microsoft/setup-msbuild@v2
     - name: Configure CMake
     - name: Configure CMake
       working-directory: ${{github.workspace}}/Build
       working-directory: ${{github.workspace}}/Build
-      run: ./cmake_vs2022_cl_32bit.bat -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
+      run: ./cmake_vs2022_cl_32bit.bat -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
     - name: Build
     - name: Build
       run: msbuild Build\VS2022_CL_32BIT\JoltPhysics.sln /property:Configuration=Distribution
       run: msbuild Build\VS2022_CL_32BIT\JoltPhysics.sln /property:Configuration=Distribution
     - name: Unit Tests
     - name: Unit Tests
@@ -93,7 +121,8 @@ jobs:
     - name: Checkout Code
     - name: Checkout Code
       uses: actions/checkout@v4
       uses: actions/checkout@v4
     - name: Configure CMake
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF
+      working-directory: ${{github.workspace}}/Build
+      run: ./cmake_linux_clang_gcc.sh Distribution clang++ -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
     - name: Build
     - name: Build
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
     - name: Unit Tests
@@ -117,7 +146,8 @@ jobs:
     - name: Install Cross Compiler
     - name: Install Cross Compiler
       run: sudo apt-get install gcc-12-aarch64-linux-gnu gcc-12-multilib g++-12-multilib libstdc++-12-dev-arm64-cross qemu-user -y
       run: sudo apt-get install gcc-12-aarch64-linux-gnu gcc-12-multilib g++-12-multilib libstdc++-12-dev-arm64-cross qemu-user -y
     - name: Configure CMake
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution -DCMAKE_CXX_COMPILER=clang++ Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DCROSS_COMPILE_ARM=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
+      working-directory: ${{github.workspace}}/Build
+      run: ./cmake_linux_clang_gcc.sh Distribution ${{env.UBUNTU_CLANG_VERSION}} -DCROSS_COMPILE_ARM=ON -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
     - name: Build
     - name: Build
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
     - name: Unit Tests
@@ -141,7 +171,8 @@ jobs:
     - name: Install Cross Compiler
     - name: Install Cross Compiler
       run: sudo apt-get install g++-12-aarch64-linux-gnu gcc-12-multilib g++-12-multilib libstdc++-12-dev-arm64-cross qemu-user -y
       run: sudo apt-get install g++-12-aarch64-linux-gnu gcc-12-multilib g++-12-multilib libstdc++-12-dev-arm64-cross qemu-user -y
     - name: Configure CMake
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++-12 Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DCROSS_COMPILE_ARM=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
+      working-directory: ${{github.workspace}}/Build
+      run: ./cmake_linux_clang_gcc.sh Distribution ${{env.UBUNTU_GCC_AARCH64_VERSION}} -DCROSS_COMPILE_ARM=ON -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
     - name: Build
     - name: Build
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
       run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
     - name: Unit Tests
@@ -153,3 +184,33 @@ jobs:
     - name: Test Ragdoll
     - name: Test Ragdoll
       working-directory: ${{github.workspace}}/Build/Linux_Distribution
       working-directory: ${{github.workspace}}/Build/Linux_Distribution
       run: qemu-aarch64 -L /usr/aarch64-linux-gnu/ ./PerformanceTest -q=LinearCast -t=2 -s=Ragdoll -validate_hash=${RAGDOLL_HASH}
       run: qemu-aarch64 -L /usr/aarch64-linux-gnu/ ./PerformanceTest -q=LinearCast -t=2 -s=Ragdoll -validate_hash=${RAGDOLL_HASH}
+
+  emscripten:
+    runs-on: ubuntu-latest
+    name: Emscripten
+
+    steps:
+    - name: Checkout Code
+      uses: actions/checkout@v4
+    - name: Setup emsdk
+      uses: mymindstorm/setup-emsdk@v14
+      with:
+        version: ${{env.EMSCRIPTEN_VERSION}}
+    - name: Verify emsdk
+      run: emcc -v
+    - name: Setup Node.js 18.x
+      uses: actions/setup-node@v4
+      with:
+        node-version: 18.x
+    - name: Configure CMake
+      run: |
+          cd ${{github.workspace}}/Build/
+          ./cmake_linux_emscripten.sh Distribution -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DTARGET_PERFORMANCE_TEST=ON
+    - name: Build
+      run: cmake --build ${{github.workspace}}/Build/WASM_Distribution -j $(nproc)      
+    - name: Unit Tests
+      working-directory: ${{github.workspace}}/Build/WASM_Distribution
+      run: node UnitTests.js
+    - name: Test ConvexVsMesh
+      working-directory: ${{github.workspace}}/Build/WASM_Distribution
+      run: node PerformanceTest.js -q=LinearCast -t=2 -s=ConvexVsMesh -validate_hash=${CONVEX_VS_MESH_HASH}

+ 5 - 2
Docs/Architecture.md

@@ -583,7 +583,7 @@ The physics simulation is deterministic provided that:
 
 
 If you want cross platform determinism then please turn on the CROSS_PLATFORM_DETERMINISTIC option in CMake. This will make the library approximately 8% slower but the simulation will be deterministic regardless of:
 If you want cross platform determinism then please turn on the CROSS_PLATFORM_DETERMINISTIC option in CMake. This will make the library approximately 8% slower but the simulation will be deterministic regardless of:
 
 
-* Compiler used to compile the library (tested MSVC2022 vs clang)
+* Compiler used to compile the library (tested MSVC2022, clang, gcc and emscripten)
 * Configuration (Debug, Release or Distribution)
 * Configuration (Debug, Release or Distribution)
 * OS (tested Windows, macOS, Linux)
 * OS (tested Windows, macOS, Linux)
 * Architecture (x86 or ARM).
 * Architecture (x86 or ARM).
@@ -597,9 +597,12 @@ It is quite difficult to verify cross platform determinism, so this feature is l
 
 
 * Windows MSVC x86 64-bit with AVX2
 * Windows MSVC x86 64-bit with AVX2
 * Windows MSVC x86 32-bit with SSE2
 * Windows MSVC x86 32-bit with SSE2
-* macOS clang x86 64-bit with AVX
+* macOS clang ARM 64-bit with NEON
 * Linux clang x86 64-bit with AVX2
 * Linux clang x86 64-bit with AVX2
 * Linux clang ARM 64-bit with NEON
 * Linux clang ARM 64-bit with NEON
+* Linux gcc x86 64-bit with AVX2
+* Linux gcc ARM 64-bit with NEON
+* WASM emscripten running in nodejs
 
 
 The most important things to look out for in your own application:
 The most important things to look out for in your own application: