diff --git a/ci/build.linux.gitlab-ci.yml b/ci/build.linux.gitlab-ci.yml index 4a7897d1b..229d51257 100644 --- a/ci/build.linux.gitlab-ci.yml +++ b/ci/build.linux.gitlab-ci.yml @@ -13,7 +13,7 @@ - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_NAMESPACE == "libeigen" - if: $CI_PIPELINE_SOURCE == "web" && $CI_PROJECT_NAMESPACE == "libeigen" cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG-BUILD" + key: "$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG-BUILD" paths: - ${EIGEN_CI_BUILDDIR}/ @@ -46,6 +46,11 @@ build:linux:cross:x86-64:gcc-10:default: EIGEN_CI_CROSS_C_COMPILER: x86_64-linux-gnu-gcc-10 EIGEN_CI_CROSS_CXX_COMPILER: x86_64-linux-gnu-g++-10 +build:linux:cross:x86-64:gcc-10:avx: + extends: build:linux:cross:x86-64:gcc-10:default + variables: + EIGEN_CI_ADDITIONAL_ARGS: "-DEIGEN_TEST_AVX=on" + build:linux:cross:x86-64:gcc-10:avx2: extends: build:linux:cross:x86-64:gcc-10:default variables: @@ -76,6 +81,11 @@ build:linux:cross:x86-64:clang-12:default: EIGEN_CI_CXX_COMPILER: clang++-12 EIGEN_CI_CROSS_INSTALL: g++-10-x86-64-linux-gnu clang-12 +build:linux:cross:x86-64:clang-12:avx: + extends: build:linux:cross:x86-64:clang-12:default + variables: + EIGEN_CI_ADDITIONAL_ARGS: "-DEIGEN_TEST_AVX=on" + build:linux:cross:x86-64:clang-12:avx2: extends: build:linux:cross:x86-64:clang-12:default variables: diff --git a/ci/build.windows.gitlab-ci.yml b/ci/build.windows.gitlab-ci.yml index 9bcf83aba..2fc21beab 100644 --- a/ci/build.windows.gitlab-ci.yml +++ b/ci/build.windows.gitlab-ci.yml @@ -6,7 +6,7 @@ EIGEN_CI_BUILD_TARGET: buildtests # Reduce overall build size and compile time. # Note: /d2ReducedOptimizeHugeFunctions is only available in VS 2019. - EIGEN_CI_TEST_CUSTOM_CXX_FLAGS: "/d2ReducedOptimizeHugeFunctions /DEIGEN_STRONG_INLINE=inline /Os" + EIGEN_CI_TEST_CUSTOM_CXX_FLAGS: "/d2ReducedOptimizeHugeFunctions;/DEIGEN_STRONG_INLINE=inline;/Os" script: - ./ci/scripts/build.windows.script.ps1 tags: @@ -29,7 +29,7 @@ build:windows:x86-64:msvc-14.16:default: variables: EIGEN_CI_MSVC_VER: "14.16" # Override to remove unsupported /d2ReducedOptimizeHugeFunctions. - EIGEN_CI_TEST_CUSTOM_CXX_FLAGS: "/DEIGEN_STRONG_INLINE=inline /Os" + EIGEN_CI_TEST_CUSTOM_CXX_FLAGS: "/DEIGEN_STRONG_INLINE=inline;/Os" # MSVC 14.29 (VS 2019) build:windows:x86-64:msvc-14.29:default: @@ -51,14 +51,11 @@ build:windows:x86-64:msvc-14.29:avx512dq: .build:windows:cuda: extends: .build:windows variables: - # Addtional flags passed to the cuda compiler. - EIGEN_CI_CUDA_CXX_FLAGS: "" # Compute architectures present in the GitLab CI runners. EIGEN_CI_CUDA_COMPUTE_ARCH: "50;75" EIGEN_CI_BUILD_TARGET: buildtests_gpu EIGEN_CI_ADDITIONAL_ARGS: -DEIGEN_TEST_CUDA=on - -DEIGEN_CUDA_CXX_FLAGS="${EIGEN_CI_CUDA_CXX_FLAGS}" -DEIGEN_CUDA_COMPUTE_ARCH=${EIGEN_CI_CUDA_COMPUTE_ARCH} tags: - eigen-runner @@ -66,16 +63,17 @@ build:windows:x86-64:msvc-14.29:avx512dq: - x86-64 - cuda -# MSVC 14.16 + CUDA 9.2 -build:windows:x86-64:cuda-9.2:msvc-14.16: - extends: .build:windows:cuda - variables: - # CUDA 9.2 doesn't support sm_75. - EIGEN_CI_CUDA_COMPUTE_ARCH: "50;70" - # CUDA 9.2 only supports up to VS 2017. - EIGEN_CI_MSVC_VER: "14.16" - EIGEN_CI_TEST_CUSTOM_CXX_FLAGS: "/DEIGEN_STRONG_INLINE=inline /Os" - EIGEN_CI_BEFORE_SCRIPT: $$env:CUDA_PATH=$$env:CUDA_PATH_V9_2 +# The CUDA 9.2 compiler crashes with an internal error. +# # MSVC 14.16 + CUDA 9.2 +# build:windows:x86-64:cuda-9.2:msvc-14.16: +# extends: .build:windows:cuda +# variables: +# # CUDA 9.2 doesn't support sm_75. +# EIGEN_CI_CUDA_COMPUTE_ARCH: "50;70" +# # CUDA 9.2 only supports up to VS 2017. +# EIGEN_CI_MSVC_VER: "14.16" +# EIGEN_CI_TEST_CUSTOM_CXX_FLAGS: "/DEIGEN_STRONG_INLINE=inline;/Os" +# EIGEN_CI_BEFORE_SCRIPT: $$env:CUDA_PATH=$$env:CUDA_PATH_V9_2 # MSVC 14.29 + CUDA 10.2 build:windows:x86-64:cuda-10.2:msvc-14.29: diff --git a/ci/common.gitlab-ci.yml b/ci/common.gitlab-ci.yml index cf6d7838f..4a0283f61 100644 --- a/ci/common.gitlab-ci.yml +++ b/ci/common.gitlab-ci.yml @@ -17,7 +17,7 @@ # Call script in current shell - it sets up some environment variables. - . ci/scripts/common.linux.before_script.sh artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + name: "$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG" paths: - ${EIGEN_CI_BUILDDIR}/ expire_in: 5 days @@ -32,7 +32,7 @@ before_script: - . ci/scripts/common.windows.before_script.ps1 artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" + name: "$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_NAME" paths: - ${EIGEN_CI_BUILDDIR}/ expire_in: 5 days diff --git a/ci/scripts/build.windows.script.ps1 b/ci/scripts/build.windows.script.ps1 index 155da3ab9..24975f19e 100644 --- a/ci/scripts/build.windows.script.ps1 +++ b/ci/scripts/build.windows.script.ps1 @@ -12,7 +12,9 @@ cmd.exe /c "`"${VS_INSTALL_DIR}\VC\Auxiliary\Build\vcvarsall.bat`" $EIGEN_CI_MSV # Create and enter build directory. $rootdir = Get-Location -mkdir $EIGEN_CI_BUILDDIR +if (-Not (Test-Path ${EIGEN_CI_BUILDDIR})) { + mkdir $EIGEN_CI_BUILDDIR +} cd $EIGEN_CI_BUILDDIR # We need to split EIGEN_CI_ADDITIONAL_ARGS, otherwise they are interpretted diff --git a/ci/scripts/common.windows.before_script.ps1 b/ci/scripts/common.windows.before_script.ps1 index 291edde55..3a6f456a7 100644 --- a/ci/scripts/common.windows.before_script.ps1 +++ b/ci/scripts/common.windows.before_script.ps1 @@ -1,7 +1,8 @@ echo "Running ${CI_JOB_NAME}" # Print configuration variables. -Get-Variable | findstr EIGEN +Get-Variable EIGEN* | Format-Table -Wrap +Get-Variable CMAKE* | Format-Table -Wrap # Run a custom before-script command. if ("${EIGEN_CI_BEFORE_SCRIPT}") { Invoke-Expression -Command "${EIGEN_CI_BEFORE_SCRIPT}" } diff --git a/ci/test.linux.gitlab-ci.yml b/ci/test.linux.gitlab-ci.yml index 590bdeedc..82a88af6f 100644 --- a/ci/test.linux.gitlab-ci.yml +++ b/ci/test.linux.gitlab-ci.yml @@ -55,6 +55,22 @@ test:linux:x86-64:gcc-10:default:unsupported: variables: EIGEN_CI_TEST_LABEL: Unsupported +.test:linux:x86-64:gcc-10:avx: + extends: .test:linux:x86-64 + needs: [ build:linux:cross:x86-64:gcc-10:avx ] + variables: + EIGEN_CI_INSTALL: g++-10 + +test:linux:x86-64:gcc-10:avx:official: + extends: .test:linux:x86-64:gcc-10:avx + variables: + EIGEN_CI_TEST_LABEL: Official + +test:linux:x86-64:gcc-10:avx:unsupported: + extends: .test:linux:x86-64:gcc-10:avx + variables: + EIGEN_CI_TEST_LABEL: Unsupported + .test:linux:x86-64:gcc-10:avx2: extends: .test:linux:x86-64 needs: [ build:linux:cross:x86-64:gcc-10:avx2 ] @@ -127,6 +143,22 @@ test:linux:x86-64:clang-12:default:unsupported: variables: EIGEN_CI_TEST_LABEL: Unsupported +.test:linux:x86-64:clang-12:avx: + extends: .test:linux:x86-64 + needs: [ build:linux:cross:x86-64:clang-12:avx ] + variables: + EIGEN_CI_INSTALL: clang-12 + +test:linux:x86-64:clang-12:avx:official: + extends: .test:linux:x86-64:clang-12:avx + variables: + EIGEN_CI_TEST_LABEL: Official + +test:linux:x86-64:clang-12:avx:unsupported: + extends: .test:linux:x86-64:clang-12:avx + variables: + EIGEN_CI_TEST_LABEL: Unsupported + .test:linux:x86-64:clang-12:avx2: extends: .test:linux:x86-64 needs: [ build:linux:cross:x86-64:clang-12:avx2 ] diff --git a/ci/test.windows.gitlab-ci.yml b/ci/test.windows.gitlab-ci.yml index ac1305965..4db6b492a 100644 --- a/ci/test.windows.gitlab-ci.yml +++ b/ci/test.windows.gitlab-ci.yml @@ -90,10 +90,11 @@ test:windows:x86-64:msvc-14.29:avx512dq:unsupported: - x86-64 - cuda -# MSVC 14.16 + CUDA 9.2 -test:windows:x86-64:cuda-9.2:msvc-14.16: - extends: .test:windows:cuda - needs: [ build:windows:x86-64:cuda-9.2:msvc-14.16 ] +# The CUDA 9.2 compiler crashes with an internal error. +# # MSVC 14.16 + CUDA 9.2 +# test:windows:x86-64:cuda-9.2:msvc-14.16: +# extends: .test:windows:cuda +# needs: [ build:windows:x86-64:cuda-9.2:msvc-14.16 ] # MSVC 14.29 + CUDA 10.2 test:windows:x86-64:cuda-10.2:msvc-14.29: diff --git a/scripts/ci_cmake_msvc.ps1 b/scripts/ci_cmake_msvc.ps1 new file mode 100644 index 000000000..5dae3c80f --- /dev/null +++ b/scripts/ci_cmake_msvc.ps1 @@ -0,0 +1,65 @@ +# Powershell script to set up MSVC cmake builds that mirror the CI. Useful for reproducing issues. + +param ($EIGEN_CI_ROOTDIR, + $EIGEN_CI_BUILDDIR, + $EIGEN_CI_BUILD_TARGET, + $EIGEN_CI_ADDITIONAL_ARGS, + $EIGEN_CI_BEFORE_SCRIPT, + $EIGEN_CI_CMAKE_GENERATOR, + $EIGEN_CI_MSVC_ARCH, + $EIGEN_CI_MSVC_VER, + $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS + ) + +function Get-ScriptDirectory { Split-Path $MyInvocation.ScriptName } + +# Set defaults if not already set. +IF (!$EIGEN_CI_ROOTDIR) { $EIGEN_CI_ROOTDIR = Join-Path (Get-ScriptDirectory) '..' } +IF (!$EIGEN_CI_BUILDDIR) { $EIGEN_CI_BUILDDIR = ".build" } +IF (!$EIGEN_CI_BUILD_TARGET) { $EIGEN_CI_BUILD_TARGET = "buildtests" } +IF (!$EIGEN_CI_ADDITIONAL_ARGS) { $EIGEN_CI_ADDITIONAL_ARGS = "" } +IF (!$EIGEN_CI_BEFORE_SCRIPT) { $EIGEN_CI_BEFORE_SCRIPT = "" } +IF (!$EIGEN_CI_CMAKE_GENERATOR) { $EIGEN_CI_CMAKE_GENERATOR = "Ninja" } +IF (!$EIGEN_CI_MSVC_ARCH) { $EIGEN_CI_MSVC_ARCH = "x64" } +IF (!$EIGEN_CI_MSVC_VER) { $EIGEN_CI_MSVC_VER = "14.29" } +IF (!$EIGEN_CI_TEST_CUSTOM_CXX_FLAGS) { $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS = "/d2ReducedOptimizeHugeFunctions /DEIGEN_STRONG_INLINE=inline /Os" } + +# Export variables into the global scope +$global:EIGEN_CI_ROOTDIR = $EIGEN_CI_ROOTDIR +$global:EIGEN_CI_BUILDDIR = $EIGEN_CI_BUILDDIR +$global:EIGEN_CI_BUILD_TARGET = $EIGEN_CI_BUILD_TARGET +$global:EIGEN_CI_ADDITIONAL_ARGS = $EIGEN_CI_ADDITIONAL_ARGS +$global:EIGEN_CI_BEFORE_SCRIPT = $EIGEN_CI_BEFORE_SCRIPT +$global:EIGEN_CI_CMAKE_GENERATOR = $EIGEN_CI_CMAKE_GENERATOR +$global:EIGEN_CI_MSVC_ARCH = $EIGEN_CI_MSVC_ARCH +$global:EIGEN_CI_MSVC_VER = $EIGEN_CI_MSVC_VER +$global:EIGEN_CI_TEST_CUSTOM_CXX_FLAGS = $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS + +# Print configuration variables. +Get-Variable | findstr EIGEN + + +# Run any setup scripts. +if ("${EIGEN_CI_BEFORE_SCRIPT}") { Invoke-Expression -Command "${EIGEN_CI_BEFORE_SCRIPT}" } + +# Find Visual Studio installation directory. +$global:VS_INSTALL_DIR = &"${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath +# Run VCVarsAll.bat incitialization script and extract environment variables. +# http://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html +cmd.exe /c "`"${VS_INSTALL_DIR}\VC\Auxiliary\Build\vcvarsall.bat`" $EIGEN_CI_MSVC_ARCH -vcvars_ver=$EIGEN_CI_MSVC_VER & set" | foreach { if ($_ -match "=") { $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" } } + +# Create and change to the build directory. +IF (-Not (Test-Path -Path $EIGEN_CI_BUILDDIR) ) { mkdir $EIGEN_CI_BUILDDIR } +cd $EIGEN_CI_BUILDDIR + +# We need to split EIGEN_CI_ADDITIONAL_ARGS, otherwise they are interpretted +# as a single argument. Split by space, unless double-quoted. +$split_args = [regex]::Split(${EIGEN_CI_ADDITIONAL_ARGS}, ' (?=(?:[^"]|"[^"]*")*$)' ) +cmake -G "${EIGEN_CI_CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=MinSizeRel -DEIGEN_TEST_CUSTOM_CXX_FLAGS="${EIGEN_CI_TEST_CUSTOM_CXX_FLAGS}" ${split_args} "${EIGEN_CI_ROOTDIR}" + +IF ($EIGEN_CI_BUILD_TARGET) { + # Windows builds sometimes fail due heap errors. In that case, try + # building the rest, then try to build again with a single thread. + cmake --build . --target $EIGEN_CI_BUILD_TARGET -- -k0 || cmake --build . --target $EIGEN_CI_BUILD_TARGET -- -k0 -j1 +} + diff --git a/scripts/ci_cmake_msvc_cuda.ps1 b/scripts/ci_cmake_msvc_cuda.ps1 new file mode 100644 index 000000000..dd615ec3e --- /dev/null +++ b/scripts/ci_cmake_msvc_cuda.ps1 @@ -0,0 +1,31 @@ +# Powershell script to set up MSVC CUDA cmake builds that mirror the CI. Useful for reproducing issues. + +param ($EIGEN_CI_ROOTDIR, + $EIGEN_CI_BUILDDIR, + $EIGEN_CI_BUILD_TARGET, + $EIGEN_CI_ADDITIONAL_ARGS, + $EIGEN_CI_BEFORE_SCRIPT, + $EIGEN_CI_CMAKE_GENERATOR, + $EIGEN_CI_MSVC_ARCH, + $EIGEN_CI_MSVC_VER, + $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS, + + $EIGEN_CI_CUDA_CXX_FLAGS, + $EIGEN_CI_CUDA_COMPUTE_ARCH + ) + +# Set defaults if not already set. +IF (!$EIGEN_CI_CUDA_CXX_FLAGS) { $EIGEN_CI_CUDA_CXX_FLAGS = "" } +IF (!$EIGEN_CI_CUDA_COMPUTE_ARCH) { $EIGEN_CI_CUDA_COMPUTE_ARCH = "50;70" } +IF (!$EIGEN_CI_BUILD_TARGET) { $EIGEN_CI_BUILD_TARGET = "buildtests_gpu" } +IF (!$EIGEN_CI_ADDITIONAL_ARGS) { $EIGEN_CI_ADDITIONAL_ARGS = '-DCMAKE_CUDA_COMPILER=nvcc.exe -DCMAKE_CUDA_SEPARABLE_COMPILATION=OFF -DEIGEN_TEST_CUDA=on -DEIGEN_CUDA_CXX_FLAGS='+${EIGEN_CI_CUDA_CXX_FLAGS}+' -DEIGEN_CUDA_COMPUTE_ARCH='+${EIGEN_CI_CUDA_COMPUTE_ARCH} } + + +# Export variables into the global scope +$global:EIGEN_CI_CUDA_CXX_FLAGS = $EIGEN_CI_CUDA_CXX_FLAGS +$global:EIGEN_CI_CUDA_COMPUTE_ARCH = $EIGEN_CI_CUDA_COMPUTE_ARCH + +# Call the generic msvc setup scripts. +function Get-ScriptDirectory { Split-Path $MyInvocation.ScriptName } +$script = Join-Path (Get-ScriptDirectory) 'ci_cmake_msvc.ps1' +& $script $EIGEN_CI_ROOTDIR $EIGEN_CI_BUILDDIR $EIGEN_CI_BUILD_TARGET $EIGEN_CI_ADDITIONAL_ARGS $EIGEN_CI_BEFORE_SCRIPT $EIGEN_CI_CMAKE_GENERATOR $EIGEN_CI_MSVC_ARCH $EIGEN_CI_MSVC_VER $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS