From 6414deeb3bd56de4bdbd825222306b52f9e7154a Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 10 Oct 2018 16:15:28 +0100 Subject: [PATCH] ICTXT in PREC%INIT, cbind. --- cbind/base/psb_c_base.h | 1 + cbind/krylov/psb_ckrylov_cbind_mod.f90 | 8 ++++---- cbind/krylov/psb_dkrylov_cbind_mod.f90 | 10 ++++------ cbind/krylov/psb_skrylov_cbind_mod.f90 | 8 ++++---- cbind/krylov/psb_zkrylov_cbind_mod.f90 | 8 ++++---- cbind/prec/psb_c_cprec.h | 18 +++++++++--------- cbind/prec/psb_c_dprec.h | 18 +++++++++--------- cbind/prec/psb_c_sprec.h | 18 +++++++++--------- cbind/prec/psb_c_zprec.h | 18 +++++++++--------- cbind/prec/psb_cprec_cbind_mod.f90 | 11 ++++++----- cbind/prec/psb_dprec_cbind_mod.f90 | 11 ++++++----- cbind/prec/psb_sprec_cbind_mod.f90 | 11 ++++++----- cbind/prec/psb_zprec_cbind_mod.f90 | 11 ++++++----- cbind/test/pargen/ppdec.c | 2 +- 14 files changed, 78 insertions(+), 75 deletions(-) diff --git a/cbind/base/psb_c_base.h b/cbind/base/psb_c_base.h index fe07902e..b78562d5 100644 --- a/cbind/base/psb_c_base.h +++ b/cbind/base/psb_c_base.h @@ -1,3 +1,4 @@ + #ifndef PSB_C_BASE__ #define PSB_C_BASE__ #ifdef __cplusplus diff --git a/cbind/krylov/psb_ckrylov_cbind_mod.f90 b/cbind/krylov/psb_ckrylov_cbind_mod.f90 index cba8ccc9..1e63c428 100644 --- a/cbind/krylov/psb_ckrylov_cbind_mod.f90 +++ b/cbind/krylov/psb_ckrylov_cbind_mod.f90 @@ -13,7 +13,7 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_cspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_cprec) :: ph @@ -38,14 +38,14 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_cspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_cprec) :: ph type(psb_c_cvector) :: bh,xh - integer(c_int), value :: itmax,itrace,irst,istop + integer(psb_c_int), value :: itmax,itrace,irst,istop real(c_double), value :: eps - integer(c_int) :: iter + integer(psb_c_int) :: iter real(c_double) :: err character(c_char) :: methd(*) type(solveroptions) :: options diff --git a/cbind/krylov/psb_dkrylov_cbind_mod.f90 b/cbind/krylov/psb_dkrylov_cbind_mod.f90 index 55fc0366..ce97f4e6 100644 --- a/cbind/krylov/psb_dkrylov_cbind_mod.f90 +++ b/cbind/krylov/psb_dkrylov_cbind_mod.f90 @@ -13,7 +13,7 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_dspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_dprec) :: ph @@ -21,7 +21,6 @@ contains character(c_char) :: methd(*) type(solveroptions) :: options - write(0,*) 'psb_c_dkrylov options ', options%eps res= psb_c_dkrylov_opt(methd, ah, ph, bh, xh, options%eps,cdh, & & itmax=options%itmax, iter=options%iter,& & itrace=options%itrace, istop=options%istop,& @@ -39,14 +38,14 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_dspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_dprec) :: ph type(psb_c_dvector) :: bh,xh - integer(c_int), value :: itmax,itrace,irst,istop + integer(psb_c_int), value :: itmax,itrace,irst,istop real(c_double), value :: eps - integer(c_int) :: iter + integer(psb_c_int) :: iter real(c_double) :: err character(c_char) :: methd(*) type(solveroptions) :: options @@ -59,7 +58,6 @@ contains character(len=20) :: fmethd real(psb_dpk_) :: feps,ferr - write(0,*) 'psb_c_dkrylov_opt options ', eps res = -1 if (c_associated(cdh%item)) then call c_f_pointer(cdh%item,descp) diff --git a/cbind/krylov/psb_skrylov_cbind_mod.f90 b/cbind/krylov/psb_skrylov_cbind_mod.f90 index c2856567..da0c734c 100644 --- a/cbind/krylov/psb_skrylov_cbind_mod.f90 +++ b/cbind/krylov/psb_skrylov_cbind_mod.f90 @@ -13,7 +13,7 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_sspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_sprec) :: ph @@ -38,14 +38,14 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_sspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_sprec) :: ph type(psb_c_svector) :: bh,xh - integer(c_int), value :: itmax,itrace,irst,istop + integer(psb_c_int), value :: itmax,itrace,irst,istop real(c_double), value :: eps - integer(c_int) :: iter + integer(psb_c_int) :: iter real(c_double) :: err character(c_char) :: methd(*) type(solveroptions) :: options diff --git a/cbind/krylov/psb_zkrylov_cbind_mod.f90 b/cbind/krylov/psb_zkrylov_cbind_mod.f90 index ae1931ec..d2c9e60d 100644 --- a/cbind/krylov/psb_zkrylov_cbind_mod.f90 +++ b/cbind/krylov/psb_zkrylov_cbind_mod.f90 @@ -13,7 +13,7 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_zspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_zprec) :: ph @@ -38,14 +38,14 @@ contains use psb_prec_cbind_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_zspmat) :: ah type(psb_c_descriptor) :: cdh type(psb_c_zprec) :: ph type(psb_c_zvector) :: bh,xh - integer(c_int), value :: itmax,itrace,irst,istop + integer(psb_c_int), value :: itmax,itrace,irst,istop real(c_double), value :: eps - integer(c_int) :: iter + integer(psb_c_int) :: iter real(c_double) :: err character(c_char) :: methd(*) type(solveroptions) :: options diff --git a/cbind/prec/psb_c_cprec.h b/cbind/prec/psb_c_cprec.h index b840c6f0..452f1c03 100644 --- a/cbind/prec/psb_c_cprec.h +++ b/cbind/prec/psb_c_cprec.h @@ -8,15 +8,15 @@ extern "C" { #endif -typedef struct PSB_C_CPREC { - void *cprec; -} psb_c_cprec; - -psb_c_cprec* psb_c_new_cprec(); - -psb_i_t psb_c_cprecinit(psb_c_cprec *ph, const char *ptype); -psb_i_t psb_c_cprecbld(psb_c_cspmat *ah, psb_c_descriptor *cdh, psb_c_cprec *ph); -psb_i_t psb_c_cprecfree(psb_c_cprec *ph); + typedef struct PSB_C_CPREC { + void *cprec; + } psb_c_cprec; + + psb_c_cprec* psb_c_new_cprec(); + + psb_i_t psb_c_cprecinit(psb_i_t ictxt,psb_c_cprec *ph, const char *ptype); + psb_i_t psb_c_cprecbld(psb_c_cspmat *ah, psb_c_descriptor *cdh, psb_c_cprec *ph); + psb_i_t psb_c_cprecfree(psb_c_cprec *ph); #ifdef __cplusplus } #endif diff --git a/cbind/prec/psb_c_dprec.h b/cbind/prec/psb_c_dprec.h index fa16247e..90ab72e6 100644 --- a/cbind/prec/psb_c_dprec.h +++ b/cbind/prec/psb_c_dprec.h @@ -8,15 +8,15 @@ extern "C" { #endif -typedef struct PSB_C_DPREC { - void *dprec; -} psb_c_dprec; - -psb_c_dprec* psb_c_new_dprec(); - -psb_i_t psb_c_dprecinit(psb_c_dprec *ph, const char *ptype); -psb_i_t psb_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, psb_c_dprec *ph); -psb_i_t psb_c_dprecfree(psb_c_dprec *ph); + typedef struct PSB_C_DPREC { + void *dprec; + } psb_c_dprec; + + psb_c_dprec* psb_c_new_dprec(); + + psb_i_t psb_c_dprecinit(psb_i_t ictxt, psb_c_dprec *ph, const char *ptype); + psb_i_t psb_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, psb_c_dprec *ph); + psb_i_t psb_c_dprecfree(psb_c_dprec *ph); #ifdef __cplusplus } #endif diff --git a/cbind/prec/psb_c_sprec.h b/cbind/prec/psb_c_sprec.h index cfad99bb..57d66c01 100644 --- a/cbind/prec/psb_c_sprec.h +++ b/cbind/prec/psb_c_sprec.h @@ -8,15 +8,15 @@ extern "C" { #endif -typedef struct PSB_C_SPREC { - void *sprec; -} psb_c_sprec; - -psb_c_sprec* psb_c_new_sprec(); - -psb_i_t psb_c_sprecinit(psb_c_sprec *ph, const char *ptype); -psb_i_t psb_c_sprecbld(psb_c_sspmat *ah, psb_c_descriptor *cdh, psb_c_sprec *ph); -psb_i_t psb_c_sprecfree(psb_c_sprec *ph); + typedef struct PSB_C_SPREC { + void *sprec; + } psb_c_sprec; + + psb_c_sprec* psb_c_new_sprec(); + + psb_i_t psb_c_sprecinit(psb_i_t ictxt, psb_c_sprec *ph, const char *ptype); + psb_i_t psb_c_sprecbld(psb_c_sspmat *ah, psb_c_descriptor *cdh, psb_c_sprec *ph); + psb_i_t psb_c_sprecfree(psb_c_sprec *ph); #ifdef __cplusplus } #endif diff --git a/cbind/prec/psb_c_zprec.h b/cbind/prec/psb_c_zprec.h index eebe8e08..f86e3844 100644 --- a/cbind/prec/psb_c_zprec.h +++ b/cbind/prec/psb_c_zprec.h @@ -8,15 +8,15 @@ extern "C" { #endif -typedef struct PSB_C_ZPREC { - void *zprec; -} psb_c_zprec; - -psb_c_zprec* psb_c_new_zprec(); - -psb_i_t psb_c_zprecinit(psb_c_zprec *ph, const char *ptype); -psb_i_t psb_c_zprecbld(psb_c_zspmat *ah, psb_c_descriptor *cdh, psb_c_zprec *ph); -psb_i_t psb_c_zprecfree(psb_c_zprec *ph); + typedef struct PSB_C_ZPREC { + void *zprec; + } psb_c_zprec; + + psb_c_zprec* psb_c_new_zprec(); + + psb_i_t psb_c_zprecinit(psb_i_t ictxt, psb_c_zprec *ph, const char *ptype); + psb_i_t psb_c_zprecbld(psb_c_zspmat *ah, psb_c_descriptor *cdh, psb_c_zprec *ph); + psb_i_t psb_c_zprecfree(psb_c_zprec *ph); #ifdef __cplusplus } #endif diff --git a/cbind/prec/psb_cprec_cbind_mod.f90 b/cbind/prec/psb_cprec_cbind_mod.f90 index 7f827b55..67b26a9e 100644 --- a/cbind/prec/psb_cprec_cbind_mod.f90 +++ b/cbind/prec/psb_cprec_cbind_mod.f90 @@ -13,12 +13,13 @@ module psb_cprec_cbind_mod contains - function psb_c_cprecinit(ph,ptype) bind(c) result(res) + function psb_c_cprecinit(ictxt,ph,ptype) bind(c) result(res) use psb_base_mod use psb_prec_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int), value :: ictxt + integer(psb_c_int) :: res type(psb_c_cprec) :: ph character(c_char) :: ptype(*) type(psb_cprec_type), pointer :: precp @@ -36,7 +37,7 @@ contains call stringc2f(ptype,fptype) - call psb_precinit(precp,fptype,info) + call psb_precinit(ictxt,precp,fptype,info) res = min(0,info) return @@ -51,7 +52,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_cspmat) :: ah type(psb_c_cprec) :: ph type(psb_c_descriptor) :: cdh @@ -94,7 +95,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_cprec) :: ph type(psb_cprec_type), pointer :: precp diff --git a/cbind/prec/psb_dprec_cbind_mod.f90 b/cbind/prec/psb_dprec_cbind_mod.f90 index 1e756d11..50f0a0b7 100644 --- a/cbind/prec/psb_dprec_cbind_mod.f90 +++ b/cbind/prec/psb_dprec_cbind_mod.f90 @@ -13,12 +13,13 @@ module psb_dprec_cbind_mod contains - function psb_c_dprecinit(ph,ptype) bind(c) result(res) + function psb_c_dprecinit(ictxt,ph,ptype) bind(c) result(res) use psb_base_mod use psb_prec_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int), value :: ictxt + integer(psb_c_int) :: res type(psb_c_dprec) :: ph character(c_char) :: ptype(*) type(psb_dprec_type), pointer :: precp @@ -36,7 +37,7 @@ contains call stringc2f(ptype,fptype) - call psb_precinit(precp,fptype,info) + call psb_precinit(ictxt,precp,fptype,info) res = min(0,info) return @@ -51,7 +52,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_dspmat) :: ah type(psb_c_dprec) :: ph type(psb_c_descriptor) :: cdh @@ -94,7 +95,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_dprec) :: ph type(psb_dprec_type), pointer :: precp diff --git a/cbind/prec/psb_sprec_cbind_mod.f90 b/cbind/prec/psb_sprec_cbind_mod.f90 index 1578eeba..9474949f 100644 --- a/cbind/prec/psb_sprec_cbind_mod.f90 +++ b/cbind/prec/psb_sprec_cbind_mod.f90 @@ -13,12 +13,13 @@ module psb_sprec_cbind_mod contains - function psb_c_sprecinit(ph,ptype) bind(c) result(res) + function psb_c_sprecinit(ictxt,ph,ptype) bind(c) result(res) use psb_base_mod use psb_prec_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int), value :: ictxt + integer(psb_c_int) :: res type(psb_c_sprec) :: ph character(c_char) :: ptype(*) type(psb_sprec_type), pointer :: precp @@ -36,7 +37,7 @@ contains call stringc2f(ptype,fptype) - call psb_precinit(precp,fptype,info) + call psb_precinit(ictxt,precp,fptype,info) res = min(0,info) return @@ -51,7 +52,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_sspmat) :: ah type(psb_c_sprec) :: ph type(psb_c_descriptor) :: cdh @@ -94,7 +95,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_sprec) :: ph type(psb_sprec_type), pointer :: precp diff --git a/cbind/prec/psb_zprec_cbind_mod.f90 b/cbind/prec/psb_zprec_cbind_mod.f90 index c662e21c..d428fced 100644 --- a/cbind/prec/psb_zprec_cbind_mod.f90 +++ b/cbind/prec/psb_zprec_cbind_mod.f90 @@ -13,12 +13,13 @@ module psb_zprec_cbind_mod contains - function psb_c_zprecinit(ph,ptype) bind(c) result(res) + function psb_c_zprecinit(ictxt,ph,ptype) bind(c) result(res) use psb_base_mod use psb_prec_mod use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int), value :: ictxt + integer(psb_c_int) :: res type(psb_c_zprec) :: ph character(c_char) :: ptype(*) type(psb_zprec_type), pointer :: precp @@ -36,7 +37,7 @@ contains call stringc2f(ptype,fptype) - call psb_precinit(precp,fptype,info) + call psb_precinit(ictxt,precp,fptype,info) res = min(0,info) return @@ -51,7 +52,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_zspmat) :: ah type(psb_c_zprec) :: ph type(psb_c_descriptor) :: cdh @@ -94,7 +95,7 @@ contains use psb_base_string_cbind_mod implicit none - integer(c_int) :: res + integer(psb_c_int) :: res type(psb_c_zprec) :: ph type(psb_zprec_type), pointer :: precp diff --git a/cbind/test/pargen/ppdec.c b/cbind/test/pargen/ppdec.c index 1e9d786a..32c5b600 100644 --- a/cbind/test/pargen/ppdec.c +++ b/cbind/test/pargen/ppdec.c @@ -320,7 +320,7 @@ int main(int argc, char *argv[]) psb_c_barrier(ictxt); /* Set up the preconditioner */ ph = psb_c_new_dprec(); - psb_c_dprecinit(ph,ptype); + psb_c_dprecinit(ictxt,ph,ptype); ret=psb_c_dprecbld(ah,cdh,ph); fprintf(stderr,"From psb_c_dprecbld: %d\n",ret);