Skip to content

Commit

Permalink
restore default install prefix for need scalapack
Browse files Browse the repository at this point in the history
build {metis,scotch} respect CMAKE_INSTALL_PREFIX
  • Loading branch information
scivision committed May 9, 2024
1 parent 2e315ad commit 987cc69
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ env:
CTEST_NO_TESTS_ACTION: error
CMAKE_BUILD_PARALLEL_LEVEL: 4
CTEST_PARALLEL_LEVEL: 0
CMAKE_INSTALL_PREFIX: ~/libs
CMAKE_PREFIX_PATH: ~/libs

on:
push:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: ci_build

env:
CMAKE_GENERATOR: Ninja
CTEST_NO_TESTS_ACTION: error
CMAKE_BUILD_PARALLEL_LEVEL: 4
CTEST_PARALLEL_LEVEL: 0
CMAKE_INSTALL_PREFIX: ~/libs
CMAKE_PREFIX_PATH: ~/libs

on:
push:
Expand All @@ -21,10 +24,10 @@ jobs:
- name: Install prereqs
run: |
sudo apt update
sudo apt install --no-install-recommends ninja-build libopenmpi-dev openmpi-bin
sudo apt install --no-install-recommends libopenmpi-dev openmpi-bin
- name: configure
run: cmake --preset default --install-prefix=${{ runner.temp }}
run: cmake --preset default

- name: build, test release
run: cmake --workflow --preset default
Expand All @@ -33,7 +36,7 @@ jobs:

# builds fine on local machine
# - name: configure example
# run: cmake -S example -B example/build -DCMAKE_PREFIX_PATH:PATH=${{ runner.temp }} -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
# run: cmake -S example -B example/build -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
# - name: build example
# run: cmake --build example/build
# - name: test example
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/oneapi-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
FC: ifx
CMAKE_BUILD_TYPE: Release
CMAKE_BUILD_PARALLEL_LEVEL: 4
CMAKE_INSTALL_PREFIX: ~/libs
CMAKE_PREFIX_PATH: ~/libs

on:
push:
Expand Down Expand Up @@ -62,7 +64,6 @@ jobs:
run: >-
cmake --preset default
-Dintsize64=${{ matrix.int64 }}
-DCMAKE_INSTALL_PREFIX=${{ runner.temp }}
- name: print config log CMake
run: cat build/CMakeFiles/CMakeConfigureLog.yaml
Expand All @@ -82,7 +83,6 @@ jobs:
cmake
-S example
-B example/build
-DCMAKE_PREFIX_PATH=${{ runner.temp }}
- name: print config log
if: ${{ failure() }}
Expand Down
8 changes: 1 addition & 7 deletions Readme_oneapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
We require
[oneMKL >= 2021.3](https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-linux/2023-2/cmake-config-for-onemkl.html).

We recommend using Ninja generator with oneAPI (and any other) compiler:

```sh
cmake -G Ninja -B build
```

Do not try to build LAPACK and ScaLAPACK with oneAPI, the build will fail--use the oneMKL libraries that provide LAPACK and SCALAPACK.

## Linux
Expand All @@ -23,7 +17,7 @@ If the oneAPI compiler is not found by CMake, try hinting its location like:
export CC=$CMPLR_ROOT/bin/icx
export FC=$CMPLR_ROOT/bin/ifx

cmake -G Ninja -B build
cmake -B build
```

## Windows
Expand Down
7 changes: 6 additions & 1 deletion options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(CMAKE_VERSION VERSION_LESS 3.21)
get_property(not_top DIRECTORY PROPERTY PARENT_DIRECTORY)
if(NOT not_top)
set(${PROJECT_NAME}_IS_TOP_LEVEL true)
endif()
endif()
endif()

option(${PROJECT_NAME}_BUILD_TESTING "Build tests" ${${PROJECT_NAME}_IS_TOP_LEVEL})
Expand Down Expand Up @@ -57,3 +57,8 @@ option(CMAKE_TLS_VERIFY "Verify TLS certificates" ON)
set_property(DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED true)

set(FETCHCONTENT_UPDATES_DISCONNECTED true)

# this is for convenience of those needing scalapaack, lapack built
if(${${PROJECT_NAME}_IS_TOP_LEVEL} AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${PROJECT_BINARY_DIR}/local")
endif()
3 changes: 3 additions & 0 deletions scripts/build_metis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ option(intsize64 "use 64-bit integers in C and Fortran--METIS must be consistent
set(target "metis")

set(args -Dintsize64:BOOL=${intsize64})
if(prefix)
list(APPEND args -DCMAKE_INSTALL_PREFIX:PATH=${prefix})
endif()

include(${CMAKE_CURRENT_LIST_DIR}/run_cmake.cmake)
3 changes: 3 additions & 0 deletions scripts/build_scotch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ option(intsize64 "use 64-bit integers in C and Fortran--Scotch must be consisten
set(target "scotch")

set(args -Dintsize64:BOOL=${intsize64})
if(prefix)
list(APPEND args -DCMAKE_INSTALL_PREFIX:PATH=${prefix})
endif()

include(${CMAKE_CURRENT_LIST_DIR}/run_cmake.cmake)
15 changes: 3 additions & 12 deletions scripts/run_cmake.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if(NOT prefix)
set(prefix ${CMAKE_CURRENT_BINARY_DIR}/build_${target})
endif()

if(NOT bindir)
include(${CMAKE_CURRENT_LIST_DIR}/mkdtemp.cmake)
endif()
Expand All @@ -10,21 +6,16 @@ execute_process(
COMMAND ${CMAKE_COMMAND}
-B${bindir}
-S${CMAKE_CURRENT_LIST_DIR}
${args} -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
${args}
RESULT_VARIABLE ret
)

# avoid overloading CPU/RAM with extreme GNU Make --parallel
cmake_host_system_information(RESULT N QUERY NUMBER_OF_PHYSICAL_CORES)

if(ret EQUAL 0)
message(STATUS "${target} build with ${N} workers")
else()
if(NOT ret EQUAL 0)
message(FATAL_ERROR "${target} failed to configure.")
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} --build ${bindir} --parallel ${N} --target ${target}
COMMAND ${CMAKE_COMMAND} --build ${bindir} --target ${target}
RESULT_VARIABLE ret
)

Expand Down
7 changes: 3 additions & 4 deletions scripts/test_shared.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/tempdir.cmake)
if(NOT bindir)
get_temp_dir(bindir)
endif()
if(NOT prefix)
get_temp_dir(prefix)
endif()

get_temp_dir(prefix)

message(STATUS "binary_dir: ${bindir}
prefix: ${prefix}")
temp install dir: ${prefix}")

execute_process(
COMMAND ${CMAKE_COMMAND}
Expand Down

0 comments on commit 987cc69

Please sign in to comment.