Skip to content

Commit db1bc5c

Browse files
committed
Fix for jacobi_iterative
1 parent 0823bae commit db1bc5c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

DirectProgramming/C++SYCL/DenseLinearAlgebra/guided_jacobi_iterative_gpu_optimization/src/1_guided_jacobi_iterative_solver_cpu.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ void GenerateMatrix(std::vector<float> &input_matrix,
4848

4949
for (int j = i * kSize; j < kSize * (i + 1); ++j) {
5050
input_matrix[j] = distr(engine);
51-
input_matrix[j] = round(100. * input_matrix[j]) / 100.;
52-
sum += fabs(input_matrix[j]);
51+
input_matrix[j] = sycl::round(100. * input_matrix[j]) / 100.;
52+
sum += sycl::fabs(input_matrix[j]);
5353
}
5454

5555
oneapi::dpl::uniform_int_distribution<int> distr2(0, 100);
@@ -61,7 +61,7 @@ void GenerateMatrix(std::vector<float> &input_matrix,
6161
input_matrix[i * kSize + i] = -1 * (sum + 1);
6262

6363
input_results[i] = distr(engine);
64-
input_results[i] = round(100. * input_results[i]) / 100.;
64+
input_results[i] = sycl::round(100. * input_results[i]) / 100.;
6565
}
6666
}
6767
// Function responsible for printing the matrix, called only for N < 10.
@@ -100,7 +100,7 @@ bool CheckIfEqual(Real *data, Real *old_output_data) {
100100
int correct_result = 0;
101101

102102
for (int i = 0; i < kSize; ++i) {
103-
if (fabs(data[i] - old_output_data[i]) < kCheckError) correct_result++;
103+
if (sycl::fabs(data[i] - old_output_data[i]) < kCheckError) correct_result++;
104104
}
105105

106106
return correct_result == kSize;
@@ -194,7 +194,7 @@ int main(int argc, char *argv[]) {
194194
// given. If the difference is less than the error rate for each of
195195
// the elements, then all values have been calculated correctly.
196196
for (int i = 0; i < kSize; ++i) {
197-
Real diff = fabs(output_results[i] - input_results[i]);
197+
Real diff = sycl::fabs(output_results[i] - input_results[i]);
198198
if (diff > kCalculationError) all_eq = false;
199199
}
200200

DirectProgramming/C++SYCL/DenseLinearAlgebra/guided_jacobi_iterative_gpu_optimization/src/3_guided_jacobi_iterative_solver_multi_gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void GenerateMatrix(std::vector<float> &input_matrix,
8181
in_mat_acc[i * kSize + i] = -1 * (sum + 1);
8282

8383
in_res_acc[i] = distr(engine);
84-
in_res_acc[i] = round(100. * in_res_acc[i]) / 100.;
84+
in_res_acc[i] = sycl::round(100. * in_res_acc[i]) / 100.;
8585
});
8686
});
8787
q[1].submit([&](handler &h) {

0 commit comments

Comments
 (0)