From 34b7a81ad657789f6beaeff8af657dd181eae7b1 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Thu, 14 Nov 2024 13:56:53 +0100 Subject: [PATCH] deployment: add `WITH_ILP64` option --- CMakeLists.txt | 1 + config/CMakeLists.txt | 5 +++++ config/fypp_deployment.py | 7 +++++-- config/template.cmake | 1 + include/common.fypp | 13 +++++++++++-- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b10e1f73d..d83aa205c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,7 @@ list( "-DWITH_CBOOL=$" "-DWITH_QP=$" "-DWITH_XDP=$" + "-DWITH_ILP64=$" "-DPROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}" "-DPROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}" "-DPROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}" diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 10025c3e6..d81373a03 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -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( diff --git a/config/fypp_deployment.py b/config/fypp_deployment.py index ee7cb02cd..d7074b8f4 100644 --- a/config/fypp_deployment.py +++ b/config/fypp_deployment.py @@ -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) @@ -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") @@ -162,4 +165,4 @@ def fpm_build(args,unknown): #========================================== # build using fpm if args.build: - fpm_build(args,unknown) \ No newline at end of file + fpm_build(args,unknown) diff --git a/config/template.cmake b/config/template.cmake index 9a0b15e8d..576b59630 100644 --- a/config/template.cmake +++ b/config/template.cmake @@ -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") diff --git a/include/common.fypp b/include/common.fypp index b1b120d7f..911dfd720 100644 --- a/include/common.fypp +++ b/include/common.fypp @@ -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 @@ -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