Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f9adebd0 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'cleanup/pastix_integration' into 'master'

Cleanup/pastix integration

See merge request !6
parents 05c3ba78 fc64ab68
No related branches found
No related tags found
1 merge request!6Cleanup/pastix integration
......@@ -99,7 +99,7 @@ double spmNorm( spm_normtype_t ntype, const spmatrix_t *spm );
int spmMatVec( spm_trans_t trans, const void *alpha, const spmatrix_t *spm, const void *x, const void *beta, void *y );
int spmMatMat( spm_trans_t trans, spm_int_t n,
const void *alpha, const spmatrix_t *A,
const void *B, spm_int_t ldb,
const void *B, spm_int_t ldb,
const void *beta, void *C, spm_int_t ldc );
void spmScalMatrix( double alpha, spmatrix_t *spm );
void spmScalVector( spm_coeftype_t flt, double alpha, spm_int_t n, void *x, spm_int_t incx );
......@@ -148,9 +148,17 @@ int spmSave( const spmatrix_t *spm, FILE *outfile );
* @{
*/
int spmReadDriver( spm_driver_t driver,
const char *filename,
spmatrix_t *spm,
MPI_Comm spm_comm );
const char *filename,
spmatrix_t *spm );
int spmParseLaplacianInfo( const char *filename,
spm_coeftype_t *flttype,
spm_int_t *dim1,
spm_int_t *dim2,
spm_int_t *dim3,
double *alpha,
double *beta );
/**
* @}
* @name SPM debug subroutines
......
......@@ -129,6 +129,4 @@ spm_size_of(spm_coeftype_t type)
}
}
typedef int MPI_Comm;
#endif /* _spm_datatypes_h_ */
......@@ -51,7 +51,7 @@ laplacian_usage(void)
/**
*******************************************************************************
*
* @ingroup spm_spm_driver
* @ingroup spm
*
* @brief Parse information given through the filename string to configure the
* laplacian matrix to generate.
......@@ -92,13 +92,13 @@ laplacian_usage(void)
*
*******************************************************************************/
int
laplacian_parse_info( const char *filename,
spm_coeftype_t *flttype,
spm_int_t *dim1,
spm_int_t *dim2,
spm_int_t *dim3,
double *alpha,
double *beta )
spmParseLaplacianInfo( const char *filename,
spm_coeftype_t *flttype,
spm_int_t *dim1,
spm_int_t *dim2,
spm_int_t *dim3,
double *alpha,
double *beta )
{
double val1, val2;
long tmp1, tmp2, tmp3;
......@@ -282,7 +282,7 @@ genLaplacian( const char *filename,
double beta = 1.;
int rc;
rc = laplacian_parse_info(filename, &flttype, &dim1, &dim2, &dim3, &alpha, &beta );
rc = spmParseLaplacianInfo(filename, &flttype, &dim1, &dim2, &dim3, &alpha, &beta );
if (rc != SPM_SUCCESS)
return rc;
......@@ -336,7 +336,7 @@ genExtendedLaplacian( const char *filename,
double beta = 1.;
int rc;
rc = laplacian_parse_info(filename, &flttype, &dim1, &dim2, &dim3, &alpha, &beta);
rc = spmParseLaplacianInfo(filename, &flttype, &dim1, &dim2, &dim3, &alpha, &beta);
if (rc != SPM_SUCCESS)
return rc;
......
......@@ -32,12 +32,4 @@ void d_spmExtendedLaplacian3D( spmatrix_t *spm, spm_int_t dim1, spm_int_t dim2,
void s_spmExtendedLaplacian3D( spmatrix_t *spm, spm_int_t dim1, spm_int_t dim2, spm_int_t dim3 );
void p_spmExtendedLaplacian3D( spmatrix_t *spm, spm_int_t dim1, spm_int_t dim2, spm_int_t dim3 );
int laplacian_parse_info( const char *filename,
spm_coeftype_t *flttype,
spm_int_t *dim1,
spm_int_t *dim2,
spm_int_t *dim3,
double *alpha,
double *beta );
#endif /* _laplacian_h_ */
......@@ -29,7 +29,7 @@ int readIJV ( const char *filename, spmatrix_t *spm );
int readMM ( const char *filename, spmatrix_t *spm );
int readDMM ( const char *filename, spmatrix_t *spm );
int readPETSC( const char *filename, spmatrix_t *spm );
int readCSCD ( const char *filename, spmatrix_t *spm, void **rhs, MPI_Comm spm_comm );
//int readCSCD ( const char *filename, spmatrix_t *spm, void **rhs, MPI_Comm spm_comm );
int genLaplacian( const char *filename, spmatrix_t *spm );
int genExtendedLaplacian( const char *filename, spmatrix_t *spm );
......
......@@ -52,10 +52,6 @@
* On exit, the filled sparse matrix structure with the matrix from the
* file.
*
* @param[in] comm
* The MPI communicator on which to distribute the sparse matrix. This
* is also used in case of distributed formats.
*
********************************************************************************
*
* @retval SPM_SUCCESS if the file reading happened successfully,
......@@ -65,141 +61,100 @@
int
spmReadDriver( spm_driver_t driver,
const char *filename,
spmatrix_t *spm,
MPI_Comm comm )
spmatrix_t *spm )
{
int mpirank = 0;
/* int mpiinit; */
spmInit(spm);
/* MPI_Initialized( &mpiinit ); */
/* if (mpiinit) { */
/* MPI_Comm_rank( comm, &mpirank ); */
/* } */
mpirank = 0;
if ( mpirank == 0 )
switch(driver)
{
switch(driver)
{
#if defined(SPM_WITH_FORTRAN)
case SpmDriverRSA:
readRSA( filename, spm );
break;
case SpmDriverRSA:
readRSA( filename, spm );
break;
#endif
case SpmDriverHB:
/* TODO: Possible to read the RHS, the solution or a guess of the solution */
readHB( filename, spm );
break;
case SpmDriverIJV:
readIJV( filename, spm );
break;
case SpmDriverMM:
readMM( filename, spm );
break;
case SpmDriverLaplacian:
genLaplacian( filename, spm );
break;
case SpmDriverXLaplacian:
genExtendedLaplacian( filename, spm );
break;
case SpmDriverSPM:
{
FILE *file = fopen( filename, "r" );
if ( file == NULL ) {
fprintf( stderr,"spmReadDriver: impossible to open the file %s\n", filename );
return SPM_ERR_FILE;
}
if ( spmLoad( spm, file ) != SPM_SUCCESS ) {
fprintf( stderr,"spmReadDriver: error while reading the file %s\n", filename );
return SPM_ERR_FILE;
}
fclose( file );
}
case SpmDriverHB:
/* TODO: Possible to read the RHS, the solution or a guess of the solution */
readHB( filename, spm );
break;
case SpmDriverGraph:
#if defined(HAVE_SCOTCH)
{
SCOTCH_Graph sgraph;
FILE *file;
file = fopen( filename, "r" );
if ( file == NULL ) {
fprintf( stderr,"spmReadDriver: impossible to open the file %s\n", filename );
return SPM_ERR_FILE;
}
/* Check integer compatibility */
if (sizeof(spm_int_t) != sizeof(SCOTCH_Num)) {
fprintf( stderr,"Inconsistent integer type\n");
fclose(file);
return SPM_ERR_INTEGER_TYPE;
}
SCOTCH_graphLoad( &sgraph, file, 1, 0 );
SCOTCH_graphData( &sgraph, NULL, &(spm->n), &(spm->colptr), NULL, NULL, NULL,
&(spm->nnz), &(spm->rowptr), NULL );
fclose(file);
case SpmDriverIJV:
readIJV( filename, spm );
break;
spm->mtxtype = SpmGeneral;
spm->flttype = SpmPattern;
spm->fmttype = SpmCSC;
spm->dof = 1;
spmUpdateComputedFields( spm );
case SpmDriverMM:
readMM( filename, spm );
break;
case SpmDriverLaplacian:
genLaplacian( filename, spm );
break;
case SpmDriverXLaplacian:
genExtendedLaplacian( filename, spm );
break;
case SpmDriverSPM:
{
FILE *file = fopen( filename, "r" );
if ( file == NULL ) {
fprintf( stderr,"spmReadDriver: impossible to open the file %s\n", filename );
return SPM_ERR_FILE;
}
#else
{
fprintf(stderr, "Scotch driver to read graph file unavailable.\n"
"Compile with Scotch support to provide it\n");
return SPM_ERR_BADPARAMETER;
if ( spmLoad( spm, file ) != SPM_SUCCESS ) {
fprintf( stderr,"spmReadDriver: error while reading the file %s\n", filename );
return SPM_ERR_FILE;
}
#endif
break;
default:
fprintf(stderr, "spmReadDriver: Driver not implemented\n");
return SPM_ERR_UNKNOWN;
fclose( file );
}
break;
case SpmDriverGraph:
#if defined(HAVE_SCOTCH)
{
SCOTCH_Graph sgraph;
FILE *file;
file = fopen( filename, "r" );
if ( file == NULL ) {
fprintf( stderr,"spmReadDriver: impossible to open the file %s\n", filename );
return SPM_ERR_FILE;
}
/* Check integer compatibility */
if (sizeof(spm_int_t) != sizeof(SCOTCH_Num)) {
fprintf( stderr,"Inconsistent integer type\n");
fclose(file);
return SPM_ERR_INTEGER_TYPE;
}
SCOTCH_graphLoad( &sgraph, file, 1, 0 );
SCOTCH_graphData( &sgraph, NULL, &(spm->n), &(spm->colptr), NULL, NULL, NULL,
&(spm->nnz), &(spm->rowptr), NULL );
fclose(file);
spm->mtxtype = SpmGeneral;
spm->flttype = SpmPattern;
spm->fmttype = SpmCSC;
spm->dof = 1;
spmUpdateComputedFields( spm );
}
#else
{
fprintf(stderr, "Scotch driver to read graph file unavailable.\n"
"Compile with Scotch support to provide it\n");
return SPM_ERR_BADPARAMETER;
}
#endif
break;
/* if ( mpiinit ) */
/* { */
/* spm_int_t nnz = spm->nnz; */
/* MPI_Bcast( spm, sizeof(spmatrix_t), MPI_CHAR, 0, comm ); */
/* MPI_Bcast( &nnz, 1, SPM_MPI_INT, 0, comm ); */
/* if ( mpirank != 0 ) */
/* { */
/* spm->colptr = (spm_int_t *) malloc((spm->gN+1) * sizeof(spm_int_t)); */
/* spm->rowptr = (spm_int_t *) malloc(nnz * sizeof(spm_int_t)); */
/* spm->loc2glob = NULL; */
/* spm->loc2glob = NULL; */
/* } */
/* MPI_Bcast( spm->colptr, spm->gN+1, SPM_MPI_INT, 0, comm ); */
/* MPI_Bcast( spm->rowptr, nnz, SPM_MPI_INT, 0, comm ); */
/* if ( spm->flttype != SpmPattern ) { */
/* size_t eltsize = spm_size_of( spm->flttype ); */
/* if ( mpirank != 0 ) { */
/* spm->values = (void *) malloc(nnz * eltsize); */
/* } */
/* MPI_Bcast( spm->values, nnz * eltsize, MPI_CHAR, 0, comm ); */
/* } */
/* } */
default:
fprintf(stderr, "spmReadDriver: Driver not implemented\n");
return SPM_ERR_UNKNOWN;
}
spmUpdateComputedFields( spm );
(void)comm;
return SPM_SUCCESS;
}
......@@ -117,7 +117,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
rc = spmReadDriver( driver, filename, &spm, 0 );
rc = spmReadDriver( driver, filename, &spm );
free(filename);
if ( rc != SPM_SUCCESS ) {
......
......@@ -63,7 +63,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
rc = spmReadDriver( driver, filename, &original, 0 );
rc = spmReadDriver( driver, filename, &original );
free(filename);
if ( rc != SPM_SUCCESS ) {
......
......@@ -57,7 +57,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
rc = spmReadDriver( driver, filename, &original, 0 );
rc = spmReadDriver( driver, filename, &original );
free(filename);
if ( rc != SPM_SUCCESS ) {
......
......@@ -56,7 +56,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
rc = spmReadDriver( driver, filename, &original, 0 );
rc = spmReadDriver( driver, filename, &original );
free(filename);
if ( rc != SPM_SUCCESS ) {
......
......@@ -52,7 +52,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
rc = spmReadDriver( driver, filename, &spm, 0 );
rc = spmReadDriver( driver, filename, &spm );
free(filename);
if ( rc != SPM_SUCCESS ) {
......
......@@ -55,7 +55,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
rc = spmReadDriver( driver, filename, &spm, 0 );
rc = spmReadDriver( driver, filename, &spm );
free(filename);
if ( rc != SPM_SUCCESS ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment