forked from pybamm-team/PyBaMM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pybamm-team#633 created a cmake file for klu
- Loading branch information
1 parent
6964708
commit 2364aef
Showing
7 changed files
with
67 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 |
---|---|---|
|
@@ -67,3 +67,9 @@ pyvenv.cfg | |
sundials | ||
sundials4 | ||
SuiteSparse | ||
|
||
# cmakefiles | ||
CMakeFiles | ||
Makefile | ||
*.cmake | ||
*.so |
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,3 @@ | ||
[submodule "third-party/pybind11"] | ||
path = third-party/pybind11 | ||
url = https://github.com/pybind/pybind11.git |
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,55 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(klu) | ||
|
||
set (CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
add_subdirectory(third-party/pybind11) | ||
pybind11_add_module(klu pybamm/solvers/c_solvers/klu.cpp) | ||
|
||
# Sundials | ||
set(SUNDIALS_INCLUDE "sundials4/include") | ||
TARGET_INCLUDE_DIRECTORIES(klu PRIVATE ${SUNDIALS_INCLUDE}) | ||
|
||
find_library(SUNMATSPARSE sundials_sunmatrixsparse PATHS "sundials4/lib") | ||
find_library(IDA sundials_ida PATHS "sundials4/lib") | ||
find_library(NVECTOR sundials_nvecserial PATHS "sundials4/lib") | ||
find_library(SUNKLU sundials_sunlinsolklu PATHS "sundials4/lib") | ||
TARGET_LINK_LIBRARIES(klu PRIVATE ${SUNMATSPARSE} ${IDA} ${NVECTOR} ${SUNKLU}) | ||
|
||
# System libraries | ||
find_library(RT rt) | ||
TARGET_LINK_LIBRARIES(klu PRIVATE ${RT}) | ||
|
||
## KLU ------ | ||
## Add the includes | ||
set(KLU_INCLUDE_DIR "SuiteSparse/KLU/Include") | ||
set(AMD_INCLUDE_DIR "SuiteSparse/AMD/Include") | ||
set(COLAMD_INCLUDE_DIR "SuiteSparse/COLAMD/Include") | ||
set(BTF_INCLUDE_DIR "SuiteSparse/BTF/Include") | ||
set(SUITESPARSECONFIG_INCLUDE_DIR "SuiteSparse/SuiteSparse_config") | ||
TARGET_INCLUDE_DIRECTORIES(klu PRIVATE | ||
${AMD_INCLUDE_DIR} | ||
${COLAMD_INCLUDE_DIR} | ||
${BTF_INCLUDE_DIR} | ||
${SUITESPARSECONFIG_INCLUDE_DIR} | ||
${KLU_INCLUDE_DIR} | ||
) | ||
|
||
## Link Libraries | ||
find_library(KLU klu PATHS "SuiteSparse/KLU/Lib") | ||
find_library(AMD amd PATHS "SuiteSparse/AMD/Lib") | ||
find_library(COLAMD colamd PATHS "SuiteSparse/COLAMD/Lib") | ||
find_library(BTF btf PATHS "SuiteSparse/BTF/Lib") | ||
find_library(SUITESPARSE_CONFIG suitesparseconfig PATHS "SuiteSparse/SuiteSparse_config") | ||
TARGET_LINK_LIBRARIES(klu PRIVATE | ||
${KLU} | ||
${AMD} | ||
${COLAMD} | ||
${BTF} | ||
${SUITESPARSE_CONFIG} | ||
) | ||
|
||
# --------------- | ||
|
File renamed without changes.
Binary file not shown.
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 |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
import pybamm | ||
|
||
import numpy as np | ||
from .c_solvers import klu | ||
|
||
import klu | ||
import scipy.sparse as sparse | ||
|
||
|
||
|