From 435badcb0edf3f1e02323a5718e31739a8d093e5 Mon Sep 17 00:00:00 2001 From: lthakur Date: Wed, 7 Aug 2019 15:54:46 +0530 Subject: [PATCH 1/2] Fixed compilation errors being observed on windows --- .../deviceLib/hipDoublePrecisionMathHost.cpp | 300 +++++++++--------- .../deviceLib/hipSinglePrecisionMathHost.cpp | 296 ++++++++--------- 2 files changed, 310 insertions(+), 286 deletions(-) mode change 100644 => 100755 tests/src/deviceLib/hipDoublePrecisionMathHost.cpp mode change 100644 => 100755 tests/src/deviceLib/hipSinglePrecisionMathHost.cpp diff --git a/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp b/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp old mode 100644 new mode 100755 index a3283622ff..643b300f2f --- a/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp +++ b/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp @@ -1,142 +1,158 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/* HIT_START - * BUILD: %t %s ../test_common.cpp - * TEST: %t - * HIT_END - */ - -#include -//#include -#include "test_common.h" -#include - -#pragma GCC diagnostic ignored "-Wall" -#pragma clang diagnostic ignored "-Wunused-variable" - -__host__ void double_precision_math_functions() { - int iX; - double fX, fY; - - acos(1.0); - acosh(1.0); - asin(0.0); - asinh(0.0); - atan(0.0); - atan2(0.0, 1.0); - atanh(0.0); - cbrt(0.0); - ceil(0.0); - copysign(1.0, -2.0); - cos(0.0); - cosh(0.0); - // cospi(0.0); - // cyl_bessel_i0(0.0); - // cyl_bessel_i1(0.0); - erf(0.0); - erfc(0.0); - // erfcinv(2.0); - // erfcx(0.0); - // erfinv(1.0); - exp(0.0); - exp10(0.0); - exp2(0.0); - expm1(0.0); - fabs(1.0); - fdim(1.0, 0.0); - floor(0.0); - fma(1.0, 2.0, 3.0); - fmax(0.0, 0.0); - fmin(0.0, 0.0); - fmod(0.0, 1.0); - frexp(0.0, &iX); - hypot(1.0, 0.0); - ilogb(1.0); - std::isfinite(0.0); - std::isinf(0.0); - std::isnan(0.0); - j0(0.0); - j1(0.0); - jn(-1.0, 1.0); - ldexp(0.0, 0); - // lgamma(1.0); - llrint(0.0); - llround(0.0); - log(1.0); - log10(1.0); - log1p(-1.0); - log2(1.0); - logb(1.0); - lrint(0.0); - lround(0.0); - modf(0.0, &fX); - nan("1"); - nearbyint(0.0); - // nextafter(0.0); - fX = 1.0; // norm(1, &fX); -#if defined(__HIP_PLATFORM_HCC__) - // norm3d(1.0, 0.0, 0.0); - // norm4d(1.0, 0.0, 0.0, 0.0); -#endif - // normcdf(0.0); - // normcdfinv(1.0); - pow(1.0, 0.0); - // rcbrt(1.0); - - remainder(2.0, 1.0); - remquo(1.0, 2.0, &iX); -#if defined(__HIP_PLATFORM_HCC__) - // rhypot(0.0, 1.0); -#endif - rint(1.0); -#if defined(__HIP_PLATFORM_HCC__) - fX = 1.0; // rnorm(1, &fX); - // rnorm3d(0.0, 0.0, 1.0); - // rnorm4d(0.0, 0.0, 0.0, 1.0); -#endif - round(0.0); - // rsqrt(1.0); - scalbln(0.0, 1); - scalbn(0.0, 1); - std::signbit(1.0); - sin(0.0); - sincos(0.0, &fX, &fY); - // sincospi(0.0, &fX, &fY); - sinh(0.0); - // sinpi(0.0); - sqrt(0.0); - tan(0.0); - tanh(0.0); - tgamma(2.0); - trunc(0.0); - y0(1.0); - y1(1.0); - yn(1, 1.0); -} - -static void compileOnHost() { double_precision_math_functions(); } - -int main() { - compileOnHost(); - passed(); -} +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* HIT_START + * BUILD: %t %s ../test_common.cpp + * TEST: %t + * HIT_END + */ + +#include +//#include +#include "test_common.h" +#include + +#pragma GCC diagnostic ignored "-Wall" +#pragma clang diagnostic ignored "-Wunused-variable" + +__host__ void double_precision_math_functions() { + int iX; + double fX, fY; + + acos(1.0); + acosh(1.0); + asin(0.0); + asinh(0.0); + atan(0.0); + atan2(0.0, 1.0); + atanh(0.0); + cbrt(0.0); + ceil(0.0); + copysign(1.0, -2.0); + cos(0.0); + cosh(0.0); + // cospi(0.0); + // cyl_bessel_i0(0.0); + // cyl_bessel_i1(0.0); + erf(0.0); + erfc(0.0); + // erfcinv(2.0); + // erfcx(0.0); + // erfinv(1.0); + exp(0.0); + #ifdef __unix__ + exp10(0.0); + #endif + exp2(0.0); + expm1(0.0); + fabs(1.0); + fdim(1.0, 0.0); + floor(0.0); + fma(1.0, 2.0, 3.0); + fmax(0.0, 0.0); + fmin(0.0, 0.0); + fmod(0.0, 1.0); + frexp(0.0, &iX); + hypot(1.0, 0.0); + ilogb(1.0); + std::isfinite(0.0); + std::isinf(0.0); + std::isnan(0.0); + #ifdef __unix__ + j0(1.0); + j1(1.0); + jn(-1.0, 1.0); + #elif _WIN64 + _j0(0.0); + _j1(0.0); + _jn(-1.0, 1.0); + #endif + ldexp(0.0, 0); + // lgamma(1.0); + llrint(0.0); + llround(0.0); + log(1.0); + log10(1.0); + log1p(-1.0); + log2(1.0); + logb(1.0); + lrint(0.0); + lround(0.0); + modf(0.0, &fX); + nan("1"); + nearbyint(0.0); + // nextafter(0.0); + fX = 1.0; // norm(1, &fX); +#if defined(__HIP_PLATFORM_HCC__) + // norm3d(1.0, 0.0, 0.0); + // norm4d(1.0, 0.0, 0.0, 0.0); +#endif + // normcdf(0.0); + // normcdfinv(1.0); + pow(1.0, 0.0); + // rcbrt(1.0); + + remainder(2.0, 1.0); + remquo(1.0, 2.0, &iX); +#if defined(__HIP_PLATFORM_HCC__) + // rhypot(0.0, 1.0); +#endif + rint(1.0); +#if defined(__HIP_PLATFORM_HCC__) + fX = 1.0; // rnorm(1, &fX); + // rnorm3d(0.0, 0.0, 1.0); + // rnorm4d(0.0, 0.0, 0.0, 1.0); +#endif + round(0.0); + // rsqrt(1.0); + scalbln(0.0, 1); + scalbn(0.0, 1); + std::signbit(1.0); + sin(0.0); + #ifdef __unix__ + sincos(0.0, &fX, &fY); + #endif + // sincospi(0.0, &fX, &fY); + sinh(0.0); + // sinpi(0.0); + sqrt(0.0); + tan(0.0); + tanh(0.0); + tgamma(2.0); + trunc(0.0); + #ifdef __unix__ + y0(1.0); + y1(1.0); + yn(1, 1.0); + #elif _WIN64 + _y0(1.0); + _y1(1.0); + _yn(1, 1.0); + #endif +} + +static void compileOnHost() { double_precision_math_functions(); } + +int main() { + compileOnHost(); + passed(); +} diff --git a/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp b/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp old mode 100644 new mode 100755 index 1dd5737f86..cd827bc318 --- a/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp +++ b/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp @@ -1,144 +1,152 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/* HIT_START - * BUILD: %t %s ../test_common.cpp - * TEST: %t - * HIT_END - */ - -#include -//#include -#include "test_common.h" -#include - -#pragma GCC diagnostic ignored "-Wall" -#pragma clang diagnostic ignored "-Wunused-variable" - -__host__ void single_precision_math_functions() { - int iX; - float fX, fY; - - acosf(1.0f); - acoshf(1.0f); - asinf(0.0f); - asinhf(0.0f); - atan2f(0.0f, 1.0f); - atanf(0.0f); - atanhf(0.0f); - cbrtf(0.0f); - ceilf(0.0f); - copysignf(1.0f, -2.0f); - cosf(0.0f); - coshf(0.0f); - // cospif(0.0f); - // cyl_bessel_i0f(0.0f); - // cyl_bessel_i1f(0.0f); - erfcf(0.0f); - // erfcinvf(2.0f); - // erfcxf(0.0f); - erff(0.0f); - // erfinvf(1.0f); - exp10f(0.0f); - exp2f(0.0f); - expf(0.0f); - expm1f(0.0f); - fabsf(1.0f); - fdimf(1.0f, 0.0f); -#if defined(__HIP_PLATFORM_HCC__) - // fdividef(0.0f, 1.0f); -#endif - floorf(0.0f); - fmaf(1.0f, 2.0f, 3.0f); - fmaxf(0.0f, 0.0f); - fminf(0.0f, 0.0f); - fmodf(0.0f, 1.0f); - frexpf(0.0f, &iX); - hypotf(1.0f, 0.0f); - ilogbf(1.0f); - std::isfinite(0.0f); - std::isinf(0.0f); - std::isnan(0.0f); - j0f(0.0f); - j1f(0.0f); - jnf(-1.0f, 1.0f); - ldexpf(0.0f, 0); - lgammaf(1.0f); - llrintf(0.0f); - llroundf(0.0f); - log10f(1.0f); - log1pf(-1.0f); - log2f(1.0f); - logbf(1.0f); - logf(1.0f); - lrintf(0.0f); - lroundf(0.0f); - modff(0.0f, &fX); - nanf("1"); - nearbyintf(0.0f); - // nextafterf(0.0f); -#if defined(__HIP_PLATFORM_HCC__) - // norm3df(1.0f, 0.0f, 0.0f); - // norm4df(1.0f, 0.0f, 0.0f, 0.0f); -#endif - // normcdff(0.0f); - // normcdfinvf(1.0f); - // fX = 1.0f; normf(1, &fX); - powf(1.0f, 0.0f); - // rcbrtf(1.0f); - remainderf(2.0f, 1.0f); - remquof(1.0f, 2.0f, &iX); -#if defined(__HIP_PLATFORM_HCC__) - // rhypotf(0.0f, 1.0f); -#endif - rintf(1.0f); -#if defined(__HIP_PLATFORM_HCC__) - // rnorm3df(0.0f, 0.0f, 1.0f); - // rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); - fX = 1.0f; // rnormf(1, &fX); -#endif - roundf(0.0f); - /// rsqrtf(1.0f); - scalblnf(0.0f, 1); - scalbnf(0.0f, 1); - std::signbit(1.0f); - sincosf(0.0f, &fX, &fY); - // sincospif(0.0f, &fX, &fY); - sinf(0.0f); - sinhf(0.0f); - // sinpif(0.0f); - sqrtf(0.0f); - tanf(0.0f); - tanhf(0.0f); - tgammaf(2.0f); - truncf(0.0f); - y0f(1.0f); - y1f(1.0f); - ynf(1, 1.0f); -} - -static void compileOnHost() { single_precision_math_functions(); } - -int main() { - compileOnHost(); - passed(); -} +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* HIT_START + * BUILD: %t %s ../test_common.cpp + * TEST: %t + * HIT_END + */ + +#include +//#include +#include "test_common.h" +#include + +#pragma GCC diagnostic ignored "-Wall" +#pragma clang diagnostic ignored "-Wunused-variable" + +__host__ void single_precision_math_functions() { + int iX; + float fX, fY; + + acosf(1.0f); + acoshf(1.0f); + asinf(0.0f); + asinhf(0.0f); + atan2f(0.0f, 1.0f); + atanf(0.0f); + atanhf(0.0f); + cbrtf(0.0f); + ceilf(0.0f); + copysignf(1.0f, -2.0f); + cosf(0.0f); + coshf(0.0f); + // cospif(0.0f); + // cyl_bessel_i0f(0.0f); + // cyl_bessel_i1f(0.0f); + erfcf(0.0f); + // erfcinvf(2.0f); + // erfcxf(0.0f); + erff(0.0f); + // erfinvf(1.0f); + #ifdef __unix__ + exp10f(0.0f); + #endif + exp2f(0.0f); + expf(0.0f); + expm1f(0.0f); + fabsf(1.0f); + fdimf(1.0f, 0.0f); +#if defined(__HIP_PLATFORM_HCC__) + // fdividef(0.0f, 1.0f); +#endif + floorf(0.0f); + fmaf(1.0f, 2.0f, 3.0f); + fmaxf(0.0f, 0.0f); + fminf(0.0f, 0.0f); + fmodf(0.0f, 1.0f); + frexpf(0.0f, &iX); + hypotf(1.0f, 0.0f); + ilogbf(1.0f); + std::isfinite(0.0f); + std::isinf(0.0f); + std::isnan(0.0f); + #ifdef __unix__ + j0f(0.0f); + j1f(0.0f); + jnf(-1.0f, 1.0f); + #endif + ldexpf(0.0f, 0); + lgammaf(1.0f); + llrintf(0.0f); + llroundf(0.0f); + log10f(1.0f); + log1pf(-1.0f); + log2f(1.0f); + logbf(1.0f); + logf(1.0f); + lrintf(0.0f); + lroundf(0.0f); + modff(0.0f, &fX); + nanf("1"); + nearbyintf(0.0f); + // nextafterf(0.0f); +#if defined(__HIP_PLATFORM_HCC__) + // norm3df(1.0f, 0.0f, 0.0f); + // norm4df(1.0f, 0.0f, 0.0f, 0.0f); +#endif + // normcdff(0.0f); + // normcdfinvf(1.0f); + // fX = 1.0f; normf(1, &fX); + powf(1.0f, 0.0f); + // rcbrtf(1.0f); + remainderf(2.0f, 1.0f); + remquof(1.0f, 2.0f, &iX); +#if defined(__HIP_PLATFORM_HCC__) + // rhypotf(0.0f, 1.0f); +#endif + rintf(1.0f); +#if defined(__HIP_PLATFORM_HCC__) + // rnorm3df(0.0f, 0.0f, 1.0f); + // rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); + fX = 1.0f; // rnormf(1, &fX); +#endif + roundf(0.0f); + /// rsqrtf(1.0f); + scalblnf(0.0f, 1); + scalbnf(0.0f, 1); + std::signbit(1.0f); + #ifdef __unix__ + sincosf(0.0f, &fX, &fY); + #endif + // sincospif(0.0f, &fX, &fY); + sinf(0.0f); + sinhf(0.0f); + // sinpif(0.0f); + sqrtf(0.0f); + tanf(0.0f); + tanhf(0.0f); + tgammaf(2.0f); + truncf(0.0f); + #ifdef __unix__ + y0f(1.0f); + y1f(1.0f); + ynf(1, 1.0f); + #endif +} + +static void compileOnHost() { single_precision_math_functions(); } + +int main() { + compileOnHost(); + passed(); +} From d18160920e51d5f589f4a0b4700525724e78030c Mon Sep 17 00:00:00 2001 From: lthakur Date: Thu, 8 Aug 2019 11:26:26 +0530 Subject: [PATCH 2/2] Resubmitting the fix so as to address the changed format in the last submission --- .../deviceLib/hipDoublePrecisionMathHost.cpp | 316 +++++++++--------- .../deviceLib/hipSinglePrecisionMathHost.cpp | 304 ++++++++--------- 2 files changed, 310 insertions(+), 310 deletions(-) mode change 100755 => 100644 tests/src/deviceLib/hipDoublePrecisionMathHost.cpp mode change 100755 => 100644 tests/src/deviceLib/hipSinglePrecisionMathHost.cpp diff --git a/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp b/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp old mode 100755 new mode 100644 index 643b300f2f..295d2f5c95 --- a/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp +++ b/tests/src/deviceLib/hipDoublePrecisionMathHost.cpp @@ -1,158 +1,158 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/* HIT_START - * BUILD: %t %s ../test_common.cpp - * TEST: %t - * HIT_END - */ - -#include -//#include -#include "test_common.h" -#include - -#pragma GCC diagnostic ignored "-Wall" -#pragma clang diagnostic ignored "-Wunused-variable" - -__host__ void double_precision_math_functions() { - int iX; - double fX, fY; - - acos(1.0); - acosh(1.0); - asin(0.0); - asinh(0.0); - atan(0.0); - atan2(0.0, 1.0); - atanh(0.0); - cbrt(0.0); - ceil(0.0); - copysign(1.0, -2.0); - cos(0.0); - cosh(0.0); - // cospi(0.0); - // cyl_bessel_i0(0.0); - // cyl_bessel_i1(0.0); - erf(0.0); - erfc(0.0); - // erfcinv(2.0); - // erfcx(0.0); - // erfinv(1.0); - exp(0.0); - #ifdef __unix__ - exp10(0.0); - #endif - exp2(0.0); - expm1(0.0); - fabs(1.0); - fdim(1.0, 0.0); - floor(0.0); - fma(1.0, 2.0, 3.0); - fmax(0.0, 0.0); - fmin(0.0, 0.0); - fmod(0.0, 1.0); - frexp(0.0, &iX); - hypot(1.0, 0.0); - ilogb(1.0); - std::isfinite(0.0); - std::isinf(0.0); - std::isnan(0.0); - #ifdef __unix__ - j0(1.0); - j1(1.0); - jn(-1.0, 1.0); - #elif _WIN64 - _j0(0.0); - _j1(0.0); - _jn(-1.0, 1.0); - #endif - ldexp(0.0, 0); - // lgamma(1.0); - llrint(0.0); - llround(0.0); - log(1.0); - log10(1.0); - log1p(-1.0); - log2(1.0); - logb(1.0); - lrint(0.0); - lround(0.0); - modf(0.0, &fX); - nan("1"); - nearbyint(0.0); - // nextafter(0.0); - fX = 1.0; // norm(1, &fX); -#if defined(__HIP_PLATFORM_HCC__) - // norm3d(1.0, 0.0, 0.0); - // norm4d(1.0, 0.0, 0.0, 0.0); -#endif - // normcdf(0.0); - // normcdfinv(1.0); - pow(1.0, 0.0); - // rcbrt(1.0); - - remainder(2.0, 1.0); - remquo(1.0, 2.0, &iX); -#if defined(__HIP_PLATFORM_HCC__) - // rhypot(0.0, 1.0); -#endif - rint(1.0); -#if defined(__HIP_PLATFORM_HCC__) - fX = 1.0; // rnorm(1, &fX); - // rnorm3d(0.0, 0.0, 1.0); - // rnorm4d(0.0, 0.0, 0.0, 1.0); -#endif - round(0.0); - // rsqrt(1.0); - scalbln(0.0, 1); - scalbn(0.0, 1); - std::signbit(1.0); - sin(0.0); - #ifdef __unix__ - sincos(0.0, &fX, &fY); - #endif - // sincospi(0.0, &fX, &fY); - sinh(0.0); - // sinpi(0.0); - sqrt(0.0); - tan(0.0); - tanh(0.0); - tgamma(2.0); - trunc(0.0); - #ifdef __unix__ - y0(1.0); - y1(1.0); - yn(1, 1.0); - #elif _WIN64 - _y0(1.0); - _y1(1.0); - _yn(1, 1.0); - #endif -} - -static void compileOnHost() { double_precision_math_functions(); } - -int main() { - compileOnHost(); - passed(); -} +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* HIT_START + * BUILD: %t %s ../test_common.cpp + * TEST: %t + * HIT_END + */ + +#include +//#include +#include "test_common.h" +#include + +#pragma GCC diagnostic ignored "-Wall" +#pragma clang diagnostic ignored "-Wunused-variable" + +__host__ void double_precision_math_functions() { + int iX; + double fX, fY; + + acos(1.0); + acosh(1.0); + asin(0.0); + asinh(0.0); + atan(0.0); + atan2(0.0, 1.0); + atanh(0.0); + cbrt(0.0); + ceil(0.0); + copysign(1.0, -2.0); + cos(0.0); + cosh(0.0); + // cospi(0.0); + // cyl_bessel_i0(0.0); + // cyl_bessel_i1(0.0); + erf(0.0); + erfc(0.0); + // erfcinv(2.0); + // erfcx(0.0); + // erfinv(1.0); + exp(0.0); + #ifdef __unix__ + exp10(0.0); + #endif + exp2(0.0); + expm1(0.0); + fabs(1.0); + fdim(1.0, 0.0); + floor(0.0); + fma(1.0, 2.0, 3.0); + fmax(0.0, 0.0); + fmin(0.0, 0.0); + fmod(0.0, 1.0); + frexp(0.0, &iX); + hypot(1.0, 0.0); + ilogb(1.0); + std::isfinite(0.0); + std::isinf(0.0); + std::isnan(0.0); + #ifdef __unix__ + j0(0.0); + j1(0.0); + jn(-1.0, 1.0); + #elif _WIN64 + _j0(0.0); + _j1(0.0); + _jn(-1.0, 1.0); + #endif + ldexp(0.0, 0); + // lgamma(1.0); + llrint(0.0); + llround(0.0); + log(1.0); + log10(1.0); + log1p(-1.0); + log2(1.0); + logb(1.0); + lrint(0.0); + lround(0.0); + modf(0.0, &fX); + nan("1"); + nearbyint(0.0); + // nextafter(0.0); + fX = 1.0; // norm(1, &fX); +#if defined(__HIP_PLATFORM_HCC__) + // norm3d(1.0, 0.0, 0.0); + // norm4d(1.0, 0.0, 0.0, 0.0); +#endif + // normcdf(0.0); + // normcdfinv(1.0); + pow(1.0, 0.0); + // rcbrt(1.0); + + remainder(2.0, 1.0); + remquo(1.0, 2.0, &iX); +#if defined(__HIP_PLATFORM_HCC__) + // rhypot(0.0, 1.0); +#endif + rint(1.0); +#if defined(__HIP_PLATFORM_HCC__) + fX = 1.0; // rnorm(1, &fX); + // rnorm3d(0.0, 0.0, 1.0); + // rnorm4d(0.0, 0.0, 0.0, 1.0); +#endif + round(0.0); + // rsqrt(1.0); + scalbln(0.0, 1); + scalbn(0.0, 1); + std::signbit(1.0); + sin(0.0); + #ifdef _unix__ + sincos(0.0, &fX, &fY); + #endif + // sincospi(0.0, &fX, &fY); + sinh(0.0); + // sinpi(0.0); + sqrt(0.0); + tan(0.0); + tanh(0.0); + tgamma(2.0); + trunc(0.0); + #ifdef __unix__ + y0(1.0); + y1(1.0); + yn(1, 1.0); + #elif _WIN64 + _y0(1.0); + _y1(1.0); + _yn(1, 1.0); + #endif +} + +static void compileOnHost() { double_precision_math_functions(); } + +int main() { + compileOnHost(); + passed(); +} diff --git a/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp b/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp old mode 100755 new mode 100644 index cd827bc318..78c2099e8f --- a/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp +++ b/tests/src/deviceLib/hipSinglePrecisionMathHost.cpp @@ -1,152 +1,152 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/* HIT_START - * BUILD: %t %s ../test_common.cpp - * TEST: %t - * HIT_END - */ - -#include -//#include -#include "test_common.h" -#include - -#pragma GCC diagnostic ignored "-Wall" -#pragma clang diagnostic ignored "-Wunused-variable" - -__host__ void single_precision_math_functions() { - int iX; - float fX, fY; - - acosf(1.0f); - acoshf(1.0f); - asinf(0.0f); - asinhf(0.0f); - atan2f(0.0f, 1.0f); - atanf(0.0f); - atanhf(0.0f); - cbrtf(0.0f); - ceilf(0.0f); - copysignf(1.0f, -2.0f); - cosf(0.0f); - coshf(0.0f); - // cospif(0.0f); - // cyl_bessel_i0f(0.0f); - // cyl_bessel_i1f(0.0f); - erfcf(0.0f); - // erfcinvf(2.0f); - // erfcxf(0.0f); - erff(0.0f); - // erfinvf(1.0f); - #ifdef __unix__ - exp10f(0.0f); - #endif - exp2f(0.0f); - expf(0.0f); - expm1f(0.0f); - fabsf(1.0f); - fdimf(1.0f, 0.0f); -#if defined(__HIP_PLATFORM_HCC__) - // fdividef(0.0f, 1.0f); -#endif - floorf(0.0f); - fmaf(1.0f, 2.0f, 3.0f); - fmaxf(0.0f, 0.0f); - fminf(0.0f, 0.0f); - fmodf(0.0f, 1.0f); - frexpf(0.0f, &iX); - hypotf(1.0f, 0.0f); - ilogbf(1.0f); - std::isfinite(0.0f); - std::isinf(0.0f); - std::isnan(0.0f); - #ifdef __unix__ - j0f(0.0f); - j1f(0.0f); - jnf(-1.0f, 1.0f); - #endif - ldexpf(0.0f, 0); - lgammaf(1.0f); - llrintf(0.0f); - llroundf(0.0f); - log10f(1.0f); - log1pf(-1.0f); - log2f(1.0f); - logbf(1.0f); - logf(1.0f); - lrintf(0.0f); - lroundf(0.0f); - modff(0.0f, &fX); - nanf("1"); - nearbyintf(0.0f); - // nextafterf(0.0f); -#if defined(__HIP_PLATFORM_HCC__) - // norm3df(1.0f, 0.0f, 0.0f); - // norm4df(1.0f, 0.0f, 0.0f, 0.0f); -#endif - // normcdff(0.0f); - // normcdfinvf(1.0f); - // fX = 1.0f; normf(1, &fX); - powf(1.0f, 0.0f); - // rcbrtf(1.0f); - remainderf(2.0f, 1.0f); - remquof(1.0f, 2.0f, &iX); -#if defined(__HIP_PLATFORM_HCC__) - // rhypotf(0.0f, 1.0f); -#endif - rintf(1.0f); -#if defined(__HIP_PLATFORM_HCC__) - // rnorm3df(0.0f, 0.0f, 1.0f); - // rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); - fX = 1.0f; // rnormf(1, &fX); -#endif - roundf(0.0f); - /// rsqrtf(1.0f); - scalblnf(0.0f, 1); - scalbnf(0.0f, 1); - std::signbit(1.0f); - #ifdef __unix__ - sincosf(0.0f, &fX, &fY); - #endif - // sincospif(0.0f, &fX, &fY); - sinf(0.0f); - sinhf(0.0f); - // sinpif(0.0f); - sqrtf(0.0f); - tanf(0.0f); - tanhf(0.0f); - tgammaf(2.0f); - truncf(0.0f); - #ifdef __unix__ - y0f(1.0f); - y1f(1.0f); - ynf(1, 1.0f); - #endif -} - -static void compileOnHost() { single_precision_math_functions(); } - -int main() { - compileOnHost(); - passed(); -} +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* HIT_START + * BUILD: %t %s ../test_common.cpp + * TEST: %t + * HIT_END + */ + +#include +//#include +#include "test_common.h" +#include + +#pragma GCC diagnostic ignored "-Wall" +#pragma clang diagnostic ignored "-Wunused-variable" + +__host__ void single_precision_math_functions() { + int iX; + float fX, fY; + + acosf(1.0f); + acoshf(1.0f); + asinf(0.0f); + asinhf(0.0f); + atan2f(0.0f, 1.0f); + atanf(0.0f); + atanhf(0.0f); + cbrtf(0.0f); + ceilf(0.0f); + copysignf(1.0f, -2.0f); + cosf(0.0f); + coshf(0.0f); + // cospif(0.0f); + // cyl_bessel_i0f(0.0f); + // cyl_bessel_i1f(0.0f); + erfcf(0.0f); + // erfcinvf(2.0f); + // erfcxf(0.0f); + erff(0.0f); + // erfinvf(1.0f); + #ifdef __unix__ + exp10f(0.0f); + #endif + exp2f(0.0f); + expf(0.0f); + expm1f(0.0f); + fabsf(1.0f); + fdimf(1.0f, 0.0f); +#if defined(__HIP_PLATFORM_HCC__) + // fdividef(0.0f, 1.0f); +#endif + floorf(0.0f); + fmaf(1.0f, 2.0f, 3.0f); + fmaxf(0.0f, 0.0f); + fminf(0.0f, 0.0f); + fmodf(0.0f, 1.0f); + frexpf(0.0f, &iX); + hypotf(1.0f, 0.0f); + ilogbf(1.0f); + std::isfinite(0.0f); + std::isinf(0.0f); + std::isnan(0.0f); + #ifdef __unix__ + j0f(0.0f); + j1f(0.0f); + jnf(-1.0f, 1.0f); + #endif + ldexpf(0.0f, 0); + lgammaf(1.0f); + llrintf(0.0f); + llroundf(0.0f); + log10f(1.0f); + log1pf(-1.0f); + log2f(1.0f); + logbf(1.0f); + logf(1.0f); + lrintf(0.0f); + lroundf(0.0f); + modff(0.0f, &fX); + nanf("1"); + nearbyintf(0.0f); + // nextafterf(0.0f); +#if defined(__HIP_PLATFORM_HCC__) + // norm3df(1.0f, 0.0f, 0.0f); + // norm4df(1.0f, 0.0f, 0.0f, 0.0f); +#endif + // normcdff(0.0f); + // normcdfinvf(1.0f); + // fX = 1.0f; normf(1, &fX); + powf(1.0f, 0.0f); + // rcbrtf(1.0f); + remainderf(2.0f, 1.0f); + remquof(1.0f, 2.0f, &iX); +#if defined(__HIP_PLATFORM_HCC__) + // rhypotf(0.0f, 1.0f); +#endif + rintf(1.0f); +#if defined(__HIP_PLATFORM_HCC__) + // rnorm3df(0.0f, 0.0f, 1.0f); + // rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); + fX = 1.0f; // rnormf(1, &fX); +#endif + roundf(0.0f); + /// rsqrtf(1.0f); + scalblnf(0.0f, 1); + scalbnf(0.0f, 1); + std::signbit(1.0f); + #ifdef __unix__ + sincosf(0.0f, &fX, &fY); + #endif + // sincospif(0.0f, &fX, &fY); + sinf(0.0f); + sinhf(0.0f); + // sinpif(0.0f); + sqrtf(0.0f); + tanf(0.0f); + tanhf(0.0f); + tgammaf(2.0f); + truncf(0.0f); + #ifdef __unix__ + y0f(1.0f); + y1f(1.0f); + ynf(1, 1.0f); + #endif +} + +static void compileOnHost() { single_precision_math_functions(); } + +int main() { + compileOnHost(); + passed(); +}