-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add omp kernels, dev kernel framework and tests
Co-authored-by: Aditya Kashi <[email protected]>
- Loading branch information
Showing
12 changed files
with
588 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*******************************<GINKGO LICENSE>****************************** | ||
Copyright (c) 2017-2023, the Ginkgo authors | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
******************************<GINKGO LICENSE>*******************************/ | ||
|
||
template <typename ValueType, typename IndexType> | ||
void simple_apply(std::shared_ptr<const DefaultExecutor> exec, | ||
const batch::matrix::Csr<ValueType, IndexType>* mat, | ||
const batch::MultiVector<ValueType>* b, | ||
batch::MultiVector<ValueType>* x) GKO_NOT_IMPLEMENTED; | ||
|
||
|
||
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE( | ||
GKO_DECLARE_BATCH_CSR_SIMPLE_APPLY_KERNEL); | ||
|
||
|
||
template <typename ValueType, typename IndexType> | ||
void advanced_apply(std::shared_ptr<const DefaultExecutor> exec, | ||
const batch::MultiVector<ValueType>* alpha, | ||
const batch::matrix::Csr<ValueType, IndexType>* mat, | ||
const batch::MultiVector<ValueType>* b, | ||
const batch::MultiVector<ValueType>* beta, | ||
batch::MultiVector<ValueType>* x) GKO_NOT_IMPLEMENTED; | ||
|
||
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE( | ||
GKO_DECLARE_BATCH_CSR_ADVANCED_APPLY_KERNEL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/*******************************<GINKGO LICENSE>****************************** | ||
Copyright (c) 2017-2023, the Ginkgo authors | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
******************************<GINKGO LICENSE>*******************************/ | ||
|
||
#include "core/matrix/batch_csr_kernels.hpp" | ||
|
||
|
||
#include <thrust/functional.h> | ||
|
||
|
||
#include <ginkgo/core/base/batch_multi_vector.hpp> | ||
#include <ginkgo/core/base/types.hpp> | ||
#include <ginkgo/core/matrix/batch_csr.hpp> | ||
|
||
|
||
#include "core/base/batch_struct.hpp" | ||
#include "core/matrix/batch_struct.hpp" | ||
#include "cuda/base/batch_struct.hpp" | ||
#include "cuda/base/config.hpp" | ||
#include "cuda/base/thrust.cuh" | ||
#include "cuda/components/cooperative_groups.cuh" | ||
#include "cuda/components/reduction.cuh" | ||
#include "cuda/components/thread_ids.cuh" | ||
#include "cuda/components/uninitialized_array.hpp" | ||
#include "cuda/matrix/batch_struct.hpp" | ||
|
||
|
||
namespace gko { | ||
namespace kernels { | ||
namespace cuda { | ||
/** | ||
* @brief The Csr matrix format namespace. | ||
* @ref Csr | ||
* @ingroup batch_csr | ||
*/ | ||
namespace batch_csr { | ||
|
||
|
||
constexpr auto default_block_size = 256; | ||
constexpr int sm_oversubscription = 4; | ||
|
||
// clang-format off | ||
|
||
// NOTE: DO NOT CHANGE THE ORDERING OF THE INCLUDES | ||
|
||
// #include "common/cuda_hip/matrix/batch_csr_kernels.hpp.inc" | ||
|
||
|
||
#include "common/cuda_hip/matrix/batch_csr_kernel_launcher.hpp.inc" | ||
|
||
// clang-format on | ||
|
||
|
||
} // namespace batch_csr | ||
} // namespace cuda | ||
} // namespace kernels | ||
} // namespace gko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/*******************************<GINKGO LICENSE>****************************** | ||
Copyright (c) 2017-2023, the Ginkgo authors | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
******************************<GINKGO LICENSE>*******************************/ | ||
|
||
#include "core/matrix/batch_csr_kernels.hpp" | ||
|
||
|
||
#include <algorithm> | ||
|
||
|
||
#include <CL/sycl.hpp> | ||
|
||
|
||
#include <ginkgo/core/base/batch_multi_vector.hpp> | ||
#include <ginkgo/core/matrix/batch_csr.hpp> | ||
|
||
|
||
#include "core/base/batch_struct.hpp" | ||
#include "core/matrix/batch_struct.hpp" | ||
#include "dpcpp/base/batch_struct.hpp" | ||
#include "dpcpp/base/dim3.dp.hpp" | ||
#include "dpcpp/base/dpct.hpp" | ||
#include "dpcpp/base/helper.hpp" | ||
#include "dpcpp/components/cooperative_groups.dp.hpp" | ||
#include "dpcpp/components/intrinsics.dp.hpp" | ||
#include "dpcpp/components/reduction.dp.hpp" | ||
#include "dpcpp/components/thread_ids.dp.hpp" | ||
#include "dpcpp/matrix/batch_struct.hpp" | ||
|
||
|
||
namespace gko { | ||
namespace kernels { | ||
namespace dpcpp { | ||
/** | ||
* @brief The Csr matrix format namespace. | ||
* @ref Csr | ||
* @ingroup batch_csr | ||
*/ | ||
namespace batch_csr { | ||
|
||
|
||
// #include "dpcpp/matrix/batch_csr_kernels.hpp.inc" | ||
|
||
|
||
template <typename ValueType, typename IndexType> | ||
void simple_apply(std::shared_ptr<const DefaultExecutor> exec, | ||
const batch::matrix::Csr<ValueType, IndexType>* mat, | ||
const batch::MultiVector<ValueType>* b, | ||
batch::MultiVector<ValueType>* x) GKO_NOT_IMPLEMENTED; | ||
|
||
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE( | ||
GKO_DECLARE_BATCH_CSR_SIMPLE_APPLY_KERNEL); | ||
|
||
|
||
template <typename ValueType, typename IndexType> | ||
void advanced_apply(std::shared_ptr<const DefaultExecutor> exec, | ||
const batch::MultiVector<ValueType>* alpha, | ||
const batch::matrix::Csr<ValueType, IndexType>* mat, | ||
const batch::MultiVector<ValueType>* b, | ||
const batch::MultiVector<ValueType>* beta, | ||
batch::MultiVector<ValueType>* x) GKO_NOT_IMPLEMENTED; | ||
|
||
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE( | ||
GKO_DECLARE_BATCH_CSR_ADVANCED_APPLY_KERNEL); | ||
|
||
|
||
} // namespace batch_csr | ||
} // namespace dpcpp | ||
} // namespace kernels | ||
} // namespace gko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/*******************************<GINKGO LICENSE>****************************** | ||
Copyright (c) 2017-2023, the Ginkgo authors | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
******************************<GINKGO LICENSE>*******************************/ | ||
|
||
#include "core/matrix/batch_csr_kernels.hpp" | ||
|
||
|
||
#include <hip/hip_runtime.h> | ||
#include <thrust/functional.h> | ||
|
||
|
||
#include <ginkgo/core/base/batch_multi_vector.hpp> | ||
#include <ginkgo/core/base/types.hpp> | ||
#include <ginkgo/core/matrix/batch_csr.hpp> | ||
|
||
|
||
#include "core/base/batch_struct.hpp" | ||
#include "core/matrix/batch_struct.hpp" | ||
#include "hip/base/batch_struct.hip.hpp" | ||
#include "hip/base/config.hip.hpp" | ||
#include "hip/base/thrust.hip.hpp" | ||
#include "hip/components/cooperative_groups.hip.hpp" | ||
#include "hip/components/reduction.hip.hpp" | ||
#include "hip/components/thread_ids.hip.hpp" | ||
#include "hip/components/uninitialized_array.hip.hpp" | ||
#include "hip/matrix/batch_struct.hip.hpp" | ||
|
||
|
||
namespace gko { | ||
namespace kernels { | ||
namespace hip { | ||
/** | ||
* @brief The Csr matrix format namespace. | ||
* @ref Csr | ||
* @ingroup batch_csr | ||
*/ | ||
namespace batch_csr { | ||
|
||
|
||
constexpr auto default_block_size = 256; | ||
constexpr int sm_oversubscription = 4; | ||
|
||
// clang-format off | ||
|
||
// NOTE: DO NOT CHANGE THE ORDERING OF THE INCLUDES | ||
|
||
// #include "common/cuda_hip/matrix/batch_csr_kernels.hpp.inc" | ||
|
||
|
||
#include "common/cuda_hip/matrix/batch_csr_kernel_launcher.hpp.inc" | ||
|
||
// clang-format on | ||
|
||
|
||
} // namespace batch_csr | ||
} // namespace hip | ||
} // namespace kernels | ||
} // namespace gko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.