DPCT1045#
Message#
Migration is only supported for this API for the <matrix type> sparse matrix type. You may need to adjust the code.
Detailed Help#
This warning appears if the matrix type in use is not supported or cannot be determined.
Suggestions to Fix#
If the matrix type in used is:
Supported by the routine: ignore this warning.
Not supported by the routine: manually fix the code according to sparse-blas-routines.
For example, this original CUDA* code:
1// -- --
2// | 1 0 2 |
3// A = | 0 3 4 |
4// | 0 0 5 |
5// -- --
6// a_val = [1, 2, 3, 4, 5]
7// a_row_ptr = [0, 2, 4, 5]
8// a_col_ind = [0, 2, 1, 2, 2]
9void test_cusparseTcsrmm(cusparseHandle_t handle, cusparseMatDescr_t descrA,
10 float alpha, float beta, float *b, float *c) {
11 // malloc and set value
12 float *a_val = my_malloc<float>();
13 int *a_row_ptr = my_malloc<int>();
14 int *a_col_ind = my_malloc<int>();
15 set_value(a_val);
16 set_value(a_row_ptr);
17 set_value(a_col_ind);
18
19 // calculate
20 cusparseSetMatType(descrA, CUSPARSE_MATRIX_TYPE_SYMMETRIC);
21 cusparseScsrmm(handle, CUSPARSE_OPERATION_NON_TRANSPOSE, 4, 2, 5, 9, &alpha,
22 descrA, a_val, a_row_ptr, a_col_ind, &beta, 5, b, c, 4);
23
24 // synchronize and check value
25 ...
26 // free
27 my_free(a_val);
28 my_free(a_row_ptr);
29 my_free(a_col_ind);
30}
results in the following migrated SYCL* code:
1// -- --
2// | 1 0 2 |
3// A = | 0 3 4 |
4// | 0 0 5 |
5// -- --
6// a_val = [1, 2, 3, 4, 5]
7// a_row_ptr = [0, 2, 4, 5]
8// a_col_ind = [0, 2, 1, 2, 2]
9void test_cusparseTcsrmm(sycl::queue *handle,
10 std::shared_ptr<dpct::sparse::matrix_info> descrA,
11 float alpha, float beta, float *b, float *c) {
12 // malloc and set value
13 float *a_val = my_malloc<float>();
14 int *a_row_ptr = my_malloc<int>();
15 int *a_col_ind = my_malloc<int>();
16 set_value(a_val);
17 set_value(a_row_ptr);
18 set_value(a_col_ind);
19
20 // calculate
21 descrA->set_matrix_type(dpct::sparse::matrix_info::matrix_type::sy);
22 /*
23 DPCT1045:0: Migration is only supported for this API for the general sparse
24 matrix type. You may need to adjust the code.
25 */
26 dpct::sparse::csrmm(*handle, oneapi::mkl::transpose::nontrans, 4, 2, 5,
27 &alpha, descrA, a_val, a_row_ptr, a_col_ind, &beta, 5, b,
28 c, 4);
29
30 // synchronize and check value
31 ...
32 // free
33 my_free(a_val);
34 my_free(a_row_ptr);
35 my_free(a_col_ind);
36}
which is rewritten to:
1// -- --
2// | 1 0 2 |
3// A = | 0 3 4 |
4// | 0 0 5 |
5// -- --
6// a_val = [1, 2, 3, 4, 5]
7// a_row_ptr = [0, 2, 4, 5]
8// a_col_ind = [0, 2, 1, 2, 2]
9//
10// Original matrix A is a symmetric matrix. Only upper/lower data is used.
11// To make it to be a general matrix, all data in the matrix need to be filled.
12// -- --
13// | 1 0 2 |
14// new_A = | 0 3 4 |
15// | 2 4 5 |
16// -- --
17// new_a_val = [1, 2, 3, 4, 2, 4, 5]
18// new_a_row_ptr = [0, 2, 4, 7]
19// new_a_col_ind = [0, 2, 1, 2, 0, 1, 2]
20void test_cusparseTcsrmm(sycl::queue *handle,
21 std::shared_ptr<dpct::sparse::matrix_info> descrA,
22 float alpha, float beta, float *b, float *c) {
23 // malloc and set value
24 float *a_val = my_malloc<float>();
25 int *a_row_ptr = my_malloc<int>();
26 int *a_col_ind = my_malloc<int>();
27 set_value(a_val);
28 set_value(a_row_ptr);
29 set_value(a_col_ind);
30
31 float *new_a_val = my_malloc<float>();
32 int *new_a_row_ptr = my_malloc<int>();
33 int *new_a_col_ind = my_malloc<int>();
34
35 // convert matrix data from symmetric format to general format
36 std::tie(new_a_val, new_a_row_ptr, new_a_col_ind) =
37 symmetric_to_general(a_val, a_row_ptr, a_col_ind);
38
39 my_free(a_val);
40 my_free(a_row_ptr);
41 my_free(a_col_ind);
42
43 // calculate
44 descrA->set_matrix_type(dpct::sparse::matrix_info::matrix_type::ge);
45 dpct::sparse::csrmm(*handle, oneapi::mkl::transpose::nontrans, 4, 2, 5,
46 &alpha, descrA, new_a_val, new_a_row_ptr,
47 new_a_col_ind, &beta, 5, b, c, 4);
48
49 // synchronize and check value
50 ...
51 // free
52 my_free(new_a_val);
53 my_free(new_a_row_ptr);
54 my_free(new_a_col_ind);
55}