Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Intel CI jobs on cluster #1723

Merged
merged 8 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,11 @@ build/nocuda-nomixed/nompi/clang/omp/debug/static:
MIXED_PRECISION: "OFF"

# spack oneapi 2023.1
build/icpx20231/igpu/release/shared:
build/icpx20231/gpu/release/shared:
extends:
- .build_and_test_template
- .default_variables
- .quick_test_condition
- .disable_job_condition
- .use_gko-oneapi20231-igpu
variables:
CXX_COMPILER: "icpx"
Expand Down Expand Up @@ -373,19 +372,19 @@ build/icpx20231/igpu/release/shared:
# ONEAPI_DEVICE_SELECTOR: "level_zero:gpu"

# It gives two available backends of GPU on tests
build/icpx/igpu/release/static:
build/dpcpp/gpu/release/shared:
extends:
- .build_and_test_template
- .default_variables
- .full_test_condition
- .disable_job_condition
upsj marked this conversation as resolved.
Show resolved Hide resolved
- .use_gko-oneapi-igpu
variables:
CXX_COMPILER: "dpcpp"
CXX_FLAGS: "-Wpedantic -ffp-model=precise"
BUILD_SYCL: "ON"
BUILD_TYPE: "Release"
BUILD_SHARED_LIBS: "OF"
# static builds take too long
BUILD_SHARED_LIBS: "ON"
DPCPP_SINGLE_MODE: "ON"
ONEAPI_DEVICE_SELECTOR: "*:gpu"
BUILD_HWLOC: "OFF"
Expand Down
9 changes: 3 additions & 6 deletions .gitlab/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,14 @@
.use_gko-oneapi-igpu:
image: ginkgohub/oneapi:latest
tags:
- private_ci
- intel-igpu
- intel-gpus
upsj marked this conversation as resolved.
Show resolved Hide resolved

.use_gko-oneapi20231-igpu:
image: ginkgohub/spack-oneapi:20231-openmpi
tags:
- private_ci
- intel-igpu
- intel-gpus

.use_gko-oneapi-dgpu:
image: ginkgohub/oneapi:latest
tags:
- private_ci
- intel-dgpu
- intel-gpus
6 changes: 5 additions & 1 deletion dpcpp/base/executor.dp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ void DpcppExecutor::set_device_property(dpcpp_queue_property property)
// `wait()` would be needed after every call to a DPC++ function or kernel.
// For example, without `in_order`, doing a copy, a kernel, and a copy, will
// not necessarily happen in that order by default, which we need to avoid.
auto* queue = new sycl::queue{device, detail::get_property_list(property)};
// We need to create the context for each device. Otherwise, we get -999
// Unknown PI error after second device.
// Ref: https://github.com/intel/llvm/issues/10982
auto* queue = new sycl::queue{sycl::context(device), device,
detail::get_property_list(property)};
queue_ = std::move(queue_manager<sycl::queue>{queue, detail::delete_queue});
}

Expand Down
30 changes: 20 additions & 10 deletions dpcpp/preconditioner/sor_kernels.dp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ void initialize_weighted_l(
1, 1};

auto inv_weight = one(weight) / weight;
const auto in_row_ptrs = system_matrix->get_const_row_ptrs();
const auto in_col_idxs = system_matrix->get_const_col_idxs();
const auto in_values = system_matrix->get_const_values();
const auto l_row_ptrs = l_mtx->get_const_row_ptrs();
const auto l_col_idxs = l_mtx->get_col_idxs();
const auto l_values = l_mtx->get_values();

exec->get_queue()->parallel_for(
sycl_nd_range(grid_dim, block_size), [=](sycl::nd_item<3> item_ct1) {
factorization::helpers::initialize_l(
num_rows, system_matrix->get_const_row_ptrs(),
system_matrix->get_const_col_idxs(),
system_matrix->get_const_values(), l_mtx->get_const_row_ptrs(),
l_mtx->get_col_idxs(), l_mtx->get_values(),
num_rows, in_row_ptrs, in_col_idxs, in_values, l_row_ptrs,
l_col_idxs, l_values,
factorization::helpers::triangular_mtx_closure(
[inv_weight](auto val) { return val * inv_weight; },
factorization::helpers::identity{}),
Expand Down Expand Up @@ -67,15 +71,21 @@ void initialize_weighted_l_u(
auto inv_two_minus_weight =
one(weight) / (static_cast<remove_complex<ValueType>>(2.0) - weight);

const auto in_row_ptrs = system_matrix->get_const_row_ptrs();
const auto in_col_idxs = system_matrix->get_const_col_idxs();
const auto in_values = system_matrix->get_const_values();
const auto l_row_ptrs = l_mtx->get_const_row_ptrs();
const auto l_col_idxs = l_mtx->get_col_idxs();
const auto l_values = l_mtx->get_values();
const auto u_row_ptrs = u_mtx->get_const_row_ptrs();
const auto u_col_idxs = u_mtx->get_col_idxs();
const auto u_values = u_mtx->get_values();

exec->get_queue()->parallel_for(
sycl_nd_range(grid_dim, block_size), [=](sycl::nd_item<3> item_ct1) {
factorization::helpers::initialize_l_u(
num_rows, system_matrix->get_const_row_ptrs(),
system_matrix->get_const_col_idxs(),
system_matrix->get_const_values(), l_mtx->get_const_row_ptrs(),
l_mtx->get_col_idxs(), l_mtx->get_values(),
u_mtx->get_const_row_ptrs(), u_mtx->get_col_idxs(),
u_mtx->get_values(),
num_rows, in_row_ptrs, in_col_idxs, in_values, l_row_ptrs,
l_col_idxs, l_values, u_row_ptrs, u_col_idxs, u_values,
factorization::helpers::triangular_mtx_closure(
[inv_weight](auto val) { return val * inv_weight; },
factorization::helpers::identity{}),
Expand Down
4 changes: 4 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ if(GINKGO_BUILD_TESTS)
"${executor}"
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/${example}")
# Prevent performance issues with high core counts
set_property(TEST example_${example}_${executor} PROPERTY ENVIRONMENT OMP_NUM_THREADS=4)
Comment on lines +104 to +105
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be relied on the user or our ctest resource group?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the examples are fast enough to not need it. Only with OpenMP I saw parallel examples taking 500s to executing, so this is a simple workaround

endforeach()
endforeach()

Expand All @@ -115,6 +117,8 @@ if(GINKGO_BUILD_TESTS)
"${CMAKE_CURRENT_SOURCE_DIR}/file-config-solver/data/A.mtx"
WORKING_DIRECTORY
"$<TARGET_FILE_DIR:ginkgo>")
# Prevent performance issues with high core counts
set_property(TEST example_file-config-solver_${config_name}_${executor} PROPERTY ENVIRONMENT OMP_NUM_THREADS=4)
endforeach()
endforeach()

Expand Down
5 changes: 3 additions & 2 deletions test/factorization/factorization_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_F(Factorization, InitializeRowPtrsLSameAsRef)
}


TEST_F(Factorization, InitializeLWithoutSqrtSameAsRef)
TEST_F(Factorization, InitializeLSameAsRef)
{
gko::array<index_type> l_ptrs{ref, mtx->get_size()[0] + 1};
gko::kernels::reference::factorization::initialize_row_ptrs_l(
Expand All @@ -73,6 +73,7 @@ TEST_F(Factorization, InitializeLWithoutSqrtSameAsRef)
gko::kernels::GKO_DEVICE_NAMESPACE::factorization::initialize_l(
exec, dmtx.get(), dl_mtx.get(), diag_sqrt);

GKO_ASSERT_MTX_NEAR(l_mtx, dl_mtx, 0.0);
GKO_ASSERT_MTX_NEAR(l_mtx, dl_mtx,
diag_sqrt ? r<value_type>::value : 0.0);
}
}
13 changes: 11 additions & 2 deletions test/preconditioner/sor_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ class Sor : public CommonTestFixture {
d_mtx->read(md);

result_l->read(md_l);
result_l->scale(gko::initialize<Dense>({0.0}, ref));
std::fill_n(result_l->get_col_idxs(),
result_l->get_num_stored_elements(), -1);
std::fill_n(result_l->get_values(), result_l->get_num_stored_elements(),
gko::nan<value_type>());
d_result_l = gko::clone(exec, result_l);

result_u->read(md_u);
result_u->scale(gko::initialize<Dense>({0.0}, ref));
std::fill_n(result_u->get_col_idxs(),
result_u->get_num_stored_elements(), -1);
std::fill_n(result_u->get_values(), result_u->get_num_stored_elements(),
gko::nan<value_type>());
d_result_u = gko::clone(exec, result_u);
}

Expand All @@ -73,6 +79,7 @@ TEST_F(Sor, InitializeWeightedLFactorIsSameAsReference)
gko::kernels::GKO_DEVICE_NAMESPACE::sor::initialize_weighted_l(
exec, d_mtx.get(), 1.24, d_result_l.get());

GKO_ASSERT_MTX_EQ_SPARSITY(result_l, d_result_l);
GKO_ASSERT_MTX_NEAR(result_l, d_result_l, r<value_type>::value);
}

Expand All @@ -84,6 +91,8 @@ TEST_F(Sor, InitializeWeightedLAndUFactorIsSameAsReference)
gko::kernels::GKO_DEVICE_NAMESPACE::sor::initialize_weighted_l_u(
exec, d_mtx.get(), 1.24, d_result_l.get(), d_result_u.get());

GKO_ASSERT_MTX_EQ_SPARSITY(result_l, d_result_l);
GKO_ASSERT_MTX_EQ_SPARSITY(result_u, d_result_u);
GKO_ASSERT_MTX_NEAR(result_l, d_result_l, r<value_type>::value);
GKO_ASSERT_MTX_NEAR(result_u, d_result_u, r<value_type>::value);
}
Loading