diff --git a/include/openvml_kernel.h b/include/openvml_kernel.h index 578cb8a..14f50ab 100644 --- a/include/openvml_kernel.h +++ b/include/openvml_kernel.h @@ -47,4 +47,10 @@ void OpenVML_FUNCNAME(dpow_k)(VMLLONG n, double * a, double * b, double * y, dou void OpenVML_FUNCNAME(cpow_k)(VMLLONG n, float * a, float * b, float * y, float * z, float * other_params); void OpenVML_FUNCNAME(zpow_k)(VMLLONG n, double * a, double * b, double * y, double * z, double * other_params); + +void OpenVML_FUNCNAME(sexp_k)(VMLLONG n, float * a, float * b, float * y, float * z, float * other_params); +void OpenVML_FUNCNAME(dexp_k)(VMLLONG n, double * a, double * b, double * y, double * z, double * other_params); +void OpenVML_FUNCNAME(cexp_k)(VMLLONG n, float * a, float * b, float * y, float * z, float * other_params); +void OpenVML_FUNCNAME(zexp_k)(VMLLONG n, double * a, double * b, double * y, double * z, double * other_params); + #endif \ No newline at end of file diff --git a/include/openvml_macros.h b/include/openvml_macros.h index e63129b..9f38e68 100644 --- a/include/openvml_macros.h +++ b/include/openvml_macros.h @@ -48,25 +48,34 @@ #define CPOW_K OpenVML_FUNCNAME(cpow_k) #define ZPOW_K OpenVML_FUNCNAME(zpow_k) +#define SEXP_K OpenVML_FUNCNAME(sexp_k) +#define DEXP_K OpenVML_FUNCNAME(dexp_k) +#define CEXP_K OpenVML_FUNCNAME(cexp_k) +#define ZEXP_K OpenVML_FUNCNAME(zexp_k) + #ifndef COMPLEX #ifndef DOUBLE #define ADD_K SADD_K #define SUB_K SSUB_K #define POW_K SPOW_K +#define EXP_K SEXP_K #else #define ADD_K DADD_K #define SUB_K DSUB_K #define POW_K DPOW_K +#define EXP_K DEXP_K #endif #else #ifndef DOUBLE #define ADD_K CADD_K #define SUB_K CSUB_K #define POW_K CPOW_K +#define EXP_K CEXP_K #else #define ADD_K ZADD_K #define SUB_K ZSUB_K #define POW_K ZPOW_K +#define EXP_K ZEXP_K #endif #endif diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 86ce51e..701766a 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -5,7 +5,7 @@ set(OpenVML_LIBSRC_D "") set(OpenVML_LIBSRC_C "") set(OpenVML_LIBSRC_Z "") -set(REAL_INTERFACE_LIST add sub pow) +set(REAL_INTERFACE_LIST add sub pow exp) set(COMPLEX_INTERFACE_LIST add sub) function(cap_string var_name var_name_cap) diff --git a/interface/exp.c b/interface/exp.c new file mode 100644 index 0000000..f421fce --- /dev/null +++ b/interface/exp.c @@ -0,0 +1,39 @@ +/* * Copyright (c) 2014, 2015 Zhang Xianyi + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * 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. + * + * 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 HOLDER 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 +#include +#include + + +void CNAME(VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { + + if (n<=0) return; + if (a==NULL || y==NULL) return; + + + EXEC_VML(0, EXP_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); + +} diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index c975d94..cc49eda 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -6,7 +6,7 @@ set(OpenVML_LIBSRC_D "") set(OpenVML_LIBSRC_C "") set(OpenVML_LIBSRC_Z "") -set(KERNEL_LIST add sub pow) #s,d +set(KERNEL_LIST add sub pow exp) #s,d set(Z_KERNEL_LIST add sub) #c,z ######## s,d kernels diff --git a/kernel/generic/Kernel_generic.txt b/kernel/generic/Kernel_generic.txt index c996185..a1a546e 100644 --- a/kernel/generic/Kernel_generic.txt +++ b/kernel/generic/Kernel_generic.txt @@ -10,5 +10,9 @@ set(sub_Z_KERNEL_SOURCE ${OpenVML_ARCH}/sub_kernel.c) set(pow_S_KERNEL_SOURCE ${OpenVML_ARCH}/pow_kernel.c) set(pow_D_KERNEL_SOURCE ${OpenVML_ARCH}/pow_kernel.c) -#set(sub_C_KERNEL_SOURCE ${OpenVML_ARCH}/pow_kernel.c) -#set(sub_Z_KERNEL_SOURCE ${OpenVML_ARCH}/pow_kernel.c) +#set(pow_C_KERNEL_SOURCE ${OpenVML_ARCH}/pow_kernel.c) +#set(pow_Z_KERNEL_SOURCE ${OpenVML_ARCH}/pow_kernel.c) + +set(exp_S_KERNEL_SOURCE ${OpenVML_ARCH}/exp_kernel.c) +set(exp_D_KERNEL_SOURCE ${OpenVML_ARCH}/exp_kernel.c) + diff --git a/kernel/generic/exp_kernel.c b/kernel/generic/exp_kernel.c new file mode 100644 index 0000000..f5e5cf1 --- /dev/null +++ b/kernel/generic/exp_kernel.c @@ -0,0 +1,40 @@ +/* * Copyright (c) 2014, 2015 Zhang Xianyi + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * 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. + * + * 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 HOLDER 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 +#include "openvml_kernel.h" + +#ifndef DOUBLE +#define EXP expf +#else +#define EXP exp +#endif + +void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { + VMLLONG i=0; + for(i=0; i