Skip to content

Commit 7e35d0b

Browse files
Fix style and add fp32 job to workflow
1 parent 7160c2a commit 7e35d0b

File tree

11 files changed

+55
-37
lines changed

11 files changed

+55
-37
lines changed

.github/workflows/build_and_run.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,14 @@ jobs:
165165
&$script_path
166166
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
167167
168-
- name: Run benchmarks
169-
run: dpbench -i ${{env.WORKLOADS}} run -r2 --no-print-results || exit 1
168+
- name: Run benchmarks fp64
169+
run: dpbench -i ${{env.WORKLOADS}} run -r2 --no-print-results --precision=double || exit 1
170170

171-
- name: Generate report
171+
- name: Generate report fp64
172+
run: dpbench -i ${{env.WORKLOADS}} report || exit 1
173+
174+
- name: Run benchmarks fp32
175+
run: dpbench -i ${{env.WORKLOADS}} run -r2 --no-print-results --precision=single || exit 1
176+
177+
- name: Generate report fp32
172178
run: dpbench -i ${{env.WORKLOADS}} report || exit 1

dpbench/benchmarks/black_scholes/black_scholes_sycl_native_ext/black_scholes_sycl/_black_scholes_kernel.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
using namespace sycl;
1010

11-
template <typename FpTy>
12-
class BlackScholesKernel;
11+
template <typename FpTy> class BlackScholesKernel;
1312

1413
template <typename FpTy>
1514
void black_scholes_impl(queue Queue,

dpbench/benchmarks/black_scholes/black_scholes_sycl_native_ext/black_scholes_sycl/_black_scholes_sycl.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,20 @@ void black_scholes_sync(size_t /**/,
6565
throw std::runtime_error("Input arrays are not acceptable.");
6666

6767
if (typenum == UAR_FLOAT) {
68-
black_scholes_impl<float>(Queue, nopt, price.get_data<float>(),
69-
strike.get_data<float>(), t.get_data<float>(), rate,
70-
volatility, call.get_data<float>(),
71-
put.get_data<float>());
68+
black_scholes_impl<float>(
69+
Queue, nopt, price.get_data<float>(),
70+
strike.get_data<float>(), t.get_data<float>(), rate,
71+
volatility, call.get_data<float>(),
72+
put.get_data<float>());
7273
} else if (typenum == UAR_DOUBLE) {
73-
black_scholes_impl<double>(Queue, nopt, price.get_data<double>(),
74-
strike.get_data<double>(), t.get_data<double>(), rate,
75-
volatility, call.get_data<double>(),
76-
put.get_data<double>());
74+
black_scholes_impl<double>(
75+
Queue, nopt, price.get_data<double>(),
76+
strike.get_data<double>(), t.get_data<double>(), rate,
77+
volatility, call.get_data<double>(),
78+
put.get_data<double>());
7779
} else {
78-
throw std::runtime_error("Expected a double or single precision FP array.");
80+
throw std::runtime_error(
81+
"Expected a double or single precision FP array.");
7982
}
8083
}
8184

dpbench/benchmarks/dbscan/dbscan_sycl_native_ext/dbscan_sycl/_dbscan_kernel.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ void getNeighborhood(size_t n,
106106
}
107107
}
108108

109-
template<typename FpTy>
110-
class DBScanKernel;
109+
template<typename FpTy> class DBScanKernel;
111110

112111
template <typename FpTy>
113112
size_t dbscan_impl(queue q,
@@ -135,8 +134,7 @@ size_t dbscan_impl(queue q,
135134
size_t i2 = (i1 + 1 == n_samples ? n_samples : i1 + 1);
136135
getNeighborhood<FpTy>(n_samples, n_features, data, i2 - i1,
137136
data + i1 * n_features, eps,
138-
d_indices + i1 * n_samples,
139-
d_sizes + i1);
137+
d_indices + i1 * n_samples, d_sizes + i1);
140138
});
141139
});
142140

dpbench/benchmarks/dbscan/dbscan_sycl_native_ext/dbscan_sycl/_dbscan_sycl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ size_t dbscan_sync(size_t n_samples,
4545

4646
if (typenum == UAR_FLOAT) {
4747
return dbscan_impl<float>(queue, n_samples, n_features,
48-
data.get_data<float>(), eps, min_pts);
49-
} else if (typenum == UAR_DOUBLE) {
48+
data.get_data<float>(), eps, min_pts);
49+
}
50+
else if (typenum == UAR_DOUBLE) {
5051
return dbscan_impl<double>(queue, n_samples, n_features,
51-
data.get_data<double>(), eps, min_pts);
52+
data.get_data<double>(), eps, min_pts);
5253
}
5354

5455
throw std::runtime_error("Expected a double or single precision FP array.");

dpbench/benchmarks/l2_norm/l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_kernel.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
using namespace sycl;
1111

12-
template <typename FpTy>
13-
class theKernel;
12+
template <typename FpTy> class theKernel;
1413

1514
template <typename FpTy>
1615
void l2_norm_impl(queue Queue,

dpbench/benchmarks/l2_norm/l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_sycl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ void l2_norm_sync(dpctl::tensor::usm_ndarray a, dpctl::tensor::usm_ndarray d)
2323

2424
if (typenum == UAR_FLOAT) {
2525
l2_norm_impl(Queue, npoints, dims, a.get_data<float>(),
26-
d.get_data<float>());
26+
d.get_data<float>());
2727
} else if (typenum == UAR_DOUBLE) {
2828
l2_norm_impl(Queue, npoints, dims, a.get_data<double>(),
29-
d.get_data<double>());
29+
d.get_data<double>());
3030
} else {
31-
throw std::runtime_error("Expected a double or single precision FP array.");
31+
throw std::runtime_error(
32+
"Expected a double or single precision FP array.");
3233
}
3334
}
3435

dpbench/benchmarks/pairwise_distance/pairwise_distance_sycl_native_ext/pairwise_distance_sycl/_pairwise_distance_kernel.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ using namespace sycl;
1212
#define SQRT(x) sqrt(x)
1313
#endif
1414

15+
template <typename FpTy> class PairwiseDistanceKernel;
16+
1517
template <typename FpTy>
1618
void pairwise_distance_impl(queue Queue,
1719
size_t npoints,
@@ -21,7 +23,7 @@ void pairwise_distance_impl(queue Queue,
2123
FpTy *distance_op)
2224
{
2325
Queue.submit([&](handler &h) {
24-
h.parallel_for<class PairwiseDistanceKernel>(
26+
h.parallel_for<PairwiseDistanceKernel<FpTy>>(
2527
range<1>{npoints}, [=](id<1> myID) {
2628
size_t i = myID[0];
2729
for (size_t j = 0; j < npoints; j++) {

dpbench/benchmarks/pairwise_distance/pairwise_distance_sycl_native_ext/pairwise_distance_sycl/_pairwise_distance_sycl.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,23 @@ void pairwise_distance_sync(dpctl::tensor::usm_ndarray X1,
5151
auto Queue = X1.get_queue();
5252
auto ndims = 3;
5353
auto npoints = X1.get_size() / ndims;
54+
auto typenum = X1.get_typenum();
5455

5556
if (!ensure_compatibility(X1, X2, D))
5657
throw std::runtime_error("Input arrays are not acceptable.");
5758

58-
if (X1.get_typenum() != UAR_DOUBLE || X2.get_typenum() != UAR_DOUBLE) {
59-
throw std::runtime_error("Expected a double precision FP array.");
59+
if (typenum == UAR_FLOAT) {
60+
pairwise_distance_impl(Queue, npoints, ndims, X1.get_data<float>(),
61+
X2.get_data<float>(), D.get_data<float>());
62+
}
63+
else if (typenum == UAR_DOUBLE) {
64+
pairwise_distance_impl(Queue, npoints, ndims, X1.get_data<double>(),
65+
X2.get_data<double>(), D.get_data<double>());
66+
}
67+
else {
68+
throw std::runtime_error(
69+
"Expected a double precision FP array.");
6070
}
61-
62-
pairwise_distance_impl(Queue, npoints, ndims, X1.get_data<double>(),
63-
X2.get_data<double>(), D.get_data<double>());
6471
}
6572

6673
PYBIND11_MODULE(_pairwise_distance_sycl, m)

dpbench/benchmarks/rambo/rambo_sycl_native_ext/rambo_sycl/_rambo_kernel.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
using namespace sycl;
1414

15-
template <typename FpTy>
16-
class RamboKernel;
15+
template <typename FpTy> class RamboKernel;
1716

1817
template <typename FpTy>
1918
event rambo_impl(queue Queue,

0 commit comments

Comments
 (0)