Skip to content

Commit dddf0df

Browse files
committed
Numerical issue: back to old version
1 parent 3917ee6 commit dddf0df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/preconditioner.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ limitations under the License.
2222
#include <cuda_runtime.h>
2323
#include <cublas_v2.h>
2424

25-
#define SCALING_EPSILON 1e-8
25+
#define SCALING_EPSILON 1e-12
2626

2727
__global__ void scale_variables_kernel(double *__restrict__ objective_vector,
2828
double *__restrict__ variable_lower_bound,
@@ -425,7 +425,7 @@ __global__ void clamp_sqrt_and_accum_kernel(double *__restrict__ scaling_factors
425425
for (int t = blockIdx.x * blockDim.x + threadIdx.x; t < num_variables; t += blockDim.x * gridDim.x)
426426
{
427427
double v = scaling_factors[t];
428-
double s = sqrt(fmax(v, SCALING_EPSILON));
428+
double s = (v < SCALING_EPSILON) ? 1.0 : sqrt(v);
429429
cumulative_rescaling[t] *= s;
430430
scaling_factors[t] = s;
431431
inverse_scaling_factors[t] = 1.0 / s;

0 commit comments

Comments
 (0)