19#include "spm_drivers.h"
20#if defined(SPM_WITH_SCOTCH)
50#if !defined(SPM_WITH_SCOTCH)
54 fprintf( stderr,
"Scotch driver to read graph file unavailable.\n"
55 "Compile with Scotch support to provide it\n" );
62 SCOTCH_Num baseval = 1;
64 file = fopen( filename,
"r" );
66 fprintf( stderr,
"spmReadDriver: impossible to open the file %s\n", filename );
71 if (
sizeof(
spm_int_t) !=
sizeof(SCOTCH_Num)) {
72 fprintf( stderr,
"Inconsistent integer type\n");
77 SCOTCH_graphLoad( &sgraph, file, -1, 0 );
78 SCOTCH_graphData( &sgraph, &baseval, &(spm->
n), &(spm->
colptr), NULL, NULL, NULL,
141 const char *filename,
145 int is_centralized = 1;
148 if ( filename == NULL ) {
149 fprintf( stderr,
"spmReadDriver[Dist]: invalid filename parameter\n" );
154 fprintf( stderr,
"spmReadDriver[Dist]: invalide spm parameter\n" );
164 fprintf(stderr,
"RSA driver is no longer supported and is replaced by the HB driver\n");
165 spm_attr_fallthrough;
170 rc = readHB( filename, spm );
175 rc = readIJV( filename, spm );
180 rc = readMM( filename, spm );
202 fprintf(stderr,
"spmReadDriver: Driver not implemented\n");
206#if defined(SPM_WITH_MPI)
207 MPI_Allreduce( MPI_IN_PLACE, &rc, 1, MPI_INT,
211 fprintf( stderr,
"spmReadDriver[Dist]: error while reading the input %s\n", filename );
215#if defined(SPM_WITH_MPI)
218 if ( is_centralized && scatter )
230 if ( !is_centralized && !scatter )
244 (void)is_centralized;
292 const char *filename,
340 const char *filename,
344 spm, MPI_COMM_WORLD );
enum spm_driver_e spm_driver_t
The list of matrix driver readers and generators.
int spmGather(const spmatrix_t *spm_scattered, int root, spmatrix_t *opt_spm_gathered)
Gather a distributed Sparse Matrix on a single node.
void spmExit(spmatrix_t *spm)
Cleanup the spm structure but do not free the spm pointer.
int spmLoad(spmatrix_t *spm, const char *filename)
Load the spm structure from a file (internal format).
void spmUpdateComputedFields(spmatrix_t *spm)
Update all the computed fields based on the static values stored.
int spmScatter(spmatrix_t *spm_scattered, int root, const spmatrix_t *opt_spm_gathered, spm_int_t opt_n, const spm_int_t *opt_loc2glob, int opt_distByColumn, SPM_Comm opt_comm)
Scatter the SPM thanks to loc2glob.
int spm_int_t
The main integer datatype used in spm arrays.
void spmInitDist(spmatrix_t *spm, SPM_Comm comm)
Init the spm structure with a specific communicator.
int spmReadDriver(spm_driver_t driver, const char *filename, spmatrix_t *spm)
Import a matrix file into a spm structure.
static int spm_read_driver(int scatter, spm_driver_t driver, const char *filename, spmatrix_t *spm, SPM_Comm comm)
Import a matrix file into a spm structure for a specific communicator.
int spmReadDriverDist(spm_driver_t driver, const char *filename, spmatrix_t *spm, SPM_Comm comm)
Import a matrix file into an spm structure for a specific communicator.
The sparse matrix data structure.
int genExtendedLaplacian(const char *filename, spmatrix_t *spm)
Generate a extended Laplacian of size spm->n.
int genLaplacian(const char *filename, spmatrix_t *spm)
Generate a Laplacian of size spm->n.
static int spm_read_scotch(const char *filename, spmatrix_t *spm)
Import a sparse matrix from a Scotch data file.