Mentions légales du service

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

Remove the Comm parameter as it is a non distributed library

parent 64cec4f9
No related branches found
No related tags found
1 merge request!6Cleanup/pastix integration
...@@ -129,6 +129,4 @@ spm_size_of(spm_coeftype_t type) ...@@ -129,6 +129,4 @@ spm_size_of(spm_coeftype_t type)
} }
} }
typedef int MPI_Comm;
#endif /* _spm_datatypes_h_ */ #endif /* _spm_datatypes_h_ */
...@@ -29,7 +29,7 @@ int readIJV ( const char *filename, spmatrix_t *spm ); ...@@ -29,7 +29,7 @@ int readIJV ( const char *filename, spmatrix_t *spm );
int readMM ( const char *filename, spmatrix_t *spm ); int readMM ( const char *filename, spmatrix_t *spm );
int readDMM ( const char *filename, spmatrix_t *spm ); int readDMM ( const char *filename, spmatrix_t *spm );
int readPETSC( 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 genLaplacian( const char *filename, spmatrix_t *spm );
int genExtendedLaplacian( const char *filename, spmatrix_t *spm ); int genExtendedLaplacian( const char *filename, spmatrix_t *spm );
......
...@@ -52,10 +52,6 @@ ...@@ -52,10 +52,6 @@
* On exit, the filled sparse matrix structure with the matrix from the * On exit, the filled sparse matrix structure with the matrix from the
* file. * 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, * @retval SPM_SUCCESS if the file reading happened successfully,
...@@ -65,141 +61,100 @@ ...@@ -65,141 +61,100 @@
int int
spmReadDriver( spm_driver_t driver, spmReadDriver( spm_driver_t driver,
const char *filename, const char *filename,
spmatrix_t *spm, spmatrix_t *spm )
MPI_Comm comm )
{ {
int mpirank = 0;
/* int mpiinit; */
spmInit(spm); spmInit(spm);
/* MPI_Initialized( &mpiinit ); */ switch(driver)
/* if (mpiinit) { */
/* MPI_Comm_rank( comm, &mpirank ); */
/* } */
mpirank = 0;
if ( mpirank == 0 )
{ {
switch(driver)
{
#if defined(SPM_WITH_FORTRAN) #if defined(SPM_WITH_FORTRAN)
case SpmDriverRSA: case SpmDriverRSA:
readRSA( filename, spm ); readRSA( filename, spm );
break; break;
#endif #endif
case SpmDriverHB: case SpmDriverHB:
/* TODO: Possible to read the RHS, the solution or a guess of the solution */ /* TODO: Possible to read the RHS, the solution or a guess of the solution */
readHB( filename, spm ); 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 );
}
break; break;
case SpmDriverGraph: case SpmDriverIJV:
#if defined(HAVE_SCOTCH) readIJV( filename, spm );
{ break;
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; case SpmDriverMM:
spm->flttype = SpmPattern; readMM( filename, spm );
spm->fmttype = SpmCSC; break;
spm->dof = 1;
spmUpdateComputedFields( spm ); 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
{ if ( spmLoad( spm, file ) != SPM_SUCCESS ) {
fprintf(stderr, "Scotch driver to read graph file unavailable.\n" fprintf( stderr,"spmReadDriver: error while reading the file %s\n", filename );
"Compile with Scotch support to provide it\n"); return SPM_ERR_FILE;
return SPM_ERR_BADPARAMETER;
} }
#endif
break;
default: fclose( file );
fprintf(stderr, "spmReadDriver: Driver not implemented\n"); }
return SPM_ERR_UNKNOWN; 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 ) */ default:
/* { */ fprintf(stderr, "spmReadDriver: Driver not implemented\n");
/* spm_int_t nnz = spm->nnz; */ return SPM_ERR_UNKNOWN;
}
/* 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 ); */
/* } */
/* } */
spmUpdateComputedFields( spm ); spmUpdateComputedFields( spm );
(void)comm;
return SPM_SUCCESS; return SPM_SUCCESS;
} }
...@@ -117,7 +117,7 @@ int main (int argc, char **argv) ...@@ -117,7 +117,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv, spmGetOptions( argc, argv,
&driver, &filename ); &driver, &filename );
rc = spmReadDriver( driver, filename, &spm, 0 ); rc = spmReadDriver( driver, filename, &spm );
free(filename); free(filename);
if ( rc != SPM_SUCCESS ) { if ( rc != SPM_SUCCESS ) {
......
...@@ -63,7 +63,7 @@ int main (int argc, char **argv) ...@@ -63,7 +63,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv, spmGetOptions( argc, argv,
&driver, &filename ); &driver, &filename );
rc = spmReadDriver( driver, filename, &original, 0 ); rc = spmReadDriver( driver, filename, &original );
free(filename); free(filename);
if ( rc != SPM_SUCCESS ) { if ( rc != SPM_SUCCESS ) {
......
...@@ -57,7 +57,7 @@ int main (int argc, char **argv) ...@@ -57,7 +57,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv, spmGetOptions( argc, argv,
&driver, &filename ); &driver, &filename );
rc = spmReadDriver( driver, filename, &original, 0 ); rc = spmReadDriver( driver, filename, &original );
free(filename); free(filename);
if ( rc != SPM_SUCCESS ) { if ( rc != SPM_SUCCESS ) {
......
...@@ -56,7 +56,7 @@ int main (int argc, char **argv) ...@@ -56,7 +56,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv, spmGetOptions( argc, argv,
&driver, &filename ); &driver, &filename );
rc = spmReadDriver( driver, filename, &original, 0 ); rc = spmReadDriver( driver, filename, &original );
free(filename); free(filename);
if ( rc != SPM_SUCCESS ) { if ( rc != SPM_SUCCESS ) {
......
...@@ -52,7 +52,7 @@ int main (int argc, char **argv) ...@@ -52,7 +52,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv, spmGetOptions( argc, argv,
&driver, &filename ); &driver, &filename );
rc = spmReadDriver( driver, filename, &spm, 0 ); rc = spmReadDriver( driver, filename, &spm );
free(filename); free(filename);
if ( rc != SPM_SUCCESS ) { if ( rc != SPM_SUCCESS ) {
......
...@@ -55,7 +55,7 @@ int main (int argc, char **argv) ...@@ -55,7 +55,7 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv, spmGetOptions( argc, argv,
&driver, &filename ); &driver, &filename );
rc = spmReadDriver( driver, filename, &spm, 0 ); rc = spmReadDriver( driver, filename, &spm );
free(filename); free(filename);
if ( rc != SPM_SUCCESS ) { 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