Merged PR 22483: Make C++17 the official standard for Marian

Make C++17 the official standard for Marian
This commit is contained in:
Marcin Junczys-Dowmunt 2022-02-10 16:34:23 +00:00
parent e6dbacb310
commit b3feecc82b
6 changed files with 20 additions and 52 deletions

View File

@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- Changed minimal C++ standard to C++-17
## [1.11.0] - 2022-02-08
### Added

View File

@ -6,7 +6,7 @@ if (POLICY CMP0074)
endif ()
project(marian CXX C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BUILD_ARCH native CACHE STRING "Compile for this CPU architecture.")
@ -91,10 +91,11 @@ if(MSVC)
# C4310: cast truncates constant value
# C4324: 'marian::cpu::int16::`anonymous-namespace'::ScatterPut': structure was padded due to alignment specifier
# C4702: unreachable code; note it is also disabled globally in the VS project file
# C4996: warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17
if(USE_SENTENCEPIECE)
set(DISABLE_GLOBALLY "/wd\"4310\" /wd\"4324\" /wd\"4702\" /wd\"4100\"")
set(DISABLE_GLOBALLY "/wd\"4310\" /wd\"4324\" /wd\"4702\" /wd\"4996\" /wd\"4100\"")
else()
set(DISABLE_GLOBALLY "/wd\"4310\" /wd\"4324\" /wd\"4702\"")
set(DISABLE_GLOBALLY "/wd\"4310\" /wd\"4324\" /wd\"4702\" /wd\"4996\"")
endif()
# set(INTRINSICS "/arch:AVX")

View File

@ -1 +1 @@
v1.11.0
v1.11.1

View File

@ -192,6 +192,9 @@ stages:
displayName: Ubuntu
timeoutInMinutes: 90
# Minimal tested configurations for marian-dev v1.11 and C++17:
# * Ubuntu 16.04, GCC 7.5, CMake 3.10.2, CUDA 9.2 (probably GCC 6 would work too)
# * Ubuntu 18.04, GCC 7.5, CMake 3.12.2, CUDA 10.0
strategy:
matrix:
################################################################
@ -319,51 +322,6 @@ stages:
displayName: Print versions
workingDirectory: build
######################################################################
- job: BuildUbuntuMinimal
condition: eq(${{ parameters.runBuilds }}, true)
displayName: Ubuntu CPU+GPU gcc-7 cmake 3.5
pool:
vmImage: ubuntu-18.04
steps:
- checkout: self
submodules: true
# The script simplifies installation of different versions of CUDA.
- bash: ./scripts/ci/install_cuda_ubuntu.sh "10.0"
displayName: Install CUDA
# CMake 3.5.1 is the minimum version supported
- bash: |
wget -nv https://cmake.org/files/v3.5/cmake-3.5.1-Linux-x86_64.tar.gz
tar zxf cmake-3.5.1-Linux-x86_64.tar.gz
./cmake-3.5.1-Linux-x86_64/bin/cmake --version
displayName: Download CMake
# GCC 5 is the minimum version supported
- bash: |
/usr/bin/gcc-7 --version
mkdir -p build
cd build
CC=/usr/bin/gcc-7 CXX=/usr/bin/g++-7 CUDAHOSTCXX=/usr/bin/g++-7 \
../cmake-3.5.1-Linux-x86_64/bin/cmake .. \
-DCOMPILE_CPU=on \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0
displayName: Configure CMake
- bash: make -j3
displayName: Compile
workingDirectory: build
- bash: |
./marian --version
./marian-decoder --version
./marian-scorer --version
displayName: Print versions
workingDirectory: build
######################################################################
- job: BuildMacOS
condition: eq(${{ parameters.runBuilds }}, true)

View File

@ -60,6 +60,13 @@ CUDA_PACKAGES_IN=(
CUDA_PACKAGES=""
for package in "${CUDA_PACKAGES_IN[@]}"; do
# @todo This is not perfect. Should probably provide a separate list for diff versions
# cuda-compiler-X-Y if CUDA >= 9.1 else cuda-nvcc-X-Y
if [[ "${package}" == "nvcc" ]] && version_ge "$CUDA_VERSION_MAJOR_MINOR" "9.1" ; then
package="compiler"
elif [[ "${package}" == "compiler" ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "9.1" ; then
package="nvcc"
fi
# Build the full package name and append to the string.
CUDA_PACKAGES+=" cuda-${package}-${CUDA_MAJOR}-${CUDA_MINOR}"
done
@ -72,8 +79,8 @@ echo "CUDA_PACKAGES ${CUDA_PACKAGES}"
PIN_FILENAME="cuda-ubuntu${UBUNTU_VERSION}.pin"
PIN_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/${PIN_FILENAME}"
APT_KEY_URL="http://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/7fa2af80.pub"
REPO_URL="http://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/"
APT_KEY_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/7fa2af80.pub"
REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/"
echo "PIN_FILENAME ${PIN_FILENAME}"
echo "PIN_URL ${PIN_URL}"

View File

@ -344,7 +344,7 @@ inline HalfFloat operator+ (HalfFloat one, HalfFloat two)
// compute the difference between the two exponents. shifts with negative
// numbers are undefined, thus we need two code paths
register int expDiff = one.IEEE.Exp - two.IEEE.Exp;
/*register*/ int expDiff = one.IEEE.Exp - two.IEEE.Exp;
if (0 == expDiff)
{