psblas3-mcbind:

Makefile
 cbind/base/Makefile
 cbind/base/psb_base_cbind_mod.f90
 cbind/base/psb_base_psblas_cbind_mod.f90
 cbind/base/psb_c_base.h
 cbind/base/psb_c_cbase.c
 cbind/base/psb_c_cbase.h
 cbind/base/psb_c_sbase.c
 cbind/base/psb_c_sbase.h
 cbind/base/psb_c_zbase.c
 cbind/base/psb_c_zbase.h
 cbind/base/psb_cpenv_mod.f90
 cbind/krylov
 cbind/prec
 cbind/test
 cbind/util

Fixed C includes.
psblas3-mcbind
Salvatore Filippone 8 years ago
parent d536410cbe
commit 4734f19167

@ -48,15 +48,15 @@ check: all
make check -C test/serial
cleanlib:
(cd lib; /bin/rm -f *.a *$(.mod) *$(.fh))
(cd include; /bin/rm -f *.a *$(.mod) *$(.fh))
(cd lib; /bin/rm -f *.a *$(.mod) *$(.fh) *.h)
(cd include; /bin/rm -f *.a *$(.mod) *$(.fh) *.h)
veryclean: cleanlib
cd base && $(MAKE) veryclean
cd prec && $(MAKE) veryclean
cd krylov && $(MAKE) veryclean
cd util && $(MAKE) veryclean
cd cbind && $(MAKE) clean
cd cbind && $(MAKE) veryclean
cd test/fileread && $(MAKE) clean
cd test/pargen && $(MAKE) clean
cd test/util && $(MAKE) clean

@ -5,7 +5,7 @@ INCLUDEDIR=$(TOP)/include
HERE=..
FINCLUDES=$(FMFLAG). $(FMFLAG)$(INCLUDEDIR)
CINCLUDES=-I$(INCLUDEDIR)
CINCLUDES=-I. -I$(INCLUDEDIR)
FOBJS= psb_objhandle_mod.o psb_base_cbind_mod.o psb_cpenv_mod.o \
psb_base_tools_cbind_mod.o psb_base_string_cbind_mod.o \
@ -15,8 +15,8 @@ FOBJS= psb_objhandle_mod.o psb_base_cbind_mod.o psb_cpenv_mod.o \
psb_c_tools_cbind_mod.o psb_c_serial_cbind_mod.o psb_c_psblas_cbind_mod.o \
psb_z_tools_cbind_mod.o psb_z_serial_cbind_mod.o psb_z_psblas_cbind_mod.o
COBJS= psb_c_base.o psb_c_dbase.o
CMOD=psb_base_cbind.h psb_c_base.h psb_c_dbase.h
COBJS= psb_c_base.o psb_c_sbase.o psb_c_dbase.o psb_c_cbase.o psb_c_zbase.o
CMOD=psb_base_cbind.h psb_c_base.h psb_c_sbase.h psb_c_dbase.h psb_c_cbase.h psb_c_zbase.h
OBJS=$(FOBJS) $(COBJS)
LIBMOD=psb_base_cbind_mod$(.mod) psb_cpenv_mod$(.mod) psb_objhandle_mod$(.mod)\
@ -37,7 +37,12 @@ lib: $(OBJS) $(CMOD)
$(COBJS): $(CMOD)
psb_base_cbind_mod.o: psb_cpenv_mod.o psb_objhandle_mod.o psb_base_tools_cbind_mod.o \
psb_base_string_cbind_mod.o psb_base_psblas_cbind_mod.o
psb_base_string_cbind_mod.o psb_base_psblas_cbind_mod.o \
psb_s_tools_cbind_mod.o psb_s_serial_cbind_mod.o psb_s_psblas_cbind_mod.o \
psb_d_tools_cbind_mod.o psb_d_serial_cbind_mod.o psb_d_psblas_cbind_mod.o \
psb_c_tools_cbind_mod.o psb_c_serial_cbind_mod.o psb_c_psblas_cbind_mod.o \
psb_z_tools_cbind_mod.o psb_z_serial_cbind_mod.o psb_z_psblas_cbind_mod.o
psb_base_tools_cbind_mod.o: psb_objhandle_mod.o psb_base_string_cbind_mod.o
psb_s_tools_cbind_mod.o psb_s_serial_cbind_mod.o \
@ -45,9 +50,9 @@ psb_d_tools_cbind_mod.o psb_d_serial_cbind_mod.o \
psb_c_tools_cbind_mod.o psb_c_serial_cbind_mod.o \
psb_z_tools_cbind_mod.o psb_z_serial_cbind_mod.o \
psb_s_psblas_cbind_mod.o psb_d_psblas_cbind_mod.o \
psb_c_psblas_cbind_mod.o psb_z_psblas_cbind_mod.o: psb_objhandle_mod.o psb_base_string_cbind_mod.o
psb_c_psblas_cbind_mod.o psb_z_psblas_cbind_mod.o: psb_base_tools_cbind_mod.o psb_objhandle_mod.o psb_base_string_cbind_mod.o
psb_base_psblas_cbind_mod.o: psb_d_psblas_cbind_mod.o
psb_base_psblas_cbind_mod.o: psb_s_psblas_cbind_mod.o psb_d_psblas_cbind_mod.o psb_c_psblas_cbind_mod.o psb_z_psblas_cbind_mod.o
psb_cpenv_mod.o: psb_base_string_cbind_mod.o psb_objhandle_mod.o

@ -2,5 +2,9 @@ module psb_base_cbind_mod
use psb_objhandle_mod
use psb_cpenv_mod
use psb_base_tools_cbind_mod
use psb_s_tools_cbind_mod
use psb_d_tools_cbind_mod
use psb_c_tools_cbind_mod
use psb_z_tools_cbind_mod
use psb_base_psblas_cbind_mod
end module psb_base_cbind_mod

@ -1,6 +1,9 @@
module psb_base_psblas_cbind_mod
use iso_c_binding
use psb_s_psblas_cbind_mod
use psb_d_psblas_cbind_mod
use psb_c_psblas_cbind_mod
use psb_z_psblas_cbind_mod
end module psb_base_psblas_cbind_mod

@ -52,7 +52,10 @@ extern "C" {
psb_i_t psb_c_get_errstatus();
void psb_c_ibcast(psb_i_t ictxt, psb_i_t n, psb_i_t *v, psb_i_t root);
void psb_c_sbcast(psb_i_t ictxt, psb_i_t n, psb_s_t *v, psb_i_t root);
void psb_c_dbcast(psb_i_t ictxt, psb_i_t n, psb_d_t *v, psb_i_t root);
void psb_c_cbcast(psb_i_t ictxt, psb_i_t n, psb_c_t *v, psb_i_t root);
void psb_c_zbcast(psb_i_t ictxt, psb_i_t n, psb_z_t *v, psb_i_t root);
void psb_c_hbcast(psb_i_t ictxt, const char *v, psb_i_t root);
/* Descriptor/integer routines */

@ -0,0 +1,39 @@
#include <stdlib.h>
#include "psb_c_cbase.h"
psb_c_cvector* psb_c_new_cvector()
{
psb_c_cvector* temp;
temp=(psb_c_cvector *) malloc(sizeof(psb_c_cvector));
temp->cvector=NULL;
return(temp);
}
psb_c_t* psb_c_cvect_get_cpy(psb_c_cvector *xh)
{
psb_c_t *temp=NULL;
psb_i_t vsize=0;
if ((vsize=psb_c_cvect_get_nrows(xh))<0)
return(temp);
if (vsize==0)
vsize=1;
if ((temp=(psb_c_t *)malloc(vsize*sizeof(psb_c_t)))!=NULL)
psb_c_cvect_f_get_cpy(temp,xh);
return(temp);
}
psb_c_cspmat* psb_c_new_cspmat()
{
psb_c_cspmat* temp;
temp=(psb_c_cspmat *) malloc(sizeof(psb_c_cspmat));
temp->cspmat=NULL;
return(temp);
}

@ -0,0 +1,64 @@
#ifndef PSB_C_DBASE_
#define PSB_C_DBASE_
#include "psb_c_base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PSB_C_CVECTOR {
void *cvector;
} psb_c_cvector;
typedef struct PSB_C_CSPMAT {
void *cspmat;
} psb_c_cspmat;
/* dense vectors */
psb_c_cvector* psb_c_new_cvector();
psb_i_t psb_c_cvect_get_nrows(psb_c_cvector *xh);
psb_c_t *psb_c_cvect_get_cpy( psb_c_cvector *xh);
psb_i_t psb_c_cvect_f_get_cpy(psb_c_t *v, psb_c_cvector *xh);
psb_i_t psb_c_cvect_zero(psb_c_cvector *xh);
psb_i_t psb_c_dgeall(psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeins(psb_i_t nz, const psb_i_t *irw, const psb_c_t *val,
psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_c_t *val,
psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeasb(psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgefree(psb_c_cvector *xh, psb_c_descriptor *cdh);
/* sparse matrices*/
psb_c_cspmat* psb_c_new_cspmat();
psb_i_t psb_c_dspall(psb_c_cspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspasb(psb_c_cspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspfree(psb_c_cspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_c_t *val,
psb_c_cspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dmat_get_nrows(psb_c_cspmat *mh);
psb_i_t psb_c_dmat_get_ncols(psb_c_cspmat *mh);
/* psb_i_t psb_c_dspasb_opt(psb_c_cspmat *mh, psb_c_descriptor *cdh, */
/* const char *afmt, psb_i_t upd, psb_i_t dupl); */
psb_i_t psb_c_dsprn(psb_c_cspmat *mh, psb_c_descriptor *cdh, _Bool clear);
/* psb_i_t psb_c_dspprint(psb_c_cspmat *mh); */
/* psblas computational routines */
psb_c_t psb_c_dgedot(psb_c_cvector *xh, psb_c_cvector *yh, psb_c_descriptor *cdh);
psb_s_t psb_c_dgenrm2(psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_s_t psb_c_dgeamax(psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_s_t psb_c_dgeasum(psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_s_t psb_c_dspnrmi(psb_c_cvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeaxpby(psb_c_t alpha, psb_c_cvector *xh,
psb_c_t beta, psb_c_cvector *yh, psb_c_descriptor *cdh);
psb_i_t psb_c_cspmm(psb_c_t alpha, psb_c_cspmat *ah, psb_c_cvector *xh,
psb_c_t beta, psb_c_cvector *yh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspsm(psb_c_t alpha, psb_c_cspmat *th, psb_c_cvector *xh,
psb_c_t beta, psb_c_cvector *yh, psb_c_descriptor *cdh);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

@ -0,0 +1,39 @@
#include <stdlib.h>
#include "psb_c_sbase.h"
psb_c_svector* psb_c_new_svector()
{
psb_c_svector* temp;
temp=(psb_c_svector *) malloc(sizeof(psb_c_svector));
temp->svector=NULL;
return(temp);
}
psb_s_t* psb_c_svect_get_cpy(psb_c_svector *xh)
{
psb_s_t *temp=NULL;
psb_i_t vsize=0;
if ((vsize=psb_c_svect_get_nrows(xh))<0)
return(temp);
if (vsize==0)
vsize=1;
if ((temp=(psb_s_t *)malloc(vsize*sizeof(psb_s_t)))!=NULL)
psb_c_svect_f_get_cpy(temp,xh);
return(temp);
}
psb_c_sspmat* psb_c_new_sspmat()
{
psb_c_sspmat* temp;
temp=(psb_c_sspmat *) malloc(sizeof(psb_c_sspmat));
temp->sspmat=NULL;
return(temp);
}

@ -0,0 +1,64 @@
#ifndef PSB_C_DBASE_
#define PSB_C_DBASE_
#include "psb_c_base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PSB_C_SVECTOR {
void *svector;
} psb_c_svector;
typedef struct PSB_C_SSPMAT {
void *sspmat;
} psb_c_sspmat;
/* dense vectors */
psb_c_svector* psb_c_new_svector();
psb_i_t psb_c_svect_get_nrows(psb_c_svector *xh);
psb_s_t *psb_c_svect_get_cpy( psb_c_svector *xh);
psb_i_t psb_c_svect_f_get_cpy(psb_s_t *v, psb_c_svector *xh);
psb_i_t psb_c_svect_zero(psb_c_svector *xh);
psb_i_t psb_c_dgeall(psb_c_svector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeins(psb_i_t nz, const psb_i_t *irw, const psb_s_t *val,
psb_c_svector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_s_t *val,
psb_c_svector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeasb(psb_c_svector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgefree(psb_c_svector *xh, psb_c_descriptor *cdh);
/* sparse matrices*/
psb_c_sspmat* psb_c_new_sspmat();
psb_i_t psb_c_dspall(psb_c_sspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspasb(psb_c_sspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspfree(psb_c_sspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_s_t *val,
psb_c_sspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dmat_get_nrows(psb_c_sspmat *mh);
psb_i_t psb_c_dmat_get_ncols(psb_c_sspmat *mh);
/* psb_i_t psb_c_dspasb_opt(psb_c_sspmat *mh, psb_c_descriptor *cdh, */
/* const char *afmt, psb_i_t upd, psb_i_t dupl); */
psb_i_t psb_c_dsprn(psb_c_sspmat *mh, psb_c_descriptor *cdh, _Bool clear);
/* psb_i_t psb_c_dspprint(psb_c_sspmat *mh); */
/* psblas computational routines */
psb_s_t psb_c_dgedot(psb_c_svector *xh, psb_c_svector *yh, psb_c_descriptor *cdh);
psb_s_t psb_c_dgenrm2(psb_c_svector *xh, psb_c_descriptor *cdh);
psb_s_t psb_c_dgeamax(psb_c_svector *xh, psb_c_descriptor *cdh);
psb_s_t psb_c_dgeasum(psb_c_svector *xh, psb_c_descriptor *cdh);
psb_s_t psb_c_dspnrmi(psb_c_svector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeaxpby(psb_s_t alpha, psb_c_svector *xh,
psb_s_t beta, psb_c_svector *yh, psb_c_descriptor *cdh);
psb_i_t psb_c_sspmm(psb_s_t alpha, psb_c_sspmat *ah, psb_c_svector *xh,
psb_s_t beta, psb_c_svector *yh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspsm(psb_s_t alpha, psb_c_sspmat *th, psb_c_svector *xh,
psb_s_t beta, psb_c_svector *yh, psb_c_descriptor *cdh);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

@ -0,0 +1,39 @@
#include <stdlib.h>
#include "psb_c_zbase.h"
psb_c_zvector* psb_c_new_zvector()
{
psb_c_zvector* temp;
temp=(psb_c_zvector *) malloc(sizeof(psb_c_zvector));
temp->zvector=NULL;
return(temp);
}
psb_z_t* psb_c_zvect_get_cpy(psb_c_zvector *xh)
{
psb_z_t *temp=NULL;
psb_i_t vsize=0;
if ((vsize=psb_c_zvect_get_nrows(xh))<0)
return(temp);
if (vsize==0)
vsize=1;
if ((temp=(psb_z_t *)malloc(vsize*sizeof(psb_z_t)))!=NULL)
psb_c_zvect_f_get_cpy(temp,xh);
return(temp);
}
psb_c_zspmat* psb_c_new_zspmat()
{
psb_c_zspmat* temp;
temp=(psb_c_zspmat *) malloc(sizeof(psb_c_zspmat));
temp->zspmat=NULL;
return(temp);
}

@ -0,0 +1,64 @@
#ifndef PSB_C_DBASE_
#define PSB_C_DBASE_
#include "psb_c_base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PSB_C_ZVECTOR {
void *zvector;
} psb_c_zvector;
typedef struct PSB_C_ZSPMAT {
void *zspmat;
} psb_c_zspmat;
/* dense vectors */
psb_c_zvector* psb_c_new_zvector();
psb_i_t psb_c_zvect_get_nrows(psb_c_zvector *xh);
psb_z_t *psb_c_zvect_get_cpy( psb_c_zvector *xh);
psb_i_t psb_c_zvect_f_get_cpy(psb_z_t *v, psb_c_zvector *xh);
psb_i_t psb_c_zvect_zero(psb_c_zvector *xh);
psb_i_t psb_c_dgeall(psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeins(psb_i_t nz, const psb_i_t *irw, const psb_z_t *val,
psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_z_t *val,
psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeasb(psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgefree(psb_c_zvector *xh, psb_c_descriptor *cdh);
/* sparse matrices*/
psb_c_zspmat* psb_c_new_zspmat();
psb_i_t psb_c_dspall(psb_c_zspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspasb(psb_c_zspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspfree(psb_c_zspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_z_t *val,
psb_c_zspmat *mh, psb_c_descriptor *cdh);
psb_i_t psb_c_dmat_get_nrows(psb_c_zspmat *mh);
psb_i_t psb_c_dmat_get_ncols(psb_c_zspmat *mh);
/* psb_i_t psb_c_dspasb_opt(psb_c_zspmat *mh, psb_c_descriptor *cdh, */
/* const char *afmt, psb_i_t upd, psb_i_t dupl); */
psb_i_t psb_c_dsprn(psb_c_zspmat *mh, psb_c_descriptor *cdh, _Bool clear);
/* psb_i_t psb_c_dspprint(psb_c_zspmat *mh); */
/* psblas computational routines */
psb_z_t psb_c_dgedot(psb_c_zvector *xh, psb_c_zvector *yh, psb_c_descriptor *cdh);
psb_d_t psb_c_dgenrm2(psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_d_t psb_c_dgeamax(psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_d_t psb_c_dgeasum(psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_d_t psb_c_dspnrmi(psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_i_t psb_c_dgeaxpby(psb_z_t alpha, psb_c_zvector *xh,
psb_z_t beta, psb_c_zvector *yh, psb_c_descriptor *cdh);
psb_i_t psb_c_zspmm(psb_z_t alpha, psb_c_zspmat *ah, psb_c_zvector *xh,
psb_z_t beta, psb_c_zvector *yh, psb_c_descriptor *cdh);
psb_i_t psb_c_dspsm(psb_z_t alpha, psb_c_zspmat *th, psb_c_zvector *xh,
psb_z_t beta, psb_c_zvector *yh, psb_c_descriptor *cdh);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

@ -87,6 +87,21 @@ contains
call psb_bcast(ictxt,v(1:n),root=root)
end subroutine psb_c_ibcast
subroutine psb_c_sbcast(ictxt,n,v,root) bind(c)
use psb_base_mod
implicit none
integer(psb_c_int), value :: ictxt,n, root
real(c_float) :: v(*)
if (n < 0) then
write(0,*) 'Wrong size in BCAST'
return
end if
if (n==0) return
call psb_bcast(ictxt,v(1:n),root=root)
end subroutine psb_c_sbcast
subroutine psb_c_dbcast(ictxt,n,v,root) bind(c)
use psb_base_mod, only : psb_bcast
implicit none
@ -102,6 +117,22 @@ contains
call psb_bcast(ictxt,v(1:n),root=root)
end subroutine psb_c_dbcast
subroutine psb_c_cbcast(ictxt,n,v,root) bind(c)
use psb_base_mod, only : psb_bcast
implicit none
integer(psb_c_int), value :: ictxt,n, root
complex(c_float_complex) :: v(*)
if (n < 0) then
write(0,*) 'Wrong size in BCAST'
return
end if
if (n==0) return
call psb_bcast(ictxt,v(1:n),root=root)
end subroutine psb_c_cbcast
subroutine psb_c_zbcast(ictxt,n,v,root) bind(c)
use psb_base_mod
implicit none

Loading…
Cancel
Save