marian-nmt / marian-dev

Fast Neural Machine Translation in C++ - development repository
https://marian-nmt.github.io
Other
257 stars 126 forks source link

Fix clang 13.0.1 #939

Closed XapaJIaMnu closed 2 years ago

XapaJIaMnu commented 2 years ago

Description

compilation with clang 13.0.1 fails due to set but unused value:

[ 53%] Building CXX object src/CMakeFiles/marian.dir/training/graph_group_async.cpp.o
cd marian-dev/build/src && /usr/bin/clang++ -DBLAS_FOUND=1 -DBUILD_INFO_AVAILABLE=1 -DCOMPILE_CPU=1 -DDETERMINISTIC=0 -DMKL_FOUND=1 -I/opt/intel/mkl/include -Imarian-dev/src -Imarian-dev/src/. -Imarian-dev/src/3rd_party -Imarian-dev/src/3rd_party/SQLiteCpp/include -Imarian-dev/src/3rd_party/sentencepiece -Imarian-dev/src/3rd_party/sentencepiece/third_party/protobuf-lite -Imarian-dev/src/3rd_party/fbgemm/include -Imarian-dev/src/3rd_party/intgemm -Imarian-dev/build/src/3rd_party/intgemm -Imarian-dev/build/local/include -Imarian-dev/src/3rd_party/intgemm/. -std=c++11 -pthread  -fPIC -Wno-unused-result -Wno-unknown-warning-option -Wno-unknown-cuda-version -march=native  -DUSE_SENTENCEPIECE -DMKL_ILP64 -m64 -O3 -m64 -funroll-loops -g  -Wall -Werror -Wextra -Wno-unused-result -Wno-deprecated -Wno-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-value -Wno-unknown-pragmas -Wno-sign-compare -Wno-missing-field-initializers -std=gnu++17 -MD -MT src/CMakeFiles/marian.dir/training/graph_group_async.cpp.o -MF CMakeFiles/marian.dir/training/graph_group_async.cpp.o.d -o CMakeFiles/marian.dir/training/graph_group_async.cpp.o -c marian-dev/src/training/graph_group_async.cpp
In file included from marian-dev/src/training/graph_group_async.cpp:1:
In file included from marian-dev/src/training/graph_group_async.h:4:
In file included from marian-dev/src/training/graph_group.h:9:
In file included from marian-dev/src/training/scheduler.h:7:
marian-dev/src/training/communicator.h:133:11: error: variable 'pos' set but not used [-Werror,-Wunused-but-set-variable]
      int pos = 0;
          ^
1 error generated.
make[2]: *** [src/CMakeFiles/marian.dir/build.make:1154: src/CMakeFiles/marian.dir/training/graph_group_async.cpp.o] Error 1
make[2]: Leaving directory 'marian-dev/build'
make[1]: *** [CMakeFiles/Makefile2:334: src/CMakeFiles/marian.dir/all] Error 2
make[1]: Leaving directory 'marian-dev/build'
make: *** [Makefile:156: all] Error 2

This PR fixes the issue.

Checklist

snukky commented 2 years ago

Thanks, Nick! Looks like a subset of changes proposed in https://github.com/marian-nmt/marian-dev/pull/936, which seem to fix more compatibility issues with newer clang, so I would propose closing this PR and pulling the other.