Skip to content

Commit ca34cad

Browse files
[BLAS,RNG,LAPACK] Add examples with CMake (#188)
* [blas] add source files for gemm example * [blas] separate helper functions into .hpp * [blas] add device description in header comment * [blas] update source file name to match public backend name * [blas] update file names * [blas] change banner to apache, and move source files into RT/CT folders in domain * [blas] add source files for gemm example * [blas] separate helper functions into .hpp * [blas] add device description in header comment * [blas] update source file name to match public backend name * [blas] update file names * [blas] change banner to apache, and move source files into RT/CT folders in domain * move examples common helper file under examples/ * [header] update helper header path in src * update cmakelists for CT and levels up * RT gemm update include header name * test change1 cmake * [blas][rng] fixed examples, tested on lnx * Added lapack examples and other small fixes * Create draft examples README.md (not for users) * Update examples/README.md for better format * remove detecting L0/openCL for intel backends * add ctest and set SYCL_DEVICE_FILTER for examples testing * small fixes with ctest * Update examples README for users * Update building_the_project.rst * add_test for each SYCL_DEVICE_FILTER and align example test name * fix typo * improve format of output * Update examples README output format * Delete common_helper_functions.hpp * fix cmake message * Update examples/blas/CMakeLists.txt Co-authored-by: Andrew T. Barker <andrew1.barker@intel.com> * Update examples/blas/compile_time_dispatching/CMakeLists.txt Co-authored-by: Andrew T. Barker <andrew1.barker@intel.com> * [blas] remove standalone CT for every backend and add mklcpu+cuda, use malloc_device * [rng] remove standalone CT for every backend and add mklcpu+cuda, use malloc_device * [blas][include] improve style * [lapack] remove standalone CT and add mklcpu+cuda, use malloc_device, and clean up * small fix in output message * Update README.md * style fix * [all] change calloc to std::vector * [all] wait_and_throw on events and reverse sycl::free order * [all] clang-format cpp and hpp files * set build_examples to true as default, correct year in liscence * remove not needed files * remove unnecessary headers * improve headers * add comments about CT examples need CUDA backends * Update README.md * print matrices instead of check for correctness * add note about float precision limit in README * update CMake to work on AMD * remove extra if * clean up(improve wording, remove -DNOMINMAX) * clean up with wording Co-authored-by: Andrew T. Barker <andrew1.barker@intel.com>
1 parent c17a95c commit ca34cad

File tree

22 files changed

+2474
-1
lines changed

22 files changed

+2474
-1
lines changed

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ set(ONEMKL_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Name of the SYCL compiler")
5959
## Testing
6060
option(BUILD_FUNCTIONAL_TESTS "" ON)
6161

62+
## Examples
63+
option(BUILD_EXAMPLES "" ON)
64+
6265
## Documentation
6366
option(BUILD_DOC "" OFF)
6467

@@ -211,11 +214,19 @@ endif()
211214
add_subdirectory(src bin)
212215

213216
# Functional Tests
214-
if(BUILD_FUNCTIONAL_TESTS)
217+
if(BUILD_FUNCTIONAL_TESTS OR BUILD_EXAMPLES)
215218
enable_testing()
219+
endif()
220+
221+
if(BUILD_FUNCTIONAL_TESTS)
216222
add_subdirectory(tests)
217223
endif()
218224

225+
# Examples
226+
if (BUILD_EXAMPLES)
227+
add_subdirectory(examples)
228+
endif()
229+
219230
if(BUILD_DOC)
220231
add_subdirectory(docs)
221232
endif()

docs/building_the_project.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ Testing-Related Options
238238
* ``build_functional_tests=[True | False]``. Setting it to ``True`` enables
239239
the building of functional tests. The default value is ``True``.
240240

241+
Example-Related Options
242+
~~~~~~~~~~~~~~~~~~~~~~~
243+
244+
* ``build_examples=[True | False]``. Setting it to ``True`` enables
245+
the building of examples. The default value is ``True``. Compile_time_dispatching examples will always be built if this value is set to true. Run_time_dispatching examples will be build if both this value and ``build_shared_libs`` is set to true
246+
241247
Documentation
242248
~~~~~~~~~~~~~
243249

@@ -447,6 +453,10 @@ CMake.
447453
- BUILD_FUNCTIONAL_TESTS
448454
- True, False
449455
- True
456+
* - build_examples
457+
- BUILD_EXAMPLES
458+
- True, False
459+
- True
450460
* - build_doc
451461
- BUILD_DOC
452462
- True, False

examples/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#===============================================================================
2+
# Copyright 2022 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing,
11+
# software distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions
14+
# and limitations under the License.
15+
#
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
#===============================================================================
19+
20+
# builds examples in specified domain
21+
22+
foreach(domain ${TARGET_DOMAINS})
23+
add_subdirectory(${domain})
24+
endforeach()

0 commit comments

Comments
 (0)