mirror of
https://github.com/CNugteren/CLBlast.git
synced 2024-08-21 20:42:28 +02:00
Fixed an issue where the xNRM2 and xASUM testers would incorrectly report failures for complex inputs
This commit is contained in:
parent
25a25dbd6f
commit
eaf1de5745
|
@ -266,6 +266,7 @@ def wrapper_cblas(routines):
|
||||||
# Special case for scalar outputs
|
# Special case for scalar outputs
|
||||||
assignment = ""
|
assignment = ""
|
||||||
postfix = ""
|
postfix = ""
|
||||||
|
endofline = ""
|
||||||
extra_argument = ""
|
extra_argument = ""
|
||||||
for output_buffer in routine.outputs:
|
for output_buffer in routine.outputs:
|
||||||
if output_buffer in routine.ScalarBuffersFirst():
|
if output_buffer in routine.ScalarBuffersFirst():
|
||||||
|
@ -274,12 +275,17 @@ def wrapper_cblas(routines):
|
||||||
indent += " "
|
indent += " "
|
||||||
extra_argument += ",\n"+indent+"reinterpret_cast<return_pointer_"+flavour.buffertype[:-1]+">(&"+output_buffer+"_buffer["+output_buffer+"_offset])"
|
extra_argument += ",\n"+indent+"reinterpret_cast<return_pointer_"+flavour.buffertype[:-1]+">(&"+output_buffer+"_buffer["+output_buffer+"_offset])"
|
||||||
else:
|
else:
|
||||||
assignment = output_buffer+"_buffer["+output_buffer+"_offset] = "
|
assignment = output_buffer+"_buffer["+output_buffer+"_offset]"
|
||||||
|
if (flavour.name in ["Sc","Dz"]):
|
||||||
|
assignment = assignment+".real("
|
||||||
|
endofline += ")"
|
||||||
|
else:
|
||||||
|
assignment = assignment+" = "
|
||||||
indent += " "*len(assignment)
|
indent += " "*len(assignment)
|
||||||
|
|
||||||
result += " "+assignment+"cblas_"+flavour.name.lower()+routine.name+postfix+"("
|
result += " "+assignment+"cblas_"+flavour.name.lower()+routine.name+postfix+"("
|
||||||
result += (",\n"+indent).join([a for a in arguments])
|
result += (",\n"+indent).join([a for a in arguments])
|
||||||
result += extra_argument+");"
|
result += extra_argument+endofline+");"
|
||||||
result += "\n}\n"
|
result += "\n}\n"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -338,14 +338,14 @@ void cblasXnrm2(const size_t n,
|
||||||
void cblasXnrm2(const size_t n,
|
void cblasXnrm2(const size_t n,
|
||||||
std::vector<float2>& nrm2_buffer, const size_t nrm2_offset,
|
std::vector<float2>& nrm2_buffer, const size_t nrm2_offset,
|
||||||
const std::vector<float2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
const std::vector<float2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
||||||
nrm2_buffer[nrm2_offset] = cblas_scnrm2(n,
|
nrm2_buffer[nrm2_offset].real(cblas_scnrm2(n,
|
||||||
reinterpret_cast<const float*>(&x_buffer[x_offset]), static_cast<int>(x_inc));
|
reinterpret_cast<const float*>(&x_buffer[x_offset]), static_cast<int>(x_inc)));
|
||||||
}
|
}
|
||||||
void cblasXnrm2(const size_t n,
|
void cblasXnrm2(const size_t n,
|
||||||
std::vector<double2>& nrm2_buffer, const size_t nrm2_offset,
|
std::vector<double2>& nrm2_buffer, const size_t nrm2_offset,
|
||||||
const std::vector<double2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
const std::vector<double2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
||||||
nrm2_buffer[nrm2_offset] = cblas_dznrm2(n,
|
nrm2_buffer[nrm2_offset].real(cblas_dznrm2(n,
|
||||||
reinterpret_cast<const double*>(&x_buffer[x_offset]), static_cast<int>(x_inc));
|
reinterpret_cast<const double*>(&x_buffer[x_offset]), static_cast<int>(x_inc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forwards the Netlib BLAS calls for SASUM/DASUM/ScASUM/DzASUM
|
// Forwards the Netlib BLAS calls for SASUM/DASUM/ScASUM/DzASUM
|
||||||
|
@ -364,14 +364,14 @@ void cblasXasum(const size_t n,
|
||||||
void cblasXasum(const size_t n,
|
void cblasXasum(const size_t n,
|
||||||
std::vector<float2>& asum_buffer, const size_t asum_offset,
|
std::vector<float2>& asum_buffer, const size_t asum_offset,
|
||||||
const std::vector<float2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
const std::vector<float2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
||||||
asum_buffer[asum_offset] = cblas_scasum(n,
|
asum_buffer[asum_offset].real(cblas_scasum(n,
|
||||||
reinterpret_cast<const float*>(&x_buffer[x_offset]), static_cast<int>(x_inc));
|
reinterpret_cast<const float*>(&x_buffer[x_offset]), static_cast<int>(x_inc)));
|
||||||
}
|
}
|
||||||
void cblasXasum(const size_t n,
|
void cblasXasum(const size_t n,
|
||||||
std::vector<double2>& asum_buffer, const size_t asum_offset,
|
std::vector<double2>& asum_buffer, const size_t asum_offset,
|
||||||
const std::vector<double2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
const std::vector<double2>& x_buffer, const size_t x_offset, const size_t x_inc) {
|
||||||
asum_buffer[asum_offset] = cblas_dzasum(n,
|
asum_buffer[asum_offset].real(cblas_dzasum(n,
|
||||||
reinterpret_cast<const double*>(&x_buffer[x_offset]), static_cast<int>(x_inc));
|
reinterpret_cast<const double*>(&x_buffer[x_offset]), static_cast<int>(x_inc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forwards the Netlib BLAS calls for iSAMAX/iDAMAX/iCAMAX/iZAMAX
|
// Forwards the Netlib BLAS calls for iSAMAX/iDAMAX/iCAMAX/iZAMAX
|
||||||
|
|
Loading…
Reference in a new issue