Merge pull request #1256 from isuruf/develop
Support compiling with clang on windows
This commit is contained in:
commit
1296c89688
29
appveyor.yml
29
appveyor.yml
|
@ -12,31 +12,36 @@ clone_folder: c:\projects\OpenBLAS
|
||||||
init:
|
init:
|
||||||
- git config --global core.autocrlf input
|
- git config --global core.autocrlf input
|
||||||
|
|
||||||
build:
|
|
||||||
project: OpenBLAS.sln
|
|
||||||
|
|
||||||
clone_depth: 5
|
clone_depth: 5
|
||||||
|
|
||||||
#branches to build
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- cmake
|
|
||||||
|
|
||||||
skip_tags: true
|
skip_tags: true
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: false
|
||||||
|
|
||||||
skip_commits:
|
skip_commits:
|
||||||
# Add [av skip] to commit messages
|
# Add [av skip] to commit messages
|
||||||
message: /\[av skip\]/
|
message: /\[av skip\]/
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- COMPILER: clang-cl
|
||||||
|
- COMPILER: 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 --yes clangdev ninja cmake
|
||||||
|
- if [%COMPILER%]==[clang-cl] call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
- echo Running cmake...
|
- echo Running cmake...
|
||||||
- cd c:\projects\OpenBLAS
|
- 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=clang-cl -DCMAKE_C_COMPILER=clang-cl .
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- cmake --build .
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- echo Running Test
|
- echo Running Test
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
set(FU "")
|
set(FU "")
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(FU "_")
|
set(FU "_")
|
||||||
|
elseif(MSVC AND ${CMAKE_C_COMPILER_ID} MATCHES "Clang")
|
||||||
|
set(FU "")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
set(FU "_")
|
set(FU "_")
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
|
@ -59,7 +61,8 @@ endif ()
|
||||||
# CMAKE_HOST_SYSTEM_PROCESSOR - The name of the CPU CMake is running on.
|
# 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
|
# 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")
|
if (${ARCH} STREQUAL "AMD64")
|
||||||
set(ARCH "x86_64")
|
set(ARCH "x86_64")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -51,7 +51,8 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${OpenBLAS_LIBNAME} PRE_LINK
|
OUTPUT ${PROJECT_BINARY_DIR}/openblas.def
|
||||||
|
#TARGET ${OpenBLAS_LIBNAME} PRE_LINK
|
||||||
COMMAND perl
|
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"
|
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"
|
COMMENT "Create openblas.def file"
|
||||||
|
|
|
@ -64,15 +64,14 @@ set(GETARCH_SRC
|
||||||
${CPUIDEMO}
|
${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)
|
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
#Use generic for MSVC now
|
|
||||||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
||||||
# disable WindowsStore strict CRT checks
|
# disable WindowsStore strict CRT checks
|
||||||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -D_CRT_SECURE_NO_WARNINGS)
|
set(GETARCH_FLAGS ${GETARCH_FLAGS} -D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
|
52
common.h
52
common.h
|
@ -495,6 +495,33 @@ static void __inline blas_lock(volatile BLASULONG *address){
|
||||||
#define MMAP_POLICY (MAP_PRIVATE | MAP_ANONYMOUS)
|
#define MMAP_POLICY (MAP_PRIVATE | MAP_ANONYMOUS)
|
||||||
#endif
|
#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). */
|
||||||
|
#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 <complex.h>
|
||||||
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "common_param.h"
|
#include "common_param.h"
|
||||||
|
|
||||||
|
@ -524,31 +551,6 @@ static void __inline blas_lock(volatile BLASULONG *address){
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif // NOINCLUDE
|
#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 <complex.h>
|
|
||||||
#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
|
#ifdef XDOUBLE
|
||||||
#define OPENBLAS_COMPLEX_FLOAT openblas_complex_xdouble
|
#define OPENBLAS_COMPLEX_FLOAT openblas_complex_xdouble
|
||||||
#define OPENBLAS_MAKE_COMPLEX_FLOAT(r,i) openblas_make_complex_xdouble(r,i)
|
#define OPENBLAS_MAKE_COMPLEX_FLOAT(r,i) openblas_make_complex_xdouble(r,i)
|
||||||
|
|
|
@ -333,8 +333,8 @@ BLASLONG (*icamin_k)(BLASLONG, float *, BLASLONG);
|
||||||
float (*cnrm2_k) (BLASLONG, float *, BLASLONG);
|
float (*cnrm2_k) (BLASLONG, float *, BLASLONG);
|
||||||
float (*casum_k) (BLASLONG, float *, BLASLONG);
|
float (*casum_k) (BLASLONG, float *, BLASLONG);
|
||||||
int (*ccopy_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG);
|
int (*ccopy_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG);
|
||||||
float _Complex (*cdotu_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG);
|
openblas_complex_float (*cdotu_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG);
|
||||||
float _Complex (*cdotc_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 (*csrot_k) (BLASLONG, float *, BLASLONG, float *, BLASLONG, float, float);
|
||||||
|
|
||||||
int (*caxpy_k) (BLASLONG, BLASLONG, BLASLONG, float, float, float *, BLASLONG, float *, BLASLONG, float *, BLASLONG);
|
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 (*znrm2_k) (BLASLONG, double *, BLASLONG);
|
||||||
double (*zasum_k) (BLASLONG, double *, BLASLONG);
|
double (*zasum_k) (BLASLONG, double *, BLASLONG);
|
||||||
int (*zcopy_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG);
|
int (*zcopy_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG);
|
||||||
double _Complex (*zdotu_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG);
|
openblas_complex_double (*zdotu_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG);
|
||||||
double _Complex (*zdotc_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 (*zdrot_k) (BLASLONG, double *, BLASLONG, double *, BLASLONG, double, double);
|
||||||
|
|
||||||
int (*zaxpy_k) (BLASLONG, BLASLONG, BLASLONG, double, double, double *, BLASLONG, double *, BLASLONG, double *, BLASLONG);
|
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 (*xnrm2_k) (BLASLONG, xdouble *, BLASLONG);
|
||||||
xdouble (*xasum_k) (BLASLONG, xdouble *, BLASLONG);
|
xdouble (*xasum_k) (BLASLONG, xdouble *, BLASLONG);
|
||||||
int (*xcopy_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG);
|
int (*xcopy_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG);
|
||||||
xdouble _Complex (*xdotu_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG);
|
openblas_complex_xdouble (*xdotu_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG);
|
||||||
xdouble _Complex (*xdotc_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 (*xqrot_k) (BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG, xdouble, xdouble);
|
||||||
|
|
||||||
int (*xaxpy_k) (BLASLONG, BLASLONG, BLASLONG, xdouble, xdouble, xdouble *, BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG);
|
int (*xaxpy_k) (BLASLONG, BLASLONG, BLASLONG, xdouble, xdouble, xdouble *, BLASLONG, xdouble *, BLASLONG, xdouble *, BLASLONG);
|
||||||
|
|
|
@ -23,7 +23,7 @@ ParseMakefileVars("${KERNELDIR}/KERNEL")
|
||||||
ParseMakefileVars("${KERNELDIR}/KERNEL.${TARGET_CORE}")
|
ParseMakefileVars("${KERNELDIR}/KERNEL.${TARGET_CORE}")
|
||||||
|
|
||||||
if (${ARCH} STREQUAL "x86")
|
if (${ARCH} STREQUAL "x86")
|
||||||
if (NOT MSVC)
|
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
GenerateNamedObjects("${KERNELDIR}/cpuid.S" "" "" false "" "" true)
|
GenerateNamedObjects("${KERNELDIR}/cpuid.S" "" "" false "" "" true)
|
||||||
else()
|
else()
|
||||||
GenerateNamedObjects("${KERNELDIR}/cpuid_win.c" "" "" false "" "" true)
|
GenerateNamedObjects("${KERNELDIR}/cpuid_win.c" "" "" false "" "" true)
|
||||||
|
|
|
@ -91,16 +91,15 @@ static void cdot_kernel_16(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *d)
|
||||||
|
|
||||||
#endif
|
#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 i;
|
||||||
BLASLONG ix,iy;
|
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 } ;
|
FLOAT dot[8] = { 0.0, 0.0, 0.0 , 0.0, 0.0, 0.0, 0.0, 0.0 } ;
|
||||||
|
|
||||||
if ( n <= 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);
|
return(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,11 +159,11 @@ FLOAT _Complex CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG in
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CONJ)
|
#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];
|
// CREAL(result) = dot[0] - dot[1];
|
||||||
// CIMAG(result) = dot[4] + dot[5];
|
// CIMAG(result) = dot[4] + dot[5];
|
||||||
#else
|
#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];
|
// CREAL(result) = dot[0] + dot[1];
|
||||||
// CIMAG(result) = dot[4] - dot[5];
|
// CIMAG(result) = dot[4] - dot[5];
|
||||||
|
|
||||||
|
|
|
@ -86,18 +86,17 @@ static void zdot_kernel_8(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *d)
|
||||||
|
|
||||||
#endif
|
#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 i;
|
||||||
BLASLONG ix,iy;
|
BLASLONG ix,iy;
|
||||||
FLOAT _Complex result;
|
|
||||||
FLOAT dot[4] = { 0.0, 0.0, 0.0 , 0.0 } ;
|
FLOAT dot[4] = { 0.0, 0.0, 0.0 , 0.0 } ;
|
||||||
|
|
||||||
if ( n <= 0 )
|
if ( n <= 0 )
|
||||||
{
|
{
|
||||||
// CREAL(result) = 0.0 ;
|
// CREAL(result) = 0.0 ;
|
||||||
// CIMAG(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);
|
return(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -151,11 +150,11 @@ FLOAT _Complex CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG in
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CONJ)
|
#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];
|
// CREAL(result) = dot[0] - dot[1];
|
||||||
// CIMAG(result) = dot[2] + dot[3];
|
// CIMAG(result) = dot[2] + dot[3];
|
||||||
#else
|
#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];
|
// CREAL(result) = dot[0] + dot[1];
|
||||||
// CIMAG(result) = dot[2] - dot[3];
|
// CIMAG(result) = dot[2] - dot[3];
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ typedef int blasint;
|
||||||
extension since version 3.0. If neither are available, use a compatible
|
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). */
|
structure as fallback (see Clause 6.2.5.13 of the C99 standard). */
|
||||||
#if ((defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \
|
#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
|
#define OPENBLAS_COMPLEX_C99
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
include_directories(${PROJECT_SOURCE_DIR})
|
include_directories(${PROJECT_SOURCE_DIR})
|
||||||
include_directories(${PROJECT_BINARY_DIR})
|
include_directories(${PROJECT_BINARY_DIR})
|
||||||
|
|
||||||
set(OpenBLAS_utest_src
|
if (MSVC AND "${CMAKE_C_COMPILER_ID}" MATCHES Clang)
|
||||||
utest_main.c
|
set(OpenBLAS_utest_src utest_main2.c)
|
||||||
test_amax.c
|
else ()
|
||||||
|
set(OpenBLAS_utest_src
|
||||||
|
utest_main.c
|
||||||
|
test_amax.c
|
||||||
)
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (NOT NO_LAPACK)
|
if (NOT NO_LAPACK)
|
||||||
set(OpenBLAS_utest_src
|
set(OpenBLAS_utest_src
|
||||||
|
@ -36,7 +40,7 @@ endforeach()
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
add_custom_command(TARGET ${OpenBLAS_utest_bin}
|
add_custom_command(TARGET ${OpenBLAS_utest_bin}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/lib/$<CONFIG>/${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()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -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 <stdio.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue