2021-07-07 20:24:46 -04:00
|
|
|
### This will test cmake lang support: CXX and Fortran
|
|
|
|
|
I. Prepare
|
|
|
|
|
1) You must install cmake version 3.18 or above to support LINK_LANGUAGE.
|
|
|
|
|
Otherwise, Fortran build will fail.
|
|
|
|
|
To download the latest cmake, see https://cmake.org/download/.
|
|
|
|
|
2) If there is no Fortran on your system, you must install it via,
|
|
|
|
|
sudo apt install gfortran
|
|
|
|
|
|
|
|
|
|
II. Build
|
2023-06-28 21:48:13 +05:30
|
|
|
```
|
2023-12-11 03:43:30 +00:00
|
|
|
$ mkdir -p build; cd build
|
|
|
|
|
$ rm -rf *;
|
|
|
|
|
$ CXX="$(hipconfig -l)"/clang++ FC=$(which gfortran) cmake -DCMAKE_PREFIX_PATH=/opt/rocm ..
|
|
|
|
|
$ cmake ..
|
|
|
|
|
$ make
|
2023-06-28 21:48:13 +05:30
|
|
|
```
|
2021-07-07 20:24:46 -04:00
|
|
|
|
2023-06-28 21:48:13 +05:30
|
|
|
Note, users may need to add AMD GPU support, if test failed, for example,
|
|
|
|
|
```
|
2023-12-11 03:43:30 +00:00
|
|
|
$ CXX="$(hipconfig -l)"/clang++ FC=$(which gfortran) cmake -DCMAKE_PREFIX_PATH=/opt/rocm -DAMDGPU_TARGETS="gfx1102" ..
|
2023-06-28 21:48:13 +05:30
|
|
|
```
|
2023-12-11 03:43:30 +00:00
|
|
|
To enable compiler auto detection of gpu users may need to add ADMGPU support as command line option,
|
2023-08-14 21:26:49 +05:30
|
|
|
if test failed to run, for example,
|
|
|
|
|
```
|
2023-12-11 03:43:30 +00:00
|
|
|
$ CXX="$(hipconfig -l)"/clang++ FC=$(which gfortran) cmake -DCMAKE_PREFIX_PATH=/opt/rocm -DAMDGPU_TARGETS=native ..
|
2023-08-14 21:26:49 +05:30
|
|
|
```
|
2021-07-07 20:24:46 -04:00
|
|
|
III. Test
|
2023-06-28 21:48:13 +05:30
|
|
|
```
|
2023-12-11 03:43:30 +00:00
|
|
|
$ ./test_fortran
|
2021-07-07 20:24:46 -04:00
|
|
|
Succeeded testing Fortran!
|
|
|
|
|
|
2023-12-11 03:43:30 +00:00
|
|
|
$ ./test_cpp
|
2023-06-28 21:48:13 +05:30
|
|
|
Device name AMD Radeon Graphics
|
2021-07-07 20:24:46 -04:00
|
|
|
PASSED!
|
2023-06-28 21:48:13 +05:30
|
|
|
```
|