From 869a35faef02e7d17d2e3110e3c0b2d58fa06343 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Fri, 7 Jun 2013 14:46:42 +0400 Subject: [PATCH] fixed constructors for functional objects (added __host__ modifier) --- modules/gpuarithm/src/cuda/absdiff_mat.cu | 12 ++++++------ modules/gpuarithm/src/cuda/absdiff_scalar.cu | 2 +- modules/gpuarithm/src/cuda/add_mat.cu | 12 ++++++------ modules/gpuarithm/src/cuda/add_scalar.cu | 2 +- modules/gpuarithm/src/cuda/add_weighted.cu | 4 ++-- modules/gpuarithm/src/cuda/cmp_mat.cu | 16 ++++++++-------- modules/gpuarithm/src/cuda/div_inv.cu | 2 +- modules/gpuarithm/src/cuda/div_mat.cu | 14 +++++++------- modules/gpuarithm/src/cuda/div_scalar.cu | 2 +- modules/gpuarithm/src/cuda/math.cu | 16 ++++++++-------- modules/gpuarithm/src/cuda/minmax_mat.cu | 16 ++++++++-------- modules/gpuarithm/src/cuda/mul_mat.cu | 14 +++++++------- modules/gpuarithm/src/cuda/mul_scalar.cu | 2 +- modules/gpuarithm/src/cuda/reduce.cu | 16 ++++++++-------- modules/gpuarithm/src/cuda/sub_mat.cu | 12 ++++++------ modules/gpuarithm/src/cuda/sub_scalar.cu | 2 +- 16 files changed, 72 insertions(+), 72 deletions(-) diff --git a/modules/gpuarithm/src/cuda/absdiff_mat.cu b/modules/gpuarithm/src/cuda/absdiff_mat.cu index d47cbdc171..d47068ee03 100644 --- a/modules/gpuarithm/src/cuda/absdiff_mat.cu +++ b/modules/gpuarithm/src/cuda/absdiff_mat.cu @@ -62,8 +62,8 @@ namespace arithm return vabsdiff4(a, b); } - __device__ __forceinline__ VAbsDiff4() {} - __device__ __forceinline__ VAbsDiff4(const VAbsDiff4& other) {} + __host__ __device__ __forceinline__ VAbsDiff4() {} + __host__ __device__ __forceinline__ VAbsDiff4(const VAbsDiff4&) {} }; struct VAbsDiff2 : binary_function @@ -73,8 +73,8 @@ namespace arithm return vabsdiff2(a, b); } - __device__ __forceinline__ VAbsDiff2() {} - __device__ __forceinline__ VAbsDiff2(const VAbsDiff2& other) {} + __host__ __device__ __forceinline__ VAbsDiff2() {} + __host__ __device__ __forceinline__ VAbsDiff2(const VAbsDiff2&) {} }; __device__ __forceinline__ int _abs(int a) @@ -97,8 +97,8 @@ namespace arithm return saturate_cast(_abs(a - b)); } - __device__ __forceinline__ AbsDiffMat() {} - __device__ __forceinline__ AbsDiffMat(const AbsDiffMat& other) {} + __host__ __device__ __forceinline__ AbsDiffMat() {} + __host__ __device__ __forceinline__ AbsDiffMat(const AbsDiffMat&) {} }; } diff --git a/modules/gpuarithm/src/cuda/absdiff_scalar.cu b/modules/gpuarithm/src/cuda/absdiff_scalar.cu index e705609b71..5a89791f86 100644 --- a/modules/gpuarithm/src/cuda/absdiff_scalar.cu +++ b/modules/gpuarithm/src/cuda/absdiff_scalar.cu @@ -59,7 +59,7 @@ namespace arithm { S val; - explicit AbsDiffScalar(S val_) : val(val_) {} + __host__ explicit AbsDiffScalar(S val_) : val(val_) {} __device__ __forceinline__ T operator ()(T a) const { diff --git a/modules/gpuarithm/src/cuda/add_mat.cu b/modules/gpuarithm/src/cuda/add_mat.cu index 511e11d0f8..3b1bc1f385 100644 --- a/modules/gpuarithm/src/cuda/add_mat.cu +++ b/modules/gpuarithm/src/cuda/add_mat.cu @@ -62,8 +62,8 @@ namespace arithm return vadd4(a, b); } - __device__ __forceinline__ VAdd4() {} - __device__ __forceinline__ VAdd4(const VAdd4& other) {} + __host__ __device__ __forceinline__ VAdd4() {} + __host__ __device__ __forceinline__ VAdd4(const VAdd4&) {} }; struct VAdd2 : binary_function @@ -73,8 +73,8 @@ namespace arithm return vadd2(a, b); } - __device__ __forceinline__ VAdd2() {} - __device__ __forceinline__ VAdd2(const VAdd2& other) {} + __host__ __device__ __forceinline__ VAdd2() {} + __host__ __device__ __forceinline__ VAdd2(const VAdd2&) {} }; template struct AddMat : binary_function @@ -84,8 +84,8 @@ namespace arithm return saturate_cast(a + b); } - __device__ __forceinline__ AddMat() {} - __device__ __forceinline__ AddMat(const AddMat& other) {} + __host__ __device__ __forceinline__ AddMat() {} + __host__ __device__ __forceinline__ AddMat(const AddMat&) {} }; } diff --git a/modules/gpuarithm/src/cuda/add_scalar.cu b/modules/gpuarithm/src/cuda/add_scalar.cu index 3f43f8d7ad..3362c2b930 100644 --- a/modules/gpuarithm/src/cuda/add_scalar.cu +++ b/modules/gpuarithm/src/cuda/add_scalar.cu @@ -59,7 +59,7 @@ namespace arithm { S val; - explicit AddScalar(S val_) : val(val_) {} + __host__ explicit AddScalar(S val_) : val(val_) {} __device__ __forceinline__ D operator ()(T a) const { diff --git a/modules/gpuarithm/src/cuda/add_weighted.cu b/modules/gpuarithm/src/cuda/add_weighted.cu index 88d8de9513..bf632d68f2 100644 --- a/modules/gpuarithm/src/cuda/add_weighted.cu +++ b/modules/gpuarithm/src/cuda/add_weighted.cu @@ -74,7 +74,7 @@ namespace arithm float beta; float gamma; - AddWeighted_(double alpha_, double beta_, double gamma_) : alpha(static_cast(alpha_)), beta(static_cast(beta_)), gamma(static_cast(gamma_)) {} + __host__ AddWeighted_(double alpha_, double beta_, double gamma_) : alpha(static_cast(alpha_)), beta(static_cast(beta_)), gamma(static_cast(gamma_)) {} __device__ __forceinline__ D operator ()(T1 a, T2 b) const { @@ -87,7 +87,7 @@ namespace arithm double beta; double gamma; - AddWeighted_(double alpha_, double beta_, double gamma_) : alpha(alpha_), beta(beta_), gamma(gamma_) {} + __host__ AddWeighted_(double alpha_, double beta_, double gamma_) : alpha(alpha_), beta(beta_), gamma(gamma_) {} __device__ __forceinline__ D operator ()(T1 a, T2 b) const { diff --git a/modules/gpuarithm/src/cuda/cmp_mat.cu b/modules/gpuarithm/src/cuda/cmp_mat.cu index 9cf9787a94..6602edf62f 100644 --- a/modules/gpuarithm/src/cuda/cmp_mat.cu +++ b/modules/gpuarithm/src/cuda/cmp_mat.cu @@ -62,8 +62,8 @@ namespace arithm return vcmpeq4(a, b); } - __device__ __forceinline__ VCmpEq4() {} - __device__ __forceinline__ VCmpEq4(const VCmpEq4& other) {} + __host__ __device__ __forceinline__ VCmpEq4() {} + __host__ __device__ __forceinline__ VCmpEq4(const VCmpEq4&) {} }; struct VCmpNe4 : binary_function { @@ -72,8 +72,8 @@ namespace arithm return vcmpne4(a, b); } - __device__ __forceinline__ VCmpNe4() {} - __device__ __forceinline__ VCmpNe4(const VCmpNe4& other) {} + __host__ __device__ __forceinline__ VCmpNe4() {} + __host__ __device__ __forceinline__ VCmpNe4(const VCmpNe4&) {} }; struct VCmpLt4 : binary_function { @@ -82,8 +82,8 @@ namespace arithm return vcmplt4(a, b); } - __device__ __forceinline__ VCmpLt4() {} - __device__ __forceinline__ VCmpLt4(const VCmpLt4& other) {} + __host__ __device__ __forceinline__ VCmpLt4() {} + __host__ __device__ __forceinline__ VCmpLt4(const VCmpLt4&) {} }; struct VCmpLe4 : binary_function { @@ -92,8 +92,8 @@ namespace arithm return vcmple4(a, b); } - __device__ __forceinline__ VCmpLe4() {} - __device__ __forceinline__ VCmpLe4(const VCmpLe4& other) {} + __host__ __device__ __forceinline__ VCmpLe4() {} + __host__ __device__ __forceinline__ VCmpLe4(const VCmpLe4&) {} }; template diff --git a/modules/gpuarithm/src/cuda/div_inv.cu b/modules/gpuarithm/src/cuda/div_inv.cu index bda3df30b7..9cfda933c7 100644 --- a/modules/gpuarithm/src/cuda/div_inv.cu +++ b/modules/gpuarithm/src/cuda/div_inv.cu @@ -59,7 +59,7 @@ namespace arithm { S val; - explicit DivInv(S val_) : val(val_) {} + __host__ explicit DivInv(S val_) : val(val_) {} __device__ __forceinline__ D operator ()(T a) const { diff --git a/modules/gpuarithm/src/cuda/div_mat.cu b/modules/gpuarithm/src/cuda/div_mat.cu index 9d50dc7b6a..aab6638900 100644 --- a/modules/gpuarithm/src/cuda/div_mat.cu +++ b/modules/gpuarithm/src/cuda/div_mat.cu @@ -91,8 +91,8 @@ namespace arithm return b != 0 ? saturate_cast(a / b) : 0; } - __device__ __forceinline__ Div() {} - __device__ __forceinline__ Div(const Div& other) {} + __host__ __device__ __forceinline__ Div() {} + __host__ __device__ __forceinline__ Div(const Div&) {} }; template struct Div : binary_function { @@ -101,8 +101,8 @@ namespace arithm return b != 0 ? static_cast(a) / b : 0; } - __device__ __forceinline__ Div() {} - __device__ __forceinline__ Div(const Div& other) {} + __host__ __device__ __forceinline__ Div() {} + __host__ __device__ __forceinline__ Div(const Div&) {} }; template struct Div : binary_function { @@ -111,15 +111,15 @@ namespace arithm return b != 0 ? static_cast(a) / b : 0; } - __device__ __forceinline__ Div() {} - __device__ __forceinline__ Div(const Div& other) {} + __host__ __device__ __forceinline__ Div() {} + __host__ __device__ __forceinline__ Div(const Div&) {} }; template struct DivScale : binary_function { S scale; - explicit DivScale(S scale_) : scale(scale_) {} + __host__ explicit DivScale(S scale_) : scale(scale_) {} __device__ __forceinline__ D operator ()(T a, T b) const { diff --git a/modules/gpuarithm/src/cuda/div_scalar.cu b/modules/gpuarithm/src/cuda/div_scalar.cu index b176cfa2c2..42ba90cb0c 100644 --- a/modules/gpuarithm/src/cuda/div_scalar.cu +++ b/modules/gpuarithm/src/cuda/div_scalar.cu @@ -59,7 +59,7 @@ namespace arithm { S val; - explicit DivScalar(S val_) : val(val_) {} + __host__ explicit DivScalar(S val_) : val(val_) {} __device__ __forceinline__ D operator ()(T a) const { diff --git a/modules/gpuarithm/src/cuda/math.cu b/modules/gpuarithm/src/cuda/math.cu index 86be98ea0e..1f2e7b8a14 100644 --- a/modules/gpuarithm/src/cuda/math.cu +++ b/modules/gpuarithm/src/cuda/math.cu @@ -94,8 +94,8 @@ namespace arithm return saturate_cast(x * x); } - __device__ __forceinline__ Sqr() {} - __device__ __forceinline__ Sqr(const Sqr& other) {} + __host__ __device__ __forceinline__ Sqr() {} + __host__ __device__ __forceinline__ Sqr(const Sqr&) {} }; } @@ -190,8 +190,8 @@ namespace arithm return saturate_cast(f(x)); } - __device__ __forceinline__ Exp() {} - __device__ __forceinline__ Exp(const Exp& other) {} + __host__ __device__ __forceinline__ Exp() {} + __host__ __device__ __forceinline__ Exp(const Exp&) {} }; } @@ -228,7 +228,7 @@ namespace arithm { float power; - PowOp(double power_) : power(static_cast(power_)) {} + __host__ explicit PowOp(double power_) : power(static_cast(power_)) {} __device__ __forceinline__ T operator()(T e) const { @@ -239,7 +239,7 @@ namespace arithm { float power; - PowOp(double power_) : power(static_cast(power_)) {} + __host__ explicit PowOp(double power_) : power(static_cast(power_)) {} __device__ __forceinline__ T operator()(T e) const { @@ -255,7 +255,7 @@ namespace arithm { float power; - PowOp(double power_) : power(static_cast(power_)) {} + __host__ explicit PowOp(double power_) : power(static_cast(power_)) {} __device__ __forceinline__ float operator()(float e) const { @@ -266,7 +266,7 @@ namespace arithm { double power; - PowOp(double power_) : power(power_) {} + __host__ explicit PowOp(double power_) : power(power_) {} __device__ __forceinline__ double operator()(double e) const { diff --git a/modules/gpuarithm/src/cuda/minmax_mat.cu b/modules/gpuarithm/src/cuda/minmax_mat.cu index 6e9c247223..0bf5a468d9 100644 --- a/modules/gpuarithm/src/cuda/minmax_mat.cu +++ b/modules/gpuarithm/src/cuda/minmax_mat.cu @@ -65,8 +65,8 @@ namespace arithm return vmin4(a, b); } - __device__ __forceinline__ VMin4() {} - __device__ __forceinline__ VMin4(const VMin4& other) {} + __host__ __device__ __forceinline__ VMin4() {} + __host__ __device__ __forceinline__ VMin4(const VMin4&) {} }; struct VMin2 : binary_function @@ -76,8 +76,8 @@ namespace arithm return vmin2(a, b); } - __device__ __forceinline__ VMin2() {} - __device__ __forceinline__ VMin2(const VMin2& other) {} + __host__ __device__ __forceinline__ VMin2() {} + __host__ __device__ __forceinline__ VMin2(const VMin2&) {} }; } @@ -151,8 +151,8 @@ namespace arithm return vmax4(a, b); } - __device__ __forceinline__ VMax4() {} - __device__ __forceinline__ VMax4(const VMax4& other) {} + __host__ __device__ __forceinline__ VMax4() {} + __host__ __device__ __forceinline__ VMax4(const VMax4&) {} }; struct VMax2 : binary_function @@ -162,8 +162,8 @@ namespace arithm return vmax2(a, b); } - __device__ __forceinline__ VMax2() {} - __device__ __forceinline__ VMax2(const VMax2& other) {} + __host__ __device__ __forceinline__ VMax2() {} + __host__ __device__ __forceinline__ VMax2(const VMax2&) {} }; } diff --git a/modules/gpuarithm/src/cuda/mul_mat.cu b/modules/gpuarithm/src/cuda/mul_mat.cu index cde44ba563..25bc8a5970 100644 --- a/modules/gpuarithm/src/cuda/mul_mat.cu +++ b/modules/gpuarithm/src/cuda/mul_mat.cu @@ -69,8 +69,8 @@ namespace arithm return res; } - __device__ __forceinline__ Mul_8uc4_32f() {} - __device__ __forceinline__ Mul_8uc4_32f(const Mul_8uc4_32f& other) {} + __host__ __device__ __forceinline__ Mul_8uc4_32f() {} + __host__ __device__ __forceinline__ Mul_8uc4_32f(const Mul_8uc4_32f&) {} }; struct Mul_16sc4_32f : binary_function @@ -81,8 +81,8 @@ namespace arithm saturate_cast(a.z * b), saturate_cast(a.w * b)); } - __device__ __forceinline__ Mul_16sc4_32f() {} - __device__ __forceinline__ Mul_16sc4_32f(const Mul_16sc4_32f& other) {} + __host__ __device__ __forceinline__ Mul_16sc4_32f() {} + __host__ __device__ __forceinline__ Mul_16sc4_32f(const Mul_16sc4_32f&) {} }; template struct Mul : binary_function @@ -92,15 +92,15 @@ namespace arithm return saturate_cast(a * b); } - __device__ __forceinline__ Mul() {} - __device__ __forceinline__ Mul(const Mul& other) {} + __host__ __device__ __forceinline__ Mul() {} + __host__ __device__ __forceinline__ Mul(const Mul&) {} }; template struct MulScale : binary_function { S scale; - explicit MulScale(S scale_) : scale(scale_) {} + __host__ explicit MulScale(S scale_) : scale(scale_) {} __device__ __forceinline__ D operator ()(T a, T b) const { diff --git a/modules/gpuarithm/src/cuda/mul_scalar.cu b/modules/gpuarithm/src/cuda/mul_scalar.cu index 208bfc6228..6546550275 100644 --- a/modules/gpuarithm/src/cuda/mul_scalar.cu +++ b/modules/gpuarithm/src/cuda/mul_scalar.cu @@ -59,7 +59,7 @@ namespace arithm { S val; - explicit MulScalar(S val_) : val(val_) {} + __host__ explicit MulScalar(S val_) : val(val_) {} __device__ __forceinline__ D operator ()(T a) const { diff --git a/modules/gpuarithm/src/cuda/reduce.cu b/modules/gpuarithm/src/cuda/reduce.cu index f2056b97be..e43db901d8 100644 --- a/modules/gpuarithm/src/cuda/reduce.cu +++ b/modules/gpuarithm/src/cuda/reduce.cu @@ -76,8 +76,8 @@ namespace reduce return r; } - __device__ __forceinline__ Sum() {} - __device__ __forceinline__ Sum(const Sum&) {} + __host__ __device__ __forceinline__ Sum() {} + __host__ __device__ __forceinline__ Sum(const Sum&) {} }; struct Avg @@ -100,8 +100,8 @@ namespace reduce return r / sz; } - __device__ __forceinline__ Avg() {} - __device__ __forceinline__ Avg(const Avg&) {} + __host__ __device__ __forceinline__ Avg() {} + __host__ __device__ __forceinline__ Avg(const Avg&) {} }; struct Min @@ -125,8 +125,8 @@ namespace reduce return r; } - __device__ __forceinline__ Min() {} - __device__ __forceinline__ Min(const Min&) {} + __host__ __device__ __forceinline__ Min() {} + __host__ __device__ __forceinline__ Min(const Min&) {} }; struct Max @@ -150,8 +150,8 @@ namespace reduce return r; } - __device__ __forceinline__ Max() {} - __device__ __forceinline__ Max(const Max&) {} + __host__ __device__ __forceinline__ Max() {} + __host__ __device__ __forceinline__ Max(const Max&) {} }; /////////////////////////////////////////////////////////// diff --git a/modules/gpuarithm/src/cuda/sub_mat.cu b/modules/gpuarithm/src/cuda/sub_mat.cu index adbdb2f501..077eafb356 100644 --- a/modules/gpuarithm/src/cuda/sub_mat.cu +++ b/modules/gpuarithm/src/cuda/sub_mat.cu @@ -62,8 +62,8 @@ namespace arithm return vsub4(a, b); } - __device__ __forceinline__ VSub4() {} - __device__ __forceinline__ VSub4(const VSub4& other) {} + __host__ __device__ __forceinline__ VSub4() {} + __host__ __device__ __forceinline__ VSub4(const VSub4&) {} }; struct VSub2 : binary_function @@ -73,8 +73,8 @@ namespace arithm return vsub2(a, b); } - __device__ __forceinline__ VSub2() {} - __device__ __forceinline__ VSub2(const VSub2& other) {} + __host__ __device__ __forceinline__ VSub2() {} + __host__ __device__ __forceinline__ VSub2(const VSub2&) {} }; template struct SubMat : binary_function @@ -84,8 +84,8 @@ namespace arithm return saturate_cast(a - b); } - __device__ __forceinline__ SubMat() {} - __device__ __forceinline__ SubMat(const SubMat& other) {} + __host__ __device__ __forceinline__ SubMat() {} + __host__ __device__ __forceinline__ SubMat(const SubMat&) {} }; } diff --git a/modules/gpuarithm/src/cuda/sub_scalar.cu b/modules/gpuarithm/src/cuda/sub_scalar.cu index ed1c96e002..05c0cc703b 100644 --- a/modules/gpuarithm/src/cuda/sub_scalar.cu +++ b/modules/gpuarithm/src/cuda/sub_scalar.cu @@ -59,7 +59,7 @@ namespace arithm { S val; - explicit SubScalar(S val_) : val(val_) {} + __host__ explicit SubScalar(S val_) : val(val_) {} __device__ __forceinline__ D operator ()(T a) const {