Skip to content

Commit 7e31d28

Browse files
authored
Merge pull request #2497 from IgorOchocki/fix_onsam_jira
Fix for ONSAM 1868 and 1869
2 parents 838594a + 695f3f3 commit 7e31d28

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
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) {

DirectProgramming/C++SYCL/StructuredGrids/iso2dfd_dpcpp/src/iso2dfd.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool WithinEpsilon(float* output, float* reference, const size_t dim_x,
149149
}
150150

151151
err_file.close();
152-
norm2 = 1/rsqrt(norm2);
152+
norm2 = std::sqrt(norm2);
153153
if (error) printf("error (Euclidean norm): %.9e\n", norm2);
154154
return error;
155155
}
@@ -195,7 +195,8 @@ void Iso2dfdIterationCpu(float* next, float* prev, float* vel,
195195
*
196196
*/
197197
void Iso2dfdIterationGlobal(id<2> it, float* next, float* prev,
198-
float* vel, const float dtDIVdxy, int n_rows,
198+
multi_ptr<const float, access::address_space::global_space, (sycl::access::decorated)2> vel,
199+
const float dtDIVdxy, int n_rows,
199200
int n_cols) {
200201
float value = 0.0;
201202

DirectProgramming/C++SYCL/StructuredGrids/iso3dfd_dpcpp/src/iso3dfd_kernels.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ void Iso3dfdIterationSLM(sycl::nd_item<3> it, float *next, float *prev,
186186
*
187187
*/
188188
void Iso3dfdIterationGlobal(sycl::nd_item<3> it, float *next, float *prev,
189-
float *vel, const float *coeff, int nx, int nxy,
189+
multi_ptr<const float, access::address_space::global_space, (sycl::access::decorated)2> vel,
190+
const float *coeff, int nx, int nxy,
190191
int bx, int by, int z_offset, int full_end_z) {
191192
// We compute the start and the end position in the grid
192193
// for each work-item.

DirectProgramming/C++SYCL/StructuredGrids/iso3dfd_dpcpp/src/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool WithinEpsilon(float* output, float* reference, const size_t dim_x,
159159
}
160160

161161
error_file.close();
162-
norm2 = 1/rsqrt(norm2);
162+
norm2 = std::sqrt(norm2);
163163
if (error) std::cout << "error (Euclidean norm): " << norm2 << "\n";
164164
return error;
165165
}

DirectProgramming/C++SYCL/StructuredGrids/particle-diffusion/src/motionsim_kernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ template <typename AccRandom, typename AccGrid, bool HasFp64> class ParticleMoti
5555
// integer value from floating point value to get just the
5656
// decimal portion. Use this value to later determine if the
5757
// particle is inside or outside of the cell
58-
float dX = sycl::abs(particle_X_a[p] - sycl::round(particle_X_a[p]));
59-
float dY = sycl::abs(particle_Y_a[p] - sycl::round(particle_Y_a[p]));
58+
float dX = std::abs(particle_X_a[p] - sycl::round(particle_X_a[p]));
59+
float dY = std::abs(particle_Y_a[p] - sycl::round(particle_Y_a[p]));
6060
/* Grid point indices closest the particle, defined by the following:
6161
------------------------------------------------------------------
6262
| Condition | Result |

0 commit comments

Comments
 (0)