From dc249144157df2e2a877c89bc7799712ab172819 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 28 Jul 2017 11:49:39 +0530 Subject: [PATCH 01/18] check compiler is msvc instead of msvc --- cmake/prebuild.cmake | 11 +++++------ kernel/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake index a7f98bfb89..eacf518cdf 100644 --- a/cmake/prebuild.cmake +++ b/cmake/prebuild.cmake @@ -63,15 +63,14 @@ set(GETARCH_SRC ${CPUIDEMO} ) -if (NOT MSVC) +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") + #Use generic for MSVC now + message("MSVC") + set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC) +else() list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S) endif () -if (MSVC) -#Use generic for MSVC now -set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC) -endif() - if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") # disable WindowsStore strict CRT checks set(GETARCH_FLAGS ${GETARCH_FLAGS} -D_CRT_SECURE_NO_WARNINGS) diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 8bfcccf17f..2a5cb0d8f1 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -22,7 +22,7 @@ ParseMakefileVars("${KERNELDIR}/KERNEL") ParseMakefileVars("${KERNELDIR}/KERNEL.${TARGET_CORE}") if (${ARCH} STREQUAL "x86") -if (NOT MSVC) +if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") GenerateNamedObjects("${KERNELDIR}/cpuid.S" "" "" false "" "" true) else() GenerateNamedObjects("${KERNELDIR}/cpuid_win.c" "" "" false "" "" true) From ca17b4b75cc4c897b7c7e8dca51c9e465ed46ef8 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 28 Jul 2017 11:50:29 +0530 Subject: [PATCH 02/18] Fix complex support for MSVC headers --- common.h | 50 +++++++++++++++++++------------------- common_param.h | 12 ++++----- kernel/x86_64/cdot.c | 9 +++---- kernel/x86_64/zdot.c | 9 +++---- openblas_config_template.h | 2 +- 5 files changed, 40 insertions(+), 42 deletions(-) diff --git a/common.h b/common.h index 4463141c8c..22ec383ac9 100644 --- a/common.h +++ b/common.h @@ -495,6 +495,31 @@ static void __inline blas_lock(volatile BLASULONG *address){ #define MMAP_POLICY (MAP_PRIVATE | MAP_ANONYMOUS) #endif +/* C99 supports complex floating numbers natively, which GCC also offers as an + extension since version 3.0. If neither are available, use a compatible + structure as fallback (see Clause 6.2.5.13 of the C99 standard). */ +#if ((defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \ + (__GNUC__ >= 3 && !defined(__cplusplus))) && !(defined(FORCE_OPENBLAS_COMPLEX_STRUCT))) && !defined(_MSC_VER) + #define OPENBLAS_COMPLEX_C99 + #ifndef __cplusplus + #include + #endif + typedef float _Complex openblas_complex_float; + typedef double _Complex openblas_complex_double; + typedef xdouble _Complex openblas_complex_xdouble; + #define openblas_make_complex_float(real, imag) ((real) + ((imag) * _Complex_I)) + #define openblas_make_complex_double(real, imag) ((real) + ((imag) * _Complex_I)) + #define openblas_make_complex_xdouble(real, imag) ((real) + ((imag) * _Complex_I)) +#else + #define OPENBLAS_COMPLEX_STRUCT + typedef struct { float real, imag; } openblas_complex_float; + typedef struct { double real, imag; } openblas_complex_double; + typedef struct { xdouble real, imag; } openblas_complex_xdouble; + #define openblas_make_complex_float(real, imag) {(real), (imag)} + #define openblas_make_complex_double(real, imag) {(real), (imag)} + #define openblas_make_complex_xdouble(real, imag) {(real), (imag)} +#endif + #include "param.h" #include "common_param.h" @@ -524,31 +549,6 @@ static void __inline blas_lock(volatile BLASULONG *address){ #include #endif // NOINCLUDE -/* C99 supports complex floating numbers natively, which GCC also offers as an - extension since version 3.0. If neither are available, use a compatible - structure as fallback (see Clause 6.2.5.13 of the C99 standard). */ -#if ((defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \ - (__GNUC__ >= 3 && !defined(__cplusplus))) && !(defined(FORCE_OPENBLAS_COMPLEX_STRUCT))) - #define OPENBLAS_COMPLEX_C99 - #ifndef __cplusplus - #include - #endif - typedef float _Complex openblas_complex_float; - typedef double _Complex openblas_complex_double; - typedef xdouble _Complex openblas_complex_xdouble; - #define openblas_make_complex_float(real, imag) ((real) + ((imag) * _Complex_I)) - #define openblas_make_complex_double(real, imag) ((real) + ((imag) * _Complex_I)) - #define openblas_make_complex_xdouble(real, imag) ((real) + ((imag) * _Complex_I)) -#else - #define OPENBLAS_COMPLEX_STRUCT - typedef struct { float real, imag; } openblas_complex_float; - typedef struct { double real, imag; } openblas_complex_double; - typedef struct { xdouble real, imag; } openblas_complex_xdouble; - #define openblas_make_complex_float(real, imag) {(real), (imag)} - #define openblas_make_complex_double(real, imag) {(real), (imag)} - #define openblas_make_complex_xdouble(real, imag) {(real), (imag)} -#endif - #ifdef XDOUBLE #define OPENBLAS_COMPLEX_FLOAT openblas_complex_xdouble #define OPENBLAS_MAKE_COMPLEX_FLOAT(r,i) openblas_make_complex_xdouble(r,i) diff --git a/common_param.h b/common_param.h index 36d6149ea8..0513ace9f9 100644 --- a/common_param.h +++ b/common_param.h @@ -333,8 +333,8 @@ BLASLONG (*icamin_k)(BLASLONG, float *, BLASLONG); float (*cnrm2_k) (BLASLONG, float *, BLASLONG); float (*casum_k) (BLASLONG, float *, BLASLONG); int (*ccopy_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG); - float _Complex (*cdotu_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG); - float _Complex (*cdotc_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG); + openblas_complex_float (*cdotu_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG); + openblas_complex_float (*cdotc_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG); int (*csrot_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG, float, float); int (*caxpy_k) (BLASLONG, BLASLONG, BLASLONG, float, float, float *, BLASLONG, float *, BLASLONG, float *, BLASLONG); @@ -496,8 +496,8 @@ BLASLONG (*izamin_k)(BLASLONG, double *, BLASLONG); double (*znrm2_k) (BLASLONG, double *, BLASLONG); double (*zasum_k) (BLASLONG, double *, BLASLONG); int (*zcopy_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG); - double _Complex (*zdotu_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG); - double _Complex (*zdotc_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG); + openblas_complex_double (*zdotu_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG); + openblas_complex_double (*zdotc_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG); int (*zdrot_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG, double, double); int (*zaxpy_k) (BLASLONG, BLASLONG, BLASLONG, double, double, double *, BLASLONG, double *, BLASLONG, double *, BLASLONG); @@ -661,8 +661,8 @@ BLASLONG (*ixamin_k)(BLASLONG, xdouble *, BLASLONG); xdouble (*xnrm2_k) (BLASLONG, xdouble *, BLASLONG); xdouble (*xasum_k) (BLASLONG, xdouble *, BLASLONG); int (*xcopy_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG); - xdouble _Complex (*xdotu_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG); - xdouble _Complex (*xdotc_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG); + openblas_complex_xdouble (*xdotu_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG); + openblas_complex_xdouble (*xdotc_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG); int (*xqrot_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG, xdouble, xdouble); int (*xaxpy_k) (BLASLONG, BLASLONG, BLASLONG, xdouble, xdouble, xdouble *, BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG); diff --git a/kernel/x86_64/cdot.c b/kernel/x86_64/cdot.c index ce396a2ceb..5f01f7eebf 100644 --- a/kernel/x86_64/cdot.c +++ b/kernel/x86_64/cdot.c @@ -91,16 +91,15 @@ static void cdot_kernel_16(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *d) #endif -FLOAT _Complex CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y) +OPENBLAS_COMPLEX_FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y) { BLASLONG i; BLASLONG ix,iy; - FLOAT _Complex result; FLOAT dot[8] = { 0.0, 0.0, 0.0 , 0.0, 0.0, 0.0, 0.0, 0.0 } ; if ( n <= 0 ) { - result = OPENBLAS_MAKE_COMPLEX_FLOAT (0.0, 0.0) ; + OPENBLAS_COMPLEX_FLOAT result = OPENBLAS_MAKE_COMPLEX_FLOAT (0.0, 0.0) ; return(result); } @@ -160,11 +159,11 @@ FLOAT _Complex CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG in } #if !defined(CONJ) - result = OPENBLAS_MAKE_COMPLEX_FLOAT (dot[0]-dot[1], dot[4]+dot[5]) ; + OPENBLAS_COMPLEX_FLOAT result = OPENBLAS_MAKE_COMPLEX_FLOAT (dot[0]-dot[1], dot[4]+dot[5]) ; // CREAL(result) = dot[0] - dot[1]; // CIMAG(result) = dot[4] + dot[5]; #else - result = OPENBLAS_MAKE_COMPLEX_FLOAT (dot[0]+dot[1], dot[4]-dot[5]) ; + OPENBLAS_COMPLEX_FLOAT result = OPENBLAS_MAKE_COMPLEX_FLOAT (dot[0]+dot[1], dot[4]-dot[5]) ; // CREAL(result) = dot[0] + dot[1]; // CIMAG(result) = dot[4] - dot[5]; diff --git a/kernel/x86_64/zdot.c b/kernel/x86_64/zdot.c index 2fcacc87a8..d11c76647c 100644 --- a/kernel/x86_64/zdot.c +++ b/kernel/x86_64/zdot.c @@ -86,18 +86,17 @@ static void zdot_kernel_8(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *d) #endif -FLOAT _Complex CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y) +OPENBLAS_COMPLEX_FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y) { BLASLONG i; BLASLONG ix,iy; - FLOAT _Complex result; FLOAT dot[4] = { 0.0, 0.0, 0.0 , 0.0 } ; if ( n <= 0 ) { // CREAL(result) = 0.0 ; // CIMAG(result) = 0.0 ; - result=OPENBLAS_MAKE_COMPLEX_FLOAT(0.0,0.0); + OPENBLAS_COMPLEX_FLOAT result=OPENBLAS_MAKE_COMPLEX_FLOAT(0.0,0.0); return(result); } @@ -151,11 +150,11 @@ FLOAT _Complex CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG in } #if !defined(CONJ) - result=OPENBLAS_MAKE_COMPLEX_FLOAT(dot[0]-dot[1],dot[2]+dot[3]); + OPENBLAS_COMPLEX_FLOAT result=OPENBLAS_MAKE_COMPLEX_FLOAT(dot[0]-dot[1],dot[2]+dot[3]); // CREAL(result) = dot[0] - dot[1]; // CIMAG(result) = dot[2] + dot[3]; #else - result=OPENBLAS_MAKE_COMPLEX_FLOAT(dot[0]+dot[1],dot[2]-dot[3]); + OPENBLAS_COMPLEX_FLOAT result=OPENBLAS_MAKE_COMPLEX_FLOAT(dot[0]+dot[1],dot[2]-dot[3]); // CREAL(result) = dot[0] + dot[1]; // CIMAG(result) = dot[2] - dot[3]; diff --git a/openblas_config_template.h b/openblas_config_template.h index fd61714928..52dd49da2b 100644 --- a/openblas_config_template.h +++ b/openblas_config_template.h @@ -59,7 +59,7 @@ typedef int blasint; extension since version 3.0. If neither are available, use a compatible structure as fallback (see Clause 6.2.5.13 of the C99 standard). */ #if ((defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \ - (__GNUC__ >= 3 && !defined(__cplusplus))) && !(defined(FORCE_OPENBLAS_COMPLEX_STRUCT))) + (__GNUC__ >= 3 && !defined(__cplusplus))) && !(defined(FORCE_OPENBLAS_COMPLEX_STRUCT))) && !defined(_MSC_VER) #define OPENBLAS_COMPLEX_C99 #ifndef __cplusplus #include From eb98fdddfc4ef33dc7fe9817da4e6fe0c369db38 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 20:38:16 +0530 Subject: [PATCH 03/18] typedefs only for c --- common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common.h b/common.h index 22ec383ac9..ae98279ef3 100644 --- a/common.h +++ b/common.h @@ -495,6 +495,7 @@ static void __inline blas_lock(volatile BLASULONG *address){ #define MMAP_POLICY (MAP_PRIVATE | MAP_ANONYMOUS) #endif +#ifndef ASSEMBLER /* C99 supports complex floating numbers natively, which GCC also offers as an extension since version 3.0. If neither are available, use a compatible structure as fallback (see Clause 6.2.5.13 of the C99 standard). */ @@ -519,6 +520,7 @@ static void __inline blas_lock(volatile BLASULONG *address){ #define openblas_make_complex_double(real, imag) {(real), (imag)} #define openblas_make_complex_xdouble(real, imag) {(real), (imag)} #endif +#endif #include "param.h" #include "common_param.h" From 4c5df489db4792acfc861135b8d90e03de9805a6 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 20:59:17 +0530 Subject: [PATCH 04/18] clang on windows needs FU='' --- cmake/c_check.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/c_check.cmake b/cmake/c_check.cmake index 56ae612ea8..a0784f09c1 100644 --- a/cmake/c_check.cmake +++ b/cmake/c_check.cmake @@ -28,6 +28,8 @@ set(FU "") if(APPLE) set(FU "_") +elseif(MSVC AND ${CMAKE_C_COMPILER_ID} MATCHES "Clang") +set(FU "") elseif(MSVC) set(FU "_") elseif(UNIX) From ea1095135ebf60350cd8a60f35c299c1b100a224 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:00:32 +0530 Subject: [PATCH 05/18] Ninja complains that file openblas.def does not exist --- cmake/export.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/export.cmake b/cmake/export.cmake index 629f8fbc25..a9d1fc458c 100644 --- a/cmake/export.cmake +++ b/cmake/export.cmake @@ -51,7 +51,8 @@ else() endif() add_custom_command( - TARGET ${OpenBLAS_LIBNAME} PRE_LINK + OUTPUT ${PROJECT_BINARY_DIR}/openblas.def + #TARGET ${OpenBLAS_LIBNAME} PRE_LINK COMMAND perl ARGS "${PROJECT_SOURCE_DIR}/exports/gensymbol" "win2k" "${ARCH_IN}" "dummy" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" "${SYMBOLPREFIX}" "${SYMBOLSUFFIX}" > "${PROJECT_BINARY_DIR}/openblas.def" COMMENT "Create openblas.def file" From b03d50b7944259e38af324bed466d842618348af Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:16:00 +0530 Subject: [PATCH 06/18] Test clang in appveyor.yml --- appveyor.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c9d8e47ac9..837e812927 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,9 +12,6 @@ clone_folder: c:\projects\OpenBLAS init: - git config --global core.autocrlf input -build: - project: OpenBLAS.sln - clone_depth: 5 #branches to build @@ -27,16 +24,30 @@ branches: skip_tags: true matrix: - fast_finish: true + fast_finish: false skip_commits: # Add [av skip] to commit messages message: /\[av skip\]/ +environment: + matrix: + - COMPILER: cl + - COMPILER: clang-cl + +install: + - if [%COMPILER%]==[clang-cl] call C:\Miniconda36-x64\Scripts\activate.bat + - if [%COMPILER%]==[clang-cl] conda config --add channels conda-forge --force + - if [%COMPILER%]==[clang-cl] conda install clangdev ninja cmake + before_build: - echo Running cmake... - cd c:\projects\OpenBLAS - - cmake -G "Visual Studio 12 Win64" . + - if [%COMPILER%]==[cl] cmake -G "Visual Studio 12 Win64" . + - if [%COMPILER%]==[clang-cl] cmake -G "Ninja" -DCMAKE_CXX_COMPILER_ID=clang-cl -DCMAKE_C_COMPILER_ID=clang-cl . + +build: + - cmake --build . test_script: - echo Running Test From c56d4881f9e14a0a7a25f9c70f5bfd5732ab5752 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:37:48 +0530 Subject: [PATCH 07/18] Fix appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 837e812927..8394d3bac7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,7 +46,7 @@ before_build: - if [%COMPILER%]==[cl] cmake -G "Visual Studio 12 Win64" . - if [%COMPILER%]==[clang-cl] cmake -G "Ninja" -DCMAKE_CXX_COMPILER_ID=clang-cl -DCMAKE_C_COMPILER_ID=clang-cl . -build: +build_script: - cmake --build . test_script: From ff17e3eb9f4e79e661c5bad2180e2d4c65ecfa2d Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:47:15 +0530 Subject: [PATCH 08/18] build clang-cl first --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8394d3bac7..5022d179e6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,8 +32,8 @@ skip_commits: environment: matrix: - - COMPILER: cl - COMPILER: clang-cl + - COMPILER: cl install: - if [%COMPILER%]==[clang-cl] call C:\Miniconda36-x64\Scripts\activate.bat From 7a4ebf825bae6f994f064c37805356a01d62e87f Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:48:49 +0530 Subject: [PATCH 09/18] add --yes to conda in appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5022d179e6..d6f175763a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -38,7 +38,7 @@ environment: install: - if [%COMPILER%]==[clang-cl] call C:\Miniconda36-x64\Scripts\activate.bat - if [%COMPILER%]==[clang-cl] conda config --add channels conda-forge --force - - if [%COMPILER%]==[clang-cl] conda install clangdev ninja cmake + - if [%COMPILER%]==[clang-cl] conda install --yes clangdev ninja cmake before_build: - echo Running cmake... From 1169f489a4246da9492322c37680f4b0672fdf64 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:54:32 +0530 Subject: [PATCH 10/18] Fix CMAKE_C_COMPILER in appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d6f175763a..7a1a17a7a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,7 +44,7 @@ before_build: - echo Running cmake... - cd c:\projects\OpenBLAS - if [%COMPILER%]==[cl] cmake -G "Visual Studio 12 Win64" . - - if [%COMPILER%]==[clang-cl] cmake -G "Ninja" -DCMAKE_CXX_COMPILER_ID=clang-cl -DCMAKE_C_COMPILER_ID=clang-cl . + - if [%COMPILER%]==[clang-cl] cmake -G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl . build_script: - cmake --build . From a36e9764918d635f36ee51e7472174fbf6219115 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 21:58:53 +0530 Subject: [PATCH 11/18] vsvarsall in appveyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 7a1a17a7a7..d8b9a04b08 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,6 +39,7 @@ install: - if [%COMPILER%]==[clang-cl] call C:\Miniconda36-x64\Scripts\activate.bat - if [%COMPILER%]==[clang-cl] conda config --add channels conda-forge --force - if [%COMPILER%]==[clang-cl] conda install --yes clangdev ninja cmake + - if [%COMPILER%]==[clang-cl] "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 before_build: - echo Running cmake... From 7345795e64b4875cc187821d62cd230b1a0ad23b Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 22:16:53 +0530 Subject: [PATCH 12/18] Try adding RC to path --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index d8b9a04b08..1aa8e391d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,6 +40,7 @@ install: - if [%COMPILER%]==[clang-cl] conda config --add channels conda-forge --force - if [%COMPILER%]==[clang-cl] conda install --yes clangdev ninja cmake - if [%COMPILER%]==[clang-cl] "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 + - if [%COMPILER%]==[clang-cl] set "PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\bin\x64" before_build: - echo Running cmake... From 5e0f67c666a48243b02dfe9c58e31c70c5d1ae6f Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 23:30:15 +0530 Subject: [PATCH 13/18] Make ARCH variable a CACHE variable --- cmake/c_check.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/c_check.cmake b/cmake/c_check.cmake index a0784f09c1..776850e117 100644 --- a/cmake/c_check.cmake +++ b/cmake/c_check.cmake @@ -61,7 +61,8 @@ endif () # CMAKE_HOST_SYSTEM_PROCESSOR - The name of the CPU CMake is running on. # # TODO: CMAKE_SYSTEM_PROCESSOR doesn't seem to be correct - instead get it from the compiler a la c_check -set(ARCH ${CMAKE_SYSTEM_PROCESSOR}) +set(ARCH ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "Target Architecture") + if (${ARCH} STREQUAL "AMD64") set(ARCH "x86_64") endif () From 02c1f860551f18f2efaf874e59fd7be4ecaa4d38 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 23:42:38 +0530 Subject: [PATCH 14/18] Fix copying libopenblas.dll --- utest/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index bd31ed9c67..46c46c5ff6 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -35,7 +35,7 @@ endforeach() if (MSVC) add_custom_command(TARGET ${OpenBLAS_utest_bin} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/lib/$/${OpenBLAS_LIBNAME}.dll ${CMAKE_CURRENT_BINARY_DIR}/. + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}/${OpenBLAS_LIBNAME}.dll ${CMAKE_CURRENT_BINARY_DIR}/. ) endif() From 1a02a087a18297fc5f1bffd3d0911b9cf8ffa790 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 29 Jul 2017 23:42:56 +0530 Subject: [PATCH 15/18] Fix vcvarsall call in appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1aa8e391d2..5ae6c44c01 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,7 +39,7 @@ install: - if [%COMPILER%]==[clang-cl] call C:\Miniconda36-x64\Scripts\activate.bat - if [%COMPILER%]==[clang-cl] conda config --add channels conda-forge --force - if [%COMPILER%]==[clang-cl] conda install --yes clangdev ninja cmake - - if [%COMPILER%]==[clang-cl] "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 + - if [%COMPILER%]==[clang-cl] call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - if [%COMPILER%]==[clang-cl] set "PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\bin\x64" before_build: From f00bbb9dbf6df423c183bc63aa078e501a5281e3 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sun, 30 Jul 2017 00:00:37 +0530 Subject: [PATCH 16/18] Remove unnecessary line in appveyor --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5ae6c44c01..cebd3aec61 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,7 +40,6 @@ install: - if [%COMPILER%]==[clang-cl] conda config --add channels conda-forge --force - if [%COMPILER%]==[clang-cl] conda install --yes clangdev ninja cmake - if [%COMPILER%]==[clang-cl] call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - - if [%COMPILER%]==[clang-cl] set "PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\bin\x64" before_build: - echo Running cmake... From ca32b66a1c682bd227fd28380fe65768a751c127 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 4 Aug 2017 07:57:20 +0530 Subject: [PATCH 17/18] New utest for clang --- utest/CMakeLists.txt | 10 +++++--- utest/utest_main2.c | 61 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 utest/utest_main2.c diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index d51125bc15..a7f3871c30 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -1,10 +1,14 @@ include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_BINARY_DIR}) -set(OpenBLAS_utest_src - utest_main.c - test_amax.c +if (MSVC AND "${CMAKE_C_COMPILER_ID}" MATCHES Clang) + set(OpenBLAS_utest_src utest_main2.c) +else () + set(OpenBLAS_utest_src + utest_main.c + test_amax.c ) +endif () if (NOT NO_LAPACK) set(OpenBLAS_utest_src diff --git a/utest/utest_main2.c b/utest/utest_main2.c new file mode 100644 index 0000000000..565872b161 --- /dev/null +++ b/utest/utest_main2.c @@ -0,0 +1,61 @@ +/***************************************************************************** +Copyright (c) 2011-2016, The OpenBLAS Project +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +**********************************************************************************/ + +#include + +#define CTEST_MAIN +#define CTEST_SEGFAULT +#define CTEST_ADD_TESTS_MANUALLY + +#include "openblas_utest.h" + +CTEST(amax, samax){ + blasint N=3, inc=1; + float te_max=0.0, tr_max=0.0; + float x[]={-1.1, 2.2, -3.3}; + te_max=BLASFUNC(samax)(&N, x, &inc); + tr_max=3.3; + + ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS); +} + +int main(int argc, const char ** argv){ + + CTEST_ADD(amax, samax); + int num_fail=0; + + num_fail=ctest_main(argc, argv); + + return num_fail; +} + From 7abbe40980d7f03a35645565443f53aa416b16fa Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 4 Aug 2017 08:04:16 +0530 Subject: [PATCH 18/18] Build all branches so that appveyor works in forks --- appveyor.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cebd3aec61..087b22665c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,13 +14,6 @@ init: clone_depth: 5 -#branches to build -branches: - only: - - master - - develop - - cmake - skip_tags: true matrix: