!15043 fix sponge r1.2

From: @jiahongqian
Reviewed-by: @wang_zi_dong,@ljl0711
Signed-off-by: @ljl0711
This commit is contained in:
mindspore-ci-bot 2021-04-13 14:38:27 +08:00 committed by Gitee
commit 7138acaec0
48 changed files with 24 additions and 55 deletions

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(AngleAtomEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
AngleAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(AngleEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
AngleEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(AngleForce,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
AngleForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -30,6 +30,5 @@ MS_REG_GPU_KERNEL_TWO(AngleForceWithAtomEnergy,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
AngleForceWithAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,6 +28,5 @@ MS_REG_GPU_KERNEL_TWO(BondAtomEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
BondAtomEnergyCudaGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,6 +28,5 @@ MS_REG_GPU_KERNEL_TWO(BondEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
BondEnergyCudaGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,6 +28,5 @@ MS_REG_GPU_KERNEL_TWO(BondForce,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
BondForceCudaGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(BondForceWithAtomEnergy,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
BondForceWithAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(BondForceWithAtomVirial,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
BondForceWithAtomVirialGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -22,6 +22,5 @@ MS_REG_GPU_KERNEL_TWO(
CrdToUintCrd,
KernelAttr().AddInputAttr(kNumberTypeFloat32).AddInputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeUInt32),
CrdToUintCrdGpuKernel, float, unsigned int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class CrdToUintCrdGpuKernel : public GpuKernel {
public:

View File

@ -22,6 +22,5 @@ MS_REG_GPU_KERNEL_TWO(
GetCenterOfGeometry,
KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeFloat32),
GetCenterOfGeometryGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class GetCenterOfGeometryGpuKernel : public GpuKernel {
public:

View File

@ -26,6 +26,5 @@ MS_REG_GPU_KERNEL_TWO(MDTemperature,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
MDTemperatureGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class MDTemperatureGpuKernel : public GpuKernel {
public:

View File

@ -22,6 +22,5 @@ MS_REG_GPU_KERNEL_TWO(
TransferCrd,
KernelAttr().AddInputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeFloat32),
TransferGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -33,6 +33,5 @@ MS_REG_GPU_KERNEL_TWO(DihedralAtomEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
DihedralAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -33,6 +33,5 @@ MS_REG_GPU_KERNEL_TWO(DihedralEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
DihedralEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -33,6 +33,5 @@ MS_REG_GPU_KERNEL_TWO(DihedralForce,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
DihedralForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -34,6 +34,5 @@ MS_REG_GPU_KERNEL_TWO(DihedralForceWithAtomEnergy,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
DihedralForceWithAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(LJEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
LJEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(LJForce,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
LJForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(LJForceWithPMEDirectForce,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
LJForceWithPMEDirectForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14CFAtomEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14CFAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14CFAtomEnergyGpuKernel : public GpuKernel {
public:

View File

@ -29,6 +29,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14CFEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14CFEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14CFEnergyGpuKernel : public GpuKernel {
public:

View File

@ -31,6 +31,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14LJAtomEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14LJAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14LJAtomEnergyGpuKernel : public GpuKernel {
public:

View File

@ -33,6 +33,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14LJCFForceWithAtomEnergy,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14LJCFForceWithAtomEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14LJCFForceWithAtomEnergyGpuKernel : public GpuKernel {
public:

View File

@ -31,6 +31,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14LJEnergy,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14LJEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14LJEnergyGpuKernel : public GpuKernel {
public:

View File

@ -31,6 +31,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14LJForce,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14LJForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14LJForceGpuKernel : public GpuKernel {
public:

View File

@ -32,6 +32,5 @@ MS_REG_GPU_KERNEL_TWO(Dihedral14LJForceWithDirectCF,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
Dihedral14LJForceWithDirectCFGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T, typename T1>
class Dihedral14LJForceWithDirectCFGpuKernel : public GpuKernel {
public:

View File

@ -41,6 +41,5 @@ MS_REG_GPU_KERNEL_TWO(NeighborListUpdate,
.AddInputAttr(kNumberTypeInt32)
.AddOutputAttr(kNumberTypeFloat32),
NeighborListUpdateGpuKernel, int, float)
} // namespace kernel
} // namespace mindspore

View File

@ -27,6 +27,5 @@ MS_REG_GPU_KERNEL_ONE(MDIterationLeapFrog,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
MDIterationLeapFrogGpuKernel, float)
} // namespace kernel
} // namespace mindspore

View File

@ -28,7 +28,6 @@
namespace mindspore {
namespace kernel {
template <typename T>
class MDIterationLeapFrogGpuKernel : public GpuKernel {
public:

View File

@ -30,6 +30,5 @@ MS_REG_GPU_KERNEL_TWO(MDIterationLeapFrogLiujian,
.AddInputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
MDIterationLeapFrogLiujianCudaGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -20,6 +20,5 @@ namespace mindspore {
namespace kernel {
MS_REG_GPU_KERNEL_TWO(MDIterationSetupRandState, KernelAttr().AddOutputAttr(kNumberTypeFloat32),
MDIterationSetupRandStateGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -32,6 +32,5 @@ MS_REG_GPU_KERNEL_TWO(PMEEnergy,
.AddOutputAttr(kNumberTypeFloat32)
.AddOutputAttr(kNumberTypeFloat32),
PMEEnergyGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -42,10 +42,7 @@ class PMEEnergyGpuKernel : public GpuKernel {
float box_length_0 = static_cast<float>(GetAttr<float_t>(kernel_node, "box_length_0"));
float box_length_1 = static_cast<float>(GetAttr<float_t>(kernel_node, "box_length_1"));
float box_length_2 = static_cast<float>(GetAttr<float_t>(kernel_node, "box_length_2"));
std::vector<float> h_box_length(3);
h_box_length[0] = box_length_0;
h_box_length[1] = box_length_1;
h_box_length[2] = box_length_2;
std::vector<float> h_box_length{box_length_0, box_length_1, box_length_2};
VECTOR *box_length = reinterpret_cast<VECTOR *>(h_box_length.data());
cufftPlan3d(&PME_plan_r2c, fftx, ffty, fftz, CUFFT_R2C);
cufftPlan3d(&PME_plan_c2r, fftx, ffty, fftz, CUFFT_C2R);
@ -191,6 +188,7 @@ class PMEEnergyGpuKernel : public GpuKernel {
res.y *= t;
return res;
}
float M_(float u, int n) {
if (n == 2) {
if (u > 2 || u < 0) return 0;
@ -199,6 +197,7 @@ class PMEEnergyGpuKernel : public GpuKernel {
return u / (n - 1) * M_(u, n - 1) + (n - u) / (n - 1) * M_(u - 1, n - 1);
}
}
float getb(int k, int NFFT, int B_order) {
cufftComplex tempc, tempc2, res;
float tempf;
@ -211,7 +210,12 @@ class PMEEnergyGpuKernel : public GpuKernel {
for (int kk = 0; kk < (B_order - 1); kk++) {
tempc.x = 0;
tempc.y = 2 * PI * k / NFFT * kk;
if (NFFT == 0) {
MS_LOG(ERROR) << "Divide by zero.";
break;
} else {
tempc.y = 2 * PI * k / NFFT * kk;
}
tempc = expc(tempc);
tempf = M_(kk + 1, B_order);
tempc2.x += tempf * tempc.x;

View File

@ -27,6 +27,5 @@ MS_REG_GPU_KERNEL_TWO(PMEExcludedForce,
.AddInputAttr(kNumberTypeInt32)
.AddOutputAttr(kNumberTypeFloat32),
PMEExcludedForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -21,6 +21,5 @@ MS_REG_GPU_KERNEL_TWO(
PMEReciprocalForce,
KernelAttr().AddInputAttr(kNumberTypeUInt32).AddInputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeFloat32),
PMEReciprocalForceGpuKernel, float, int)
} // namespace kernel
} // namespace mindspore

View File

@ -46,10 +46,7 @@ class PMEReciprocalForceGpuKernel : public GpuKernel {
float box_length_0 = static_cast<float>(GetAttr<float_t>(kernel_node, "box_length_0"));
float box_length_1 = static_cast<float>(GetAttr<float_t>(kernel_node, "box_length_1"));
float box_length_2 = static_cast<float>(GetAttr<float_t>(kernel_node, "box_length_2"));
std::vector<float> h_box_length(3);
h_box_length[0] = box_length_0;
h_box_length[1] = box_length_1;
h_box_length[2] = box_length_2;
std::vector<float> h_box_length{box_length_0, box_length_1, box_length_2};
VECTOR *box_length = reinterpret_cast<VECTOR *>(h_box_length.data());
PME_inverse_box_vector.x = static_cast<float>(fftx) / box_length[0].x;
PME_inverse_box_vector.y = static_cast<float>(ffty) / box_length[0].y;
@ -170,6 +167,7 @@ class PMEReciprocalForceGpuKernel : public GpuKernel {
res.y *= t;
return res;
}
float M_(float u, int n) {
if (n == 2) {
if (u > 2 || u < 0) return 0;
@ -178,6 +176,7 @@ class PMEReciprocalForceGpuKernel : public GpuKernel {
return u / (n - 1) * M_(u, n - 1) + (n - u) / (n - 1) * M_(u - 1, n - 1);
}
}
float getb(int k, int NFFT, int B_order) {
cufftComplex tempc, tempc2, res;
float tempf;
@ -190,7 +189,12 @@ class PMEReciprocalForceGpuKernel : public GpuKernel {
for (int kk = 0; kk < (B_order - 1); kk++) {
tempc.x = 0;
tempc.y = 2 * PI * k / NFFT * kk;
if (NFFT == 0) {
MS_LOG(ERROR) << "Divide by zero.";
break;
} else {
tempc.y = 2 * PI * k / NFFT * kk;
}
tempc = expc(tempc);
tempf = M_(kk + 1, B_order);
tempc2.x += tempf * tempc.x;

View File

@ -1833,6 +1833,9 @@ class PMEReciprocalForce(PrimitiveWithInfer):
validator.check_value_type('fftx', fftx, (int), self.name)
validator.check_value_type('ffty', ffty, (int), self.name)
validator.check_value_type('fftz', fftz, (int), self.name)
validator.check_value_type('box_length_0', box_length_0, (float), self.name)
validator.check_value_type('box_length_1', box_length_1, (float), self.name)
validator.check_value_type('box_length_2', box_length_2, (float), self.name)
self.atom_numbers = atom_numbers
self.beta = beta
self.fftx = fftx
@ -2002,6 +2005,9 @@ class PMEEnergy(PrimitiveWithInfer):
validator.check_value_type('fftx', fftx, (int), self.name)
validator.check_value_type('ffty', ffty, (int), self.name)
validator.check_value_type('fftz', fftz, (int), self.name)
validator.check_value_type('box_length_0', box_length_0, (float), self.name)
validator.check_value_type('box_length_1', box_length_1, (float), self.name)
validator.check_value_type('box_length_2', box_length_2, (float), self.name)
self.atom_numbers = atom_numbers
self.excluded_numbers = excluded_numbers
self.beta = beta