Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2018-12-11 01:40:11 +0300
committerMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2018-12-11 01:40:11 +0300
commit634ba54839da17587f53c366793cbdfa4ff017a5 (patch)
tree51ca812d83abafd510ea3e949ff716097e23446c
parent8f604afb8877e9f0d3ba639216f76582580f6f6b (diff)
fix warnings
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/3rd_party/zlib/CMakeLists.txt4
-rw-r--r--src/3rd_party/zstr/zstr.hpp10
-rw-r--r--src/command/marian_server.cpp2
-rwxr-xr-xsrc/common/file_stream.h6
-rwxr-xr-xsrc/common/filesystem.h6
-rwxr-xr-xsrc/common/timer.h2
-rwxr-xr-xsrc/data/vocab.cpp4
-rwxr-xr-xsrc/models/amun.h2
-rwxr-xr-xsrc/models/nematus.h2
-rwxr-xr-xsrc/training/graph_group_multinode.cpp10
-rw-r--r--vs/CreateVSProjects.bat9
12 files changed, 33 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb4554cd..d961a4c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,7 @@ endif()
# Set compilation flags
if(MSVC)
- set(CMAKE_CXX_FLAGS "/EHsc /DWIN32 /D_WINDOWS /DUNICODE /D_UNICODE /D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS")
+ set(CMAKE_CXX_FLAGS "/EHsc /DWIN32 /D_WINDOWS /DUNICODE /D_UNICODE /D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /W4 /WX")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /W4 /Zi /MP /GL /DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "/MTd /Od /Ob0 /RTC1 /Zi /D_DEBUG")
diff --git a/src/3rd_party/zlib/CMakeLists.txt b/src/3rd_party/zlib/CMakeLists.txt
index a33b4810..a91b19df 100644
--- a/src/3rd_party/zlib/CMakeLists.txt
+++ b/src/3rd_party/zlib/CMakeLists.txt
@@ -5,6 +5,8 @@ file(GLOB ZLIB_INC *.h)
# add sources of the wrapper as a "SQLiteCpp" static library
add_library(zlib OBJECT ${ZLIB_SRC} ${ZLIB_INC})
-if(NOT MSVC)
+if(MSVC)
+ target_compile_options(zlib PUBLIC /p:NoWarn=4996)
+else()
target_compile_options(zlib PUBLIC -Wno-implicit-function-declaration)
endif()
diff --git a/src/3rd_party/zstr/zstr.hpp b/src/3rd_party/zstr/zstr.hpp
index b621905d..be5094c3 100644
--- a/src/3rd_party/zstr/zstr.hpp
+++ b/src/3rd_party/zstr/zstr.hpp
@@ -179,9 +179,9 @@ public:
// run inflate() on input
if (! zstrm_p) zstrm_p = new detail::z_stream_wrapper(true);
zstrm_p->next_in = reinterpret_cast< decltype(zstrm_p->next_in) >(in_buff_start);
- zstrm_p->avail_in = in_buff_end - in_buff_start;
+ zstrm_p->avail_in = (uInt)(in_buff_end - in_buff_start);
zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff_free_start);
- zstrm_p->avail_out = (out_buff + buff_size) - out_buff_free_start;
+ zstrm_p->avail_out = (uInt)((out_buff + buff_size) - out_buff_free_start);
int ret = inflate(zstrm_p, Z_NO_FLUSH);
// process return code
if (ret != Z_OK && ret != Z_STREAM_END) throw Exception(zstrm_p, ret);
@@ -248,7 +248,7 @@ public:
while (true)
{
zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff);
- zstrm_p->avail_out = buff_size;
+ zstrm_p->avail_out = (uInt)buff_size;
int ret = deflate(zstrm_p, flush);
if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR) throw Exception(zstrm_p, ret);
std::streamsize sz = sbuf_p->sputn(out_buff, reinterpret_cast< decltype(out_buff) >(zstrm_p->next_out) - out_buff);
@@ -283,7 +283,7 @@ public:
virtual std::streambuf::int_type overflow(std::streambuf::int_type c = traits_type::eof())
{
zstrm_p->next_in = reinterpret_cast< decltype(zstrm_p->next_in) >(pbase());
- zstrm_p->avail_in = pptr() - pbase();
+ zstrm_p->avail_in = (uInt)(pptr() - pbase());
while (zstrm_p->avail_in > 0)
{
int r = deflate_loop(Z_NO_FLUSH);
@@ -294,7 +294,7 @@ public:
}
}
setp(in_buff, in_buff + buff_size);
- return traits_type::eq_int_type(c, traits_type::eof()) ? traits_type::eof() : sputc(c);
+ return traits_type::eq_int_type((char)c, traits_type::eof()) ? traits_type::eof() : sputc((char)c);
}
virtual int sync()
{
diff --git a/src/command/marian_server.cpp b/src/command/marian_server.cpp
index fd49fc88..a9a1b0be 100644
--- a/src/command/marian_server.cpp
+++ b/src/command/marian_server.cpp
@@ -17,7 +17,7 @@ int main(int argc, char **argv) {
// Initialize web server
WSServer server;
- server.config.port = options->get<size_t>("port", 8080);
+ server.config.port = (short)options->get<size_t>("port", 8080);
auto &translate = server.endpoint["^/translate/?$"];
diff --git a/src/common/file_stream.h b/src/common/file_stream.h
index 92ae8631..5e49e946 100755
--- a/src/common/file_stream.h
+++ b/src/common/file_stream.h
@@ -4,15 +4,11 @@
#include "common/logging.h"
#include "common/definitions.h"
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsuggest-override"
-#include "3rd_party/zstr/zstr.hpp"
-#pragma GCC diagnostic pop
-
#ifdef _GNUC_
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
+#include "3rd_party/zstr/zstr.hpp"
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream_buffer.hpp>
#ifdef _GNUC_
diff --git a/src/common/filesystem.h b/src/common/filesystem.h
index 9dd0ae55..e0062796 100755
--- a/src/common/filesystem.h
+++ b/src/common/filesystem.h
@@ -7,11 +7,17 @@
// @TODO: go back to canonical names for functions and objects
// as specified in C++17 so it becomes easy to move in the future
+#ifdef _GNUC_
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
+#endif
+
#include "3rd_party/pathie-cpp/include/path.hpp"
#include "3rd_party/pathie-cpp/include/errors.hpp"
+
+#ifdef _GNUC_
#pragma GCC diagnostic pop
+#endif
namespace marian {
namespace filesystem {
diff --git a/src/common/timer.h b/src/common/timer.h
index 264576bf..dfb91bf0 100755
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -21,7 +21,7 @@ namespace marian {
namespace timer {
// Helper function to get the current date and time
-static std::string currentDate() {
+static inline std::string currentDate() {
std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
char date[100] = {0};
std::strftime(date, sizeof(date), "%F %X %z", std::localtime(&now));
diff --git a/src/data/vocab.cpp b/src/data/vocab.cpp
index e95ea721..8860a126 100755
--- a/src/data/vocab.cpp
+++ b/src/data/vocab.cpp
@@ -28,7 +28,7 @@ int Vocab::loadOrCreate(const std::string& vocabPath,
trainPaths[0]);
vImpl_ = createDefaultVocab();
- size = vImpl_->findAndLoad(trainPaths[0], maxSize);
+ size = vImpl_->findAndLoad(trainPaths[0], (int)maxSize);
if(size == 0) {
auto newVocabPath = trainPaths[0] + vImpl_->canonicalExtension();
@@ -55,7 +55,7 @@ int Vocab::loadOrCreate(const std::string& vocabPath,
int Vocab::load(const std::string& vocabPath, size_t maxSize) {
if(!vImpl_)
vImpl_ = createVocab(vocabPath, options_, batchIndex_);
- return vImpl_->load(vocabPath, maxSize);
+ return vImpl_->load(vocabPath, (int)maxSize);
}
void Vocab::create(const std::string& vocabPath,
diff --git a/src/models/amun.h b/src/models/amun.h
index 7e453a83..35b65206 100755
--- a/src/models/amun.h
+++ b/src/models/amun.h
@@ -170,7 +170,7 @@ public:
ioItems.emplace_back();
ioItems.back().name = "decoder_c_tt";
ioItems.back().shape = Shape({1, 0});
- ioItems.back().bytes.emplace_back(0);
+ ioItems.back().bytes.emplace_back((char)0);
io::addMetaToItems(getModelParametersAsString(), "special:model.yml", ioItems);
io::saveItems(name, ioItems);
diff --git a/src/models/nematus.h b/src/models/nematus.h
index c43a90e9..88e9854b 100755
--- a/src/models/nematus.h
+++ b/src/models/nematus.h
@@ -69,7 +69,7 @@ public:
ioItems.emplace_back();
ioItems.back().name = "decoder_c_tt";
ioItems.back().shape = Shape({1, 0});
- ioItems.back().bytes.emplace_back(0);
+ ioItems.back().bytes.emplace_back((char)0);
io::addMetaToItems(getModelParametersAsString(), "special:model.yml", ioItems);
io::saveItems(name, ioItems);
diff --git a/src/training/graph_group_multinode.cpp b/src/training/graph_group_multinode.cpp
index 1164a843..f5cbafd3 100755
--- a/src/training/graph_group_multinode.cpp
+++ b/src/training/graph_group_multinode.cpp
@@ -240,7 +240,7 @@ void MultiNodeGraphGroup::launchServerThread() {
#if CUDA_FOUND
serverShardThread_ = new std::thread([this] {
// keep track of number of nodes still communicating with this shard
- int nCommunicatingNodes = mpi_->numMPIProcesses();
+ int nCommunicatingNodes = (int)mpi_->numMPIProcesses();
MPI_Status status;
do {
// Receive grads from any client
@@ -401,7 +401,7 @@ void MultiNodeGraphGroup::synchronizeWithServerShards(Tensor newGrads,
using namespace functional;
Element(_1 += _2, accGradients[node], accGradientBuffer[node]);
// Accumulate total batch word
- totalBatchWords[node] += batchWords;
+ totalBatchWords[node] += (int)batchWords;
delay_count[node]++;
if(delay_count[node] < tau_)
@@ -461,8 +461,8 @@ void MultiNodeGraphGroup::synchronizeWithServerShards(Tensor newGrads,
size_t localOffset = offset;
std::vector<std::thread> threads;
- for(int gpu = 0; gpu < devices_.size(); gpu++) {
- size_t gpuSize = shardSizes_[gpu];
+ for(int gpui = 0; gpui < devices_.size(); gpui++) {
+ size_t gpuSize = shardSizes_[gpui];
threads.emplace_back(std::thread(
[=](int gpu, size_t offset, size_t size) {
@@ -477,7 +477,7 @@ void MultiNodeGraphGroup::synchronizeWithServerShards(Tensor newGrads,
// Copy params back to current GPU
oldParams->subtensor(offset, size)->copyFrom(shardParams_[gpu]);
},
- gpu,
+ gpui,
localOffset,
gpuSize));
diff --git a/vs/CreateVSProjects.bat b/vs/CreateVSProjects.bat
index bb87feb4..d0705be9 100644
--- a/vs/CreateVSProjects.bat
+++ b/vs/CreateVSProjects.bat
@@ -45,17 +45,20 @@ set CMAKE_OPT=%CMAKE_OPT% -G %GENERATOR_TARGET%
set CMAKE_OPT=%CMAKE_OPT% -D CMAKE_POLICY_DEFAULT_CMP0074=NEW
:: ----- Disable some tool build -----
-set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_SERVER:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_EXAMPLES:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_TESTS:BOOL=FALSE
+set CMAKE_OPT=%CMAKE_OPT% -D USE_MPI:BOOL=FALSE
+:: ----- Enable certain options -----
+set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_SERVER:BOOL=TRUE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_CPU:BOOL=TRUE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_CUDA:BOOL=TRUE
+set CMAKE_OPT=%CMAKE_OPT% -D USE_CUDNN:BOOL=TRUE
+
+:: ----- Not supported on Windows yet -----
set CMAKE_OPT=%CMAKE_OPT% -D USE_NCCL:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D USE_SENTENCEPIECE:BOOL=FALSE
-set CMAKE_OPT=%CMAKE_OPT% -D USE_CUDNN:BOOL=FALSE
-set CMAKE_OPT=%CMAKE_OPT% -D USE_MPI:BOOL=FALSE
echo.
echo.