diff options
author | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2018-12-11 02:40:17 +0300 |
---|---|---|
committer | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2018-12-11 02:40:17 +0300 |
commit | 30b6219773f2bf61e16ce35de65c7c45d9bc7d2c (patch) | |
tree | d7b6ee01eaeccb61d24a4ae46f71cdb711946c32 | |
parent | 634ba54839da17587f53c366793cbdfa4ff017a5 (diff) |
fix more warnings, make CUDA optional for windows
-rw-r--r-- | src/3rd_party/pathie-cpp/src/path.cpp | 11 | ||||
-rw-r--r-- | src/3rd_party/pathie-cpp/src/pathie.cpp | 8 | ||||
-rw-r--r-- | src/3rd_party/zlib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/3rd_party/zlib/zutil.c | 13 | ||||
-rwxr-xr-x | src/tensors/rand.cpp | 4 | ||||
-rw-r--r-- | vs/CheckDeps.bat | 135 | ||||
-rw-r--r-- | vs/CreateVSProjects.bat | 2 |
7 files changed, 67 insertions, 108 deletions
diff --git a/src/3rd_party/pathie-cpp/src/path.cpp b/src/3rd_party/pathie-cpp/src/path.cpp index 2adcef20..3dc1e14b 100644 --- a/src/3rd_party/pathie-cpp/src/path.cpp +++ b/src/3rd_party/pathie-cpp/src/path.cpp @@ -51,6 +51,7 @@ #include <shlwapi.h> //#include <ntifs.h> // Currently not in msys2 +// @TODO: This is a hack to make it compile under Windows, check if this is save. #define F_OK 0 #elif defined(_PATHIE_UNIX) @@ -161,7 +162,7 @@ void Path::sanitize() } // Remove trailing slash if any (except for the filesystem root) - long len = m_path.length(); + long len = (long)m_path.length(); #if defined(_PATHIE_UNIX) if (len > 1 && m_path[len - 1] == '/') m_path = m_path.substr(0, len - 1); @@ -2922,6 +2923,7 @@ Path Path::global_appentries_dir(localpathtype local) #else #error Unsupported system. #endif + local; // make compiler happy } /** @@ -2954,6 +2956,7 @@ Path Path::global_immutable_data_dir(localpathtype local) #else #error Unsupported system. #endif + local; // make compiler happy } /** @@ -2986,6 +2989,7 @@ Path Path::global_mutable_data_dir(localpathtype local) #else #error Unsupported system #endif + local; // make compiler happy } /** @@ -3015,6 +3019,7 @@ Path Path::global_cache_dir(localpathtype local) #else #error Unsupported system. #endif + local; // make compiler happy } /** @@ -3047,6 +3052,7 @@ Path Path::global_runtime_dir(localpathtype local) #else #error Unsupported system. #endif + local; // make compiler happy } /** @@ -3080,6 +3086,7 @@ Path Path::global_config_dir(localpathtype local) #else #error Unsupported system. #endif + local; // make compiler happy } /** @@ -3229,6 +3236,7 @@ std::vector<Path> Path::glob(const std::string& pattern, int flags /* = 0 */) #else #error Unsupported system. #endif + flags; // make compiler happy } ///@} @@ -3278,6 +3286,7 @@ bool Path::fnmatch(const std::string& pattern, int flags /* = 0 */) const #else #error Unsupported system. #endif + flags; // make compiler happy } /** diff --git a/src/3rd_party/pathie-cpp/src/pathie.cpp b/src/3rd_party/pathie-cpp/src/pathie.cpp index 9df1f733..c0abc689 100644 --- a/src/3rd_party/pathie-cpp/src/pathie.cpp +++ b/src/3rd_party/pathie-cpp/src/pathie.cpp @@ -39,12 +39,12 @@ */ std::string Pathie::utf16_to_utf8(std::wstring str) { - int size = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0, NULL, NULL); + int size = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length(), NULL, 0, NULL, NULL); char* utf8 = (char*) malloc(size); // sizeof(char) = 1 per ANSI C standard. memset(utf8, 0, size); - size = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), utf8, size, NULL, NULL); + size = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length(), utf8, size, NULL, NULL); if (size == 0) throw(Pathie::WindowsError(GetLastError())); @@ -61,12 +61,12 @@ std::string Pathie::utf16_to_utf8(std::wstring str) */ std::wstring Pathie::utf8_to_utf16(std::string str) { - int count = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0); + int count = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.length(), NULL, 0); wchar_t* utf16 = (wchar_t*) malloc(count * sizeof(wchar_t)); memset(utf16, 0, count * sizeof(wchar_t)); - count = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), utf16, count); + count = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.length(), utf16, count); if (count == 0) throw(Pathie::WindowsError(GetLastError())); diff --git a/src/3rd_party/zlib/CMakeLists.txt b/src/3rd_party/zlib/CMakeLists.txt index a91b19df..503e0f1a 100644 --- a/src/3rd_party/zlib/CMakeLists.txt +++ b/src/3rd_party/zlib/CMakeLists.txt @@ -6,7 +6,7 @@ file(GLOB ZLIB_INC *.h) add_library(zlib OBJECT ${ZLIB_SRC} ${ZLIB_INC}) if(MSVC) - target_compile_options(zlib PUBLIC /p:NoWarn=4996) + target_compile_options(zlib PUBLIC /wd"4996" /wd"4267") else() target_compile_options(zlib PUBLIC -Wno-implicit-function-declaration) endif() diff --git a/src/3rd_party/zlib/zutil.c b/src/3rd_party/zlib/zutil.c index a76c6b0c..8c494e94 100644 --- a/src/3rd_party/zlib/zutil.c +++ b/src/3rd_party/zlib/zutil.c @@ -296,11 +296,14 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) #ifndef MY_ZCALLOC /* Any system without a special alloc function */ -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif +// // Fix linker warning under MSC +// #define STDC + +// #ifndef STDC +// extern voidp malloc OF((uInt size)); +// extern voidp calloc OF((uInt items, uInt size)); +// extern void free OF((voidpf ptr)); +// #endif voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) voidpf opaque; diff --git a/src/tensors/rand.cpp b/src/tensors/rand.cpp index e6225c2e..3c7a519b 100755 --- a/src/tensors/rand.cpp +++ b/src/tensors/rand.cpp @@ -71,7 +71,7 @@ void StdlibRandomGenerator::normal(Tensor tensor, float mean, float stddev) { CurandRandomGenerator::CurandRandomGenerator(size_t seed, DeviceId deviceId) : RandomGenerator(seed), deviceId_(deviceId) { if(deviceId_.type == DeviceType::gpu) { - cudaSetDevice(deviceId_.no); + cudaSetDevice((int)deviceId_.no); CURAND_CHECK(curandCreateGenerator(&generator_, CURAND_RNG_PSEUDO_DEFAULT)); } else { @@ -82,7 +82,7 @@ CurandRandomGenerator::CurandRandomGenerator(size_t seed, DeviceId deviceId) CurandRandomGenerator::~CurandRandomGenerator() { if(deviceId_.type == DeviceType::gpu) - cudaSetDevice(deviceId_.no); + cudaSetDevice((int)deviceId_.no); CURAND_CHECK(curandDestroyGenerator(generator_)); } diff --git a/vs/CheckDeps.bat b/vs/CheckDeps.bat index 7a3d2c8d..88ef7982 100644 --- a/vs/CheckDeps.bat +++ b/vs/CheckDeps.bat @@ -2,8 +2,8 @@ :: Usage: CheckDeps.bat
::
:: This script is used to verify that all the dependencies required to build Marian are available.
-:: The Cuda SDK, the CuDNN library and the Intel MKL must be installed beforehand by the user.
-:: The Boost, zlib and OpenSSH libraries, if not found, will be installed by this script using vcpkg
+:: The Cuda SDK and the Intel MKL must be installed beforehand by the user.
+:: The Boost and OpenSSH libraries, if not found, will be installed by this script using vcpkg
::
::
@echo off
@@ -27,7 +27,6 @@ set ROOT=%~dp0 ::----------------------------------------------------------------------------------------------
::set BOOST_INCLUDEDIR=
::set BOOST_LIBRARYDIR=
-::set ZLIB_ROOT=
::set OPENSSL_ROOT_DIR=
@@ -44,7 +43,6 @@ set ROOT=%~dp0 if "%BOOST_INCLUDEDIR%" == "" goto :needVcPkg
-if "%ZLIB_ROOT%" == "" goto :needVcPkg
if "%OPENSSL_ROOT_DIR%" == "" goto :needVcPkg
goto :checkDeps
@@ -110,44 +108,31 @@ set CMAKE_OPT= ::
echo.
echo ... CUDA
-if "%CUDA_PATH%"=="" (
- echo The CUDA_PATH environment variable is not defined: please make sure CUDA 8.0+ is installed.
- exit /b 1
-)
-if not exist "%CUDA_PATH%" (
- echo CUDA_PATH is set to a non existing path:
- echo %CUDA_PATH%
- echo Please make sure CUDA 8.0+ is properly installed.
- exit /b 1
-)
-if not exist "%CUDA_PATH%\include\cuda.h" (
- echo CUDA header files were not found in this folder:
- echo "%CUDA_PATH%"
- echo Please make sure CUDA 8.0+ is properly installed.
- exit /b 1
-)
-if not exist "%CUDA_PATH%\lib\x64\cuda.lib" (
- echo CUDA library files were not found in this folder:
- echo "%CUDA_PATH%"
- echo Please make sure CUDA 8.0+ is properly installed.
- exit /b 1
-)
+REM if "%CUDA_PATH%"=="" (
+REM echo The CUDA_PATH environment variable is not defined: please make sure CUDA 8.0+ is installed.
+REM exit /b 1
+REM )
+REM if not exist "%CUDA_PATH%" (
+REM echo CUDA_PATH is set to a non existing path:
+REM echo %CUDA_PATH%
+REM echo Please make sure CUDA 8.0+ is properly installed.
+REM exit /b 1
+REM )
+REM if not exist "%CUDA_PATH%\include\cuda.h" (
+REM echo CUDA header files were not found in this folder:
+REM echo "%CUDA_PATH%"
+REM echo Please make sure CUDA 8.0+ is properly installed.
+REM exit /b 1
+REM )
+REM if not exist "%CUDA_PATH%\lib\x64\cuda.lib" (
+REM echo CUDA library files were not found in this folder:
+REM echo "%CUDA_PATH%"
+REM echo Please make sure CUDA 8.0+ is properly installed.
+REM exit /b 1
+REM )
echo Found Cuda SDK in %CUDA_PATH%
-
-:: -------------------------
-:: CuDNN is installed manually into CUDA directories.
-echo.
-echo ... CUDNN
-if not exist "%CUDA_PATH%\lib\x64\cudnn.lib" (
- echo The CuDNN library was not found. Please make sure it is installed correctly in your CUDA setup.
- exit /b 1
-)
-
-echo Found CuDNN library in %CUDA_PATH%\lib\x64
-
-
:: -------------------------
:: The MKL setup does not set any environment variable to the installation path.
:: The script look into the standard default installation dir
@@ -179,7 +164,6 @@ if not exist "%MKLROOT%\lib\intel64\mkl_core.lib" ( echo Found Intel MKL library in %MKLROOT%
-
:: -------------------------
:: BOOST_INCLUDEDIR and BOOST_LIBRARYDIR can be both set to an existing Boost installation.
:: If not, we use vcpkg to install the required Boost packages
@@ -220,41 +204,6 @@ if not exist "%BOOST_LIBRARYDIR%\boost_*.lib" ( echo Found Boost headers in "%BOOST_INCLUDEDIR%" and libs in "%BOOST_LIBRARYDIR%"
-
-:: -------------------------
-:: ZLIB_ROOT can be set to an existing zlib installation.
-:: If not, we use vcpkg to install the library
-::
-echo.
-echo ... zlib
-if "%ZLIB_ROOT%"=="" (
- %VCPKG% install zlib
- set ZLIB_ROOT=%VCPKG_INSTALL%
-)
-
-if not exist "%ZLIB_ROOT%" (
- echo ZLIB_ROOT is set to a non existing path:
- echo "%ZLIB_ROOT%"
- echo Please set ZLIB_ROOT to the installation path of the zlib library.
- exit /b 1
-)
-if not exist "%ZLIB_ROOT%\include\zlib.h" (
- echo zlib header files were not found in this folder:
- echo "%ZLIB_ROOT%"
- echo Please make sure zlib is correctly installed.
- exit /b 1
-)
-if not exist "%ZLIB_ROOT%\lib\zlib.lib" (
- echo zlib library file were not found in this folder:
- echo "%ZLIB_ROOT%"
- echo Please make sure zlib is correctly installed.
- exit /b 1
-)
-
-echo Found zlib library in "%ZLIB_ROOT%"
-
-
-
:: -------------------------
:: OPENSSL_ROOT_DIR can be set to an existing OpenSSL installation.
:: If not, we use vcpkg to install the library
@@ -266,28 +215,27 @@ if "%OPENSSL_ROOT_DIR%"=="" ( set OPENSSL_ROOT_DIR=%VCPKG_INSTALL%
)
-if not exist "%OPENSSL_ROOT_DIR%" (
- echo OPENSSL_ROOT_DIR is set to a non existing path:
- echo "%OPENSSL_ROOT_DIR%"
- echo Please set OPENSSL_ROOT_DIR to the installation path of the OpenSLL library.
- exit /b 1
-)
-if not exist "%OPENSSL_ROOT_DIR%\include\openssl\opensslv.h" (
- echo OpenSSL header files were not found in this folder:
- echo "%OPENSSL_ROOT_DIR%"
- echo Please make sure OpenSSL is correctly installed.
- exit /b 1
-)
-if not exist "%OPENSSL_ROOT_DIR%\lib\ssleay32.lib" (
- echo OpenSSL library file were not found in this folder:
- echo "%OPENSSL_ROOT_DIR%"
- echo Please make sure OpenSSL is correctly installed.
- exit /b 1
+REM if not exist "%OPENSSL_ROOT_DIR%" (
+REM echo OPENSSL_ROOT_DIR is set to a non existing path:
+REM echo "%OPENSSL_ROOT_DIR%"
+REM echo Please set OPENSSL_ROOT_DIR to the installation path of the OpenSLL library.
+REM exit /b 1
+REM )
+REM if not exist "%OPENSSL_ROOT_DIR%\include\openssl\opensslv.h" (
+REM echo OpenSSL header files were not found in this folder:
+REM echo "%OPENSSL_ROOT_DIR%"
+REM echo Please make sure OpenSSL is correctly installed.
+REM exit /b 1
+REM )
+REM if not exist "%OPENSSL_ROOT_DIR%\lib\ssleay32.lib" (
+REM echo OpenSSL library file were not found in this folder:
+REM echo "%OPENSSL_ROOT_DIR%"
+REM echo Please make sure OpenSSL is correctly installed.
+REM exit /b 1
)
echo Found OpenSSL library in "%OPENSSL_ROOT_DIR%"
-
echo.
echo.
echo --------------------------------------------------
@@ -296,7 +244,6 @@ echo MKLROOT ^| %MKLROOT% echo VCPKG_ROOT ^| %VCPKG_ROOT%
echo BOOST_INCLUDEDIR ^| %BOOST_INCLUDEDIR%
echo BOOST_LIBRARYDIR ^| %BOOST_LIBRARYDIR%
-echo ZLIB_ROOT ^| %ZLIB_ROOT%
echo OPENSSL_ROOT_DIR ^| %OPENSSL_ROOT_DIR%
echo --------------------------------------------------
echo.
diff --git a/vs/CreateVSProjects.bat b/vs/CreateVSProjects.bat index d0705be9..8ed286a7 100644 --- a/vs/CreateVSProjects.bat +++ b/vs/CreateVSProjects.bat @@ -48,12 +48,12 @@ set CMAKE_OPT=%CMAKE_OPT% -D CMAKE_POLICY_DEFAULT_CMP0074=NEW 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
+set CMAKE_OPT=%CMAKE_OPT% -D USE_CUDNN: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
|