diff --git a/tools/gen_wrappers.py b/tools/gen_wrappers.py index 403a4e43a4cbed52580114fb3360e1992f1edae5..b82c05aca97c31af43d9afc80e00ddc134f0ce37 100755 --- a/tools/gen_wrappers.py +++ b/tools/gen_wrappers.py @@ -7,13 +7,13 @@ @copyright 2016-2017 University of Tennessee, US, University of Manchester, UK. All rights reserved. - @copyright 2017-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.1.0 @author Pierre Ramet @author Mathieu Faverge - @date 2017-05-04 + @date 2020-01-21 """ import os @@ -22,7 +22,7 @@ import argparse import wrappers description = '''\ -Generates Fortran 90 and Python wrappers from the spm header files.''' +Generates Fortran 90 and Python wrappers from the spm and pastix header files.''' help = '''\ ---------------------------------------------------------------------- @@ -44,7 +44,9 @@ parser.add_argument('args', nargs='*', action='store', help='Files to process') opts = parser.parse_args() # exclude inline functions from the interface -exclude_list = [ "inline", "spmIntSort", "spmIntMSort" ] +exclude_list = [ "inline", "spmIntSort", "spmIntMSort", + "orderDraw", "orderSupernodes", "pastixOrderCompute", "pastixOrderApplyLevelOrder", + "pastixOrderAddIsolate", "pastixOrderFindSupernodes" ] def polish_file(whole_file): """Preprocessing and cleaning of the header file. @@ -57,6 +59,9 @@ def polish_file(whole_file): # Remove C comments: clean_file = re.sub(r"(?s)/\*.*?\*/", "", clean_file) clean_file = re.sub(r"//.*", "", clean_file) + # Remove BEGIN/END_C_DECLS statement: + clean_file = re.sub("BEGIN_C_DECLS", "", clean_file) + clean_file = re.sub("END_C_DECLS", "", clean_file) # Remove C directives (multilines then monoline): clean_file = re.sub(r"(?m)^#(.*[\\][\n])+.*?$", "", clean_file) clean_file = re.sub("(?m)^#.*$", "", clean_file) @@ -469,7 +474,7 @@ spm_enums = { 'description' : "SPM python wrapper to define enums and datatypes", 'header' : "# Start with __ to prevent broadcast to file importing enum\n" "__spm_int__ = @SPM_PYTHON_INTEGER@\n" - "__spm_mpi_enabled__ = @SPM_MPI_ENABLED@\n", + "__spm_mpi_enabled__ = @SPM_PYTHON_MPI_ENABLED@\n", 'footer' : "", 'enums' : { 'coeftype' : enums_python_coeftype, 'mtxtype' : " SymPosDef = trans.ConjTrans + 1\n HerPosDef = trans.ConjTrans + 2\n" } @@ -492,7 +497,7 @@ spm_enums = { 'julia' : { 'filename' : "wrappers/julia/spm/src/spm_enums.jl.in", 'description' : "SPM julia wrapper to define enums and datatypes", 'header' :"const spm_int_t = @SPM_JULIA_INTEGER@\n" - "const spm_mpi_enabled = @SPM_MPI_ENABLED@\n", + "const spm_mpi_enabled = @SPM_JULIA_MPI_ENABLED@\n", 'footer' : "", 'enums' : {} }, @@ -540,7 +545,7 @@ spm = { "end\n" "libspm = spm_library_path()\n\n" "if spm_mpi_enabled\n" - " using MPI\n MPI.Init()\nend\n\n" + " using MPI\nend\n\n" "function __get_mpi_type__()\n" " if !spm_mpi_enabled\n" " return Cint\n" diff --git a/tools/wrappers/__init__.py b/tools/wrappers/__init__.py index 17e01a2a81572561548f871573870076f9da0f10..9b57736398d1439cd2cda53eb74d179b1ec82bec 100644 --- a/tools/wrappers/__init__.py +++ b/tools/wrappers/__init__.py @@ -6,12 +6,12 @@ Wrappers PaStiX wrapper generators module intialization - @copyright 2017-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.1.0 @author Mathieu Faverge - @date 2017-05-04 + @date 2019-11-12 """ diff --git a/tools/wrappers/wrap_fortran.py b/tools/wrappers/wrap_fortran.py index e5ede65a58db5e88719b831fd740bc86e8cfaa52..805b33ae6639dae9438e8afdf629aaf5fc8fbaaa 100644 --- a/tools/wrappers/wrap_fortran.py +++ b/tools/wrappers/wrap_fortran.py @@ -7,17 +7,18 @@ Wrapper Fortran 90 PaStiX generator for the Fortran 90 wrapper - @copyright 2017-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.0.3 @author Mathieu Faverge - @date 2017-05-04 + @date 2019-12-05 """ import os import re import argparse +import time from . import * # set indentation in the f90 file @@ -137,12 +138,12 @@ class wrap_fortran: ! ! ''' + f['description'] + ''' ! -! @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, +! @copyright 2017-''' + time.strftime( "%Y" ) + ''' Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, ! Univ. Bordeaux. All rights reserved. ! -! @version 6.0.0 +! @version 6.0.3 ! @author Mathieu Faverge -! @date 2017-01-01 +! @date ''' + time.strftime( "%Y-%m-%d" ) + ''' ! ! This file has been automatically generated with gen_wrappers.py ! diff --git a/tools/wrappers/wrap_julia.py b/tools/wrappers/wrap_julia.py index 3d39fcce84efd6e2b3f8f54d33a5fcc08c513d16..b4dc34239d1645b1799fef22c172817734b044f1 100644 --- a/tools/wrappers/wrap_julia.py +++ b/tools/wrappers/wrap_julia.py @@ -19,6 +19,7 @@ Wrapper Julia import os import re import argparse +import time from . import * indent=" " @@ -98,13 +99,13 @@ class wrap_julia: ''' + f['description'] + ''' - @copyright 2019-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2020-''' + time.strftime( "%Y" ) + ''' Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. @version 6.0.0 @author Mathieu Faverge @author Lebdaoui selmane - @date 2020-06-18 + @date ''' + time.strftime( "%Y-%m-%d" ) + ''' This file has been automatically generated with gen_wrappers.py @@ -127,13 +128,14 @@ This file has been automatically generated with gen_wrappers.py Translate it into constants.""" ename = enum[0] params = enum[1] + # initialize a string with the fortran interface bib = "" Bib = "" if ("SPM" in f['description']): bib = "spm_" Bib = "Spm" - elif ("Pastix" in f['description']): + elif ("PaStiX" in f['description']): bib = "pastix_" Bib = "PASTIX" py_interface = "@cenum " + bib + ename + "_t " + "{\n" @@ -142,8 +144,9 @@ This file has been automatically generated with gen_wrappers.py length=0 for param in params: if ename == "mtxtype": - param[1] = re.sub(r"trans.", Bib, param[1]) + param[1] = re.sub(r"trans.", "Spm", param[1]) length = max( length, len(param[0])) + fmt="%-"+ str(length) + "s" # loop over the arguments of the enum @@ -240,6 +243,12 @@ This file has been automatically generated with gen_wrappers.py func_line += ", " else : func_line += " " - func_line+= ")::"+types_dict[return_type] + + ret_val = types_dict[return_type] + if return_pointer == "*" : + ret_val = "Ptr{"+types_dict[return_type]+"}" + elif return_pointer == "**" : + ret_val = "Ptr{Ptr{"+types_dict[return_type]+"}}" + func_line += ")::" + ret_val py_interface=cbinding_line + func_line + "\nend\n" return py_interface diff --git a/tools/wrappers/wrap_python.py b/tools/wrappers/wrap_python.py index 47d2c635985f2d61757009c6eec74c89e4365fa7..b1656ef7c06b3eb88ddc0f5a81e3459352109baa 100644 --- a/tools/wrappers/wrap_python.py +++ b/tools/wrappers/wrap_python.py @@ -7,17 +7,18 @@ Wrapper Python PaStiX generator for the python wrapper - @copyright 2017-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.0.3 @author Mathieu Faverge - @date 2017-05-04 + @date 2019-12-05 """ import os import re import argparse +import time from . import * indent=" " @@ -134,14 +135,14 @@ class wrap_python: ''' + f['description'] + ''' - @copyright 2017-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-''' + time.strftime( "%Y" ) + ''' Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.0.3 @author Pierre Ramet @author Mathieu Faverge @author Louis Poirel - @date 2017-05-04 + @date ''' + time.strftime( "%Y-%m-%d" ) + ''' This file has been automatically generated with gen_wrappers.py diff --git a/wrappers/fortran90/src/spm_enums.F90 b/wrappers/fortran90/src/spm_enums.F90 index bcd328fbe30da2480505c69de325c90a4992a829..03a480db2c5ef208d9aafe79e54ca1cfdd84bb63 100644 --- a/wrappers/fortran90/src/spm_enums.F90 +++ b/wrappers/fortran90/src/spm_enums.F90 @@ -4,12 +4,12 @@ ! ! SPM fortran 90 wrapper to define enums and datatypes ! -! @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, +! @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, ! Univ. Bordeaux. All rights reserved. ! -! @version 6.0.0 +! @version 6.0.3 ! @author Mathieu Faverge -! @date 2017-01-01 +! @date 2020-07-15 ! ! This file has been automatically generated with gen_wrappers.py ! diff --git a/wrappers/fortran90/src/spmf.f90 b/wrappers/fortran90/src/spmf.f90 index c13609ee9bbb31a3dd6ea710932d96f0250bf6d4..44c3677ef045af46e1995e318d8af14e566fef4a 100644 --- a/wrappers/fortran90/src/spmf.f90 +++ b/wrappers/fortran90/src/spmf.f90 @@ -4,12 +4,12 @@ ! ! SPM Fortran 90 wrapper ! -! @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, +! @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, ! Univ. Bordeaux. All rights reserved. ! -! @version 6.0.0 +! @version 6.0.3 ! @author Mathieu Faverge -! @date 2017-01-01 +! @date 2020-07-15 ! ! This file has been automatically generated with gen_wrappers.py ! diff --git a/wrappers/julia/spm/src/spm.jl b/wrappers/julia/spm/src/spm.jl index b6fb1156b04201a85b4a12e163b2d85fb36af675..8a2f1676d8b911e90139f232a54fd7683a248b88 100644 --- a/wrappers/julia/spm/src/spm.jl +++ b/wrappers/julia/spm/src/spm.jl @@ -4,17 +4,18 @@ SPM julia wrapper - @copyright 2019-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2020-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. @version 6.0.0 @author Mathieu Faverge @author Lebdaoui selmane - @date 2020-06-18 + @date 2020-07-15 This file has been automatically generated with gen_wrappers.py =# + module spm using CBinding using Libdl @@ -79,7 +80,7 @@ end end @cbindings libspm begin - @cextern spmCopy( spm::Ptr{spmatrix_t} )::spmatrix_t + @cextern spmCopy( spm::Ptr{spmatrix_t} )::Ptr{spmatrix_t} end @cbindings libspm begin @@ -107,11 +108,11 @@ end end @cbindings libspm begin - @cextern spmScatter( spm::Ptr{spmatrix_t}, n::spm_int_t, loc2glob::Ptr{spm_int_t}, distByColumn::Cint, root::Cint, comm::__get_mpi_type__() )::spmatrix_t + @cextern spmScatter( spm::Ptr{spmatrix_t}, n::spm_int_t, loc2glob::Ptr{spm_int_t}, distByColumn::Cint, root::Cint, comm::__get_mpi_type__() )::Ptr{spmatrix_t} end @cbindings libspm begin - @cextern spmGather( spm::Ptr{spmatrix_t}, root::Cint )::spmatrix_t + @cextern spmGather( spm::Ptr{spmatrix_t}, root::Cint )::Ptr{spmatrix_t} end @cbindings libspm begin @@ -159,7 +160,7 @@ end end @cbindings libspm begin - @cextern spmIntConvert( n::spm_int_t, input::Ptr{Cint} )::spm_int_t + @cextern spmIntConvert( n::spm_int_t, input::Ptr{Cint} )::Ptr{spm_int_t} end @cbindings libspm begin @@ -179,7 +180,7 @@ end end @cbindings libspm begin - @cextern spm2Dense( spm::Ptr{spmatrix_t} )::Cvoid + @cextern spm2Dense( spm::Ptr{spmatrix_t} )::Ptr{Cvoid} end @cbindings libspm begin @@ -195,7 +196,7 @@ end end @cbindings libspm begin - @cextern spmDofExtend( spm::Ptr{spmatrix_t}, type::Cint, dof::Cint )::spmatrix_t + @cextern spmDofExtend( spm::Ptr{spmatrix_t}, type::Cint, dof::Cint )::Ptr{spmatrix_t} end end #module diff --git a/wrappers/julia/spm/src/spm_enums.jl.in b/wrappers/julia/spm/src/spm_enums.jl.in index b57ec429aac2e746463a58ff2a00c938c0e33f3b..71e5bca12075445e8e2163a2885c897ad6aa200b 100644 --- a/wrappers/julia/spm/src/spm_enums.jl.in +++ b/wrappers/julia/spm/src/spm_enums.jl.in @@ -4,13 +4,13 @@ SPM julia wrapper to define enums and datatypes - @copyright 2019-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2020-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. @version 6.0.0 @author Mathieu Faverge @author Lebdaoui selmane - @date 2020-06-18 + @date 2020-07-15 This file has been automatically generated with gen_wrappers.py diff --git a/wrappers/python/CMakeLists.txt b/wrappers/python/CMakeLists.txt index 11a6bf87db5f82930214cd16bc19240200e20512..80bfcb7b4ea7555ce8cbdb228100f99ac509d787 100644 --- a/wrappers/python/CMakeLists.txt +++ b/wrappers/python/CMakeLists.txt @@ -17,9 +17,9 @@ else() endif() if (SPM_WITH_MPI) - set(SPM_MPI_ENABLED 1) + set(SPM_PYTHON_MPI_ENABLED 1) else() - set(SPM_MPI_ENABLED 0) + set(SPM_PYTHON_MPI_ENABLED 0) endif() configure_file( diff --git a/wrappers/python/spm/__spm__.py b/wrappers/python/spm/__spm__.py index aa8b70a7592bea67baa6e9f637de391f18f6d674..421aee431a7e433c5cde465b20fd5a4f1c52cd12 100644 --- a/wrappers/python/spm/__spm__.py +++ b/wrappers/python/spm/__spm__.py @@ -4,14 +4,14 @@ SPM python wrapper - @copyright 2017-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.0.3 @author Pierre Ramet @author Mathieu Faverge @author Louis Poirel - @date 2017-05-04 + @date 2020-07-15 This file has been automatically generated with gen_wrappers.py diff --git a/wrappers/python/spm/enum.py.in b/wrappers/python/spm/enum.py.in index 80b547f9a8ee03409720359b07feb8f2443b742b..988699d4b03ff5547f090f0542843f25d59a6c7a 100644 --- a/wrappers/python/spm/enum.py.in +++ b/wrappers/python/spm/enum.py.in @@ -4,14 +4,14 @@ SPM python wrapper to define enums and datatypes - @copyright 2017-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + @copyright 2017-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - @version 6.0.0 + @version 6.0.3 @author Pierre Ramet @author Mathieu Faverge @author Louis Poirel - @date 2017-05-04 + @date 2020-07-15 This file has been automatically generated with gen_wrappers.py @@ -21,7 +21,7 @@ import numpy as np # Start with __ to prevent broadcast to file importing enum __spm_int__ = @SPM_PYTHON_INTEGER@ -__spm_mpi_enabled__ = @SPM_MPI_ENABLED@ +__spm_mpi_enabled__ = @SPM_PYTHON_MPI_ENABLED@ class verbose: Not = 0