Skip to content

Commit

Permalink
deployment: add WITH_ILP64 option
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz committed Nov 14, 2024
1 parent 4b5a6e6 commit 34b7a81
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ list(
"-DWITH_CBOOL=$<BOOL:${WITH_CBOOL}>"
"-DWITH_QP=$<BOOL:${WITH_QP}>"
"-DWITH_XDP=$<BOOL:${WITH_XDP}>"
"-DWITH_ILP64=$<BOOL:${WITH_ILP64}>"
"-DPROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}"
"-DPROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}"
"-DPROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}"
Expand Down
5 changes: 5 additions & 0 deletions config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ if (NOT DEFINED WITH_XDP)
)
set(WITH_XDP ${WITH_XDP} PARENT_SCOPE)
endif()
# Check if WITH_ILP64 is defined; if not, set it to FALSE
if (NOT DEFINED WITH_ILP64)
set(WITH_ILP64 FALSE)
set(WITH_ILP64 ${WITH_ILP64} PARENT_SCOPE)
endif()

# Export a pkg-config file
configure_file(
Expand Down
7 changes: 5 additions & 2 deletions config/fypp_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def pre_process_fypp(args):
kwd.append("-DWITH_QP=True")
if args.with_xdp:
kwd.append("-DWITH_XDP=True")
if args.with_ilp64:
kwd.append("-DWITH_ILP64=True")

optparser = fypp.get_option_parser()
options, leftover = optparser.parse_args(args=kwd)
Expand Down Expand Up @@ -140,8 +142,9 @@ def fpm_build(args,unknown):
parser.add_argument("--maxrank",type=int, default=4, help="Set the maximum allowed rank for arrays")
parser.add_argument("--with_qp",action='store_true', help="Include WITH_QP in the command")
parser.add_argument("--with_xdp",action='store_true', help="Include WITH_XDP in the command")
parser.add_argument("--with_ilp64",action='store_true', help="Include WITH_ILP64 to build 64-bit BLAS/LAPACK")
parser.add_argument("--lnumbering",action='store_true', help="Add line numbering in preprocessed files")
parser.add_argument("--deploy_stdlib_fpm",action='store_true', help="create the stdlib-fpm folder")
parser.add_argument("--deploy_stdlib_fpm",action='store_true', help="create the stdlib-fpm folder")
# external libraries arguments
parser.add_argument("--build", action='store_true', help="Build the project")

Expand All @@ -162,4 +165,4 @@ def fpm_build(args,unknown):
#==========================================
# build using fpm
if args.build:
fpm_build(args,unknown)
fpm_build(args,unknown)
1 change: 1 addition & 0 deletions config/template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set("@PROJECT_NAME@_WITH_CBOOL" @WITH_CBOOL@)
set("@PROJECT_NAME@_WITH_QP" @WITH_QP@)
set("@PROJECT_NAME@_WITH_XDP" @WITH_XDP@)
set("@PROJECT_NAME@_WITH_ILP64" @WITH_ILP64@)

if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
Expand Down
13 changes: 11 additions & 2 deletions include/common.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
#:set WITH_XDP = False
#:endif

#! Support for linear algebra with 64-bit integer sizes
#:if not defined("WITH_ILP64")
#:set WITH_ILP64 = False
#:endif

#! Real kinds to be considered during templating
#:set REAL_KINDS = ["sp", "dp"]
#:if WITH_XDP
Expand Down Expand Up @@ -75,9 +80,13 @@ $:"s" if cmplx=="c" else "d" if cmplx=="z" else "x" if cmplx=="y" else "q" if cm
#:enddef

#! BLAS/LAPACK/Linear Algebra Integer Kinds
#:set LINALG_INT_KINDS = ["ilp","ilp64"]
#:set LINALG_INT_KINDS = ["ilp"]
#:set LINALG_INT_SUFFIX = [""]
#:if WITH_ILP64
#:set LINALG_INT_KINDS = LINALG_INT_KINDS+["ilp64"]
#:set LINALG_INT_SUFFIX = LINALG_INT_SUFFIX+["_I64"]
#:endif
#:set LINALG_INT_TYPES = ["integer({})".format(k) for k in LINALG_INT_KINDS]
#:set LINALG_INT_SUFFIX = ["","_I64"]
#:set LINALG_INT_KINDS_TYPES = list(zip(LINALG_INT_KINDS, LINALG_INT_TYPES, LINALG_INT_SUFFIX))

#! Complex types to be considered during templating
Expand Down

0 comments on commit 34b7a81

Please sign in to comment.