mld2p4-2:
configure.ac configure mlprec/Makefile mlprec/impl/Makefile mlprec/impl/level/mld_c_base_onelev_build.f90 mlprec/impl/level/mld_c_base_onelev_check.f90 mlprec/impl/level/mld_c_base_onelev_csetc.f90 mlprec/impl/level/mld_c_base_onelev_cseti.F90 mlprec/impl/level/mld_c_base_onelev_csetr.f90 mlprec/impl/level/mld_c_base_onelev_setc.f90 mlprec/impl/level/mld_c_base_onelev_seti.F90 mlprec/impl/level/mld_c_base_onelev_setr.f90 mlprec/impl/level/mld_c_base_onelev_setsm.F90 mlprec/impl/level/mld_c_base_onelev_setsv.F90 mlprec/impl/level/mld_d_base_onelev_build.f90 mlprec/impl/level/mld_d_base_onelev_check.f90 mlprec/impl/level/mld_d_base_onelev_csetc.f90 mlprec/impl/level/mld_d_base_onelev_cseti.F90 mlprec/impl/level/mld_d_base_onelev_csetr.f90 mlprec/impl/level/mld_d_base_onelev_setc.f90 mlprec/impl/level/mld_d_base_onelev_seti.F90 mlprec/impl/level/mld_d_base_onelev_setr.f90 mlprec/impl/level/mld_d_base_onelev_setsm.F90 mlprec/impl/level/mld_d_base_onelev_setsv.F90 mlprec/impl/level/mld_s_base_onelev_build.f90 mlprec/impl/level/mld_s_base_onelev_check.f90 mlprec/impl/level/mld_s_base_onelev_csetc.f90 mlprec/impl/level/mld_s_base_onelev_cseti.F90 mlprec/impl/level/mld_s_base_onelev_csetr.f90 mlprec/impl/level/mld_s_base_onelev_setc.f90 mlprec/impl/level/mld_s_base_onelev_seti.F90 mlprec/impl/level/mld_s_base_onelev_setr.f90 mlprec/impl/level/mld_s_base_onelev_setsm.F90 mlprec/impl/level/mld_s_base_onelev_setsv.F90 mlprec/impl/level/mld_z_base_onelev_build.f90 mlprec/impl/level/mld_z_base_onelev_check.f90 mlprec/impl/level/mld_z_base_onelev_csetc.f90 mlprec/impl/level/mld_z_base_onelev_cseti.F90 mlprec/impl/level/mld_z_base_onelev_csetr.f90 mlprec/impl/level/mld_z_base_onelev_setc.f90 mlprec/impl/level/mld_z_base_onelev_seti.F90 mlprec/impl/level/mld_z_base_onelev_setr.f90 mlprec/impl/level/mld_z_base_onelev_setsm.F90 mlprec/impl/level/mld_z_base_onelev_setsv.F90 mlprec/impl/mld_c_extprol_bld.f90 mlprec/impl/mld_c_hierarchy_bld.f90 mlprec/impl/mld_c_lev_aggrmap_bld.f90 mlprec/impl/mld_c_lev_aggrmat_asb.f90 mlprec/impl/mld_c_smoothers_bld.f90 mlprec/impl/mld_caggrmat_asb.f90 mlprec/impl/mld_caggrmat_biz_asb.f90 mlprec/impl/mld_caggrmat_smth_asb.f90 mlprec/impl/mld_ccprecset.F90 mlprec/impl/mld_cmlprec_aply.f90 mlprec/impl/mld_cmlprec_bld.f90 mlprec/impl/mld_cprecaply.f90 mlprec/impl/mld_cprecbld.f90 mlprec/impl/mld_cprecinit.F90 mlprec/impl/mld_cprecset.F90 mlprec/impl/mld_cslud_interface.c mlprec/impl/mld_d_extprol_bld.f90 mlprec/impl/mld_d_hierarchy_bld.f90 mlprec/impl/mld_d_lev_aggrmap_bld.f90 mlprec/impl/mld_d_lev_aggrmat_asb.f90 mlprec/impl/mld_d_smoothers_bld.f90 mlprec/impl/mld_daggrmat_asb.f90 mlprec/impl/mld_daggrmat_biz_asb.f90 mlprec/impl/mld_daggrmat_smth_asb.f90 mlprec/impl/mld_dcprecset.F90 mlprec/impl/mld_dmlprec_aply.f90 mlprec/impl/mld_dmlprec_bld.f90 mlprec/impl/mld_dprecaply.f90 mlprec/impl/mld_dprecbld.f90 mlprec/impl/mld_dprecinit.F90 mlprec/impl/mld_dprecset.F90 mlprec/impl/mld_s_extprol_bld.f90 mlprec/impl/mld_s_hierarchy_bld.f90 mlprec/impl/mld_s_lev_aggrmap_bld.f90 mlprec/impl/mld_s_lev_aggrmat_asb.f90 mlprec/impl/mld_s_smoothers_bld.f90 mlprec/impl/mld_saggrmat_asb.f90 mlprec/impl/mld_saggrmat_biz_asb.f90 mlprec/impl/mld_saggrmat_smth_asb.f90 mlprec/impl/mld_scprecset.F90 mlprec/impl/mld_smlprec_aply.f90 mlprec/impl/mld_smlprec_bld.f90 mlprec/impl/mld_sprecaply.f90 mlprec/impl/mld_sprecbld.f90 mlprec/impl/mld_sprecinit.F90 mlprec/impl/mld_sprecset.F90 mlprec/impl/mld_sslud_interface.c mlprec/impl/mld_z_extprol_bld.f90 mlprec/impl/mld_z_hierarchy_bld.f90 mlprec/impl/mld_z_lev_aggrmap_bld.f90 mlprec/impl/mld_z_lev_aggrmat_asb.f90 mlprec/impl/mld_z_smoothers_bld.f90 mlprec/impl/mld_zaggrmat_asb.f90 mlprec/impl/mld_zaggrmat_biz_asb.f90 mlprec/impl/mld_zaggrmat_smth_asb.f90 mlprec/impl/mld_zcprecset.F90 mlprec/impl/mld_zmlprec_aply.f90 mlprec/impl/mld_zmlprec_bld.f90 mlprec/impl/mld_zprecaply.f90 mlprec/impl/mld_zprecbld.f90 mlprec/impl/mld_zprecinit.F90 mlprec/impl/mld_zprecset.F90 mlprec/impl/smoother/mld_c_as_smoother_bld.f90 mlprec/impl/smoother/mld_c_base_smoother_bld.f90 mlprec/impl/smoother/mld_c_jac_smoother_bld.f90 mlprec/impl/smoother/mld_d_as_smoother_bld.f90 mlprec/impl/smoother/mld_d_base_smoother_bld.f90 mlprec/impl/smoother/mld_d_jac_smoother_bld.f90 mlprec/impl/smoother/mld_s_as_smoother_bld.f90 mlprec/impl/smoother/mld_s_base_smoother_bld.f90 mlprec/impl/smoother/mld_s_jac_smoother_bld.f90 mlprec/impl/smoother/mld_z_as_smoother_bld.f90 mlprec/impl/smoother/mld_z_base_smoother_bld.f90 mlprec/impl/smoother/mld_z_jac_smoother_bld.f90 mlprec/impl/solver/mld_c_base_solver_bld.f90 mlprec/impl/solver/mld_c_bwgs_solver_bld.f90 mlprec/impl/solver/mld_c_diag_solver_bld.f90 mlprec/impl/solver/mld_c_gs_solver_bld.f90 mlprec/impl/solver/mld_c_ilu_solver_bld.f90 mlprec/impl/solver/mld_c_mumps_solver_bld.F90 mlprec/impl/solver/mld_d_base_solver_bld.f90 mlprec/impl/solver/mld_d_bwgs_solver_bld.f90 mlprec/impl/solver/mld_d_diag_solver_bld.f90 mlprec/impl/solver/mld_d_gs_solver_bld.f90 mlprec/impl/solver/mld_d_ilu_solver_bld.f90 mlprec/impl/solver/mld_d_mumps_solver_bld.F90 mlprec/impl/solver/mld_s_base_solver_bld.f90 mlprec/impl/solver/mld_s_bwgs_solver_bld.f90 mlprec/impl/solver/mld_s_diag_solver_bld.f90 mlprec/impl/solver/mld_s_gs_solver_bld.f90 mlprec/impl/solver/mld_s_ilu_solver_bld.f90 mlprec/impl/solver/mld_s_mumps_solver_bld.F90 mlprec/impl/solver/mld_z_base_solver_bld.f90 mlprec/impl/solver/mld_z_bwgs_solver_bld.f90 mlprec/impl/solver/mld_z_diag_solver_bld.f90 mlprec/impl/solver/mld_z_gs_solver_bld.f90 mlprec/impl/solver/mld_z_ilu_solver_bld.f90 mlprec/impl/solver/mld_z_mumps_solver_bld.F90 mlprec/mld_base_prec_type.F90 mlprec/mld_c_as_smoother.f90 mlprec/mld_c_base_smoother_mod.f90 mlprec/mld_c_base_solver_mod.f90 mlprec/mld_c_diag_solver.f90 mlprec/mld_c_gs_solver.f90 mlprec/mld_c_id_solver.f90 mlprec/mld_c_ilu_solver.f90 mlprec/mld_c_jac_smoother.f90 mlprec/mld_c_mumps_solver.F90 mlprec/mld_c_onelev_mod.f90 mlprec/mld_c_prec_type.f90 mlprec/mld_c_slu_solver.F90 mlprec/mld_c_sludist_solver.F90 mlprec/mld_d_as_smoother.f90 mlprec/mld_d_base_smoother_mod.f90 mlprec/mld_d_base_solver_mod.f90 mlprec/mld_d_diag_solver.f90 mlprec/mld_d_gs_solver.f90 mlprec/mld_d_id_solver.f90 mlprec/mld_d_ilu_solver.f90 mlprec/mld_d_jac_smoother.f90 mlprec/mld_d_mumps_solver.F90 mlprec/mld_d_onelev_mod.f90 mlprec/mld_d_prec_type.f90 mlprec/mld_d_slu_solver.F90 mlprec/mld_d_sludist_solver.F90 mlprec/mld_d_umf_solver.F90 mlprec/mld_s_as_smoother.f90 mlprec/mld_s_base_smoother_mod.f90 mlprec/mld_s_base_solver_mod.f90 mlprec/mld_s_diag_solver.f90 mlprec/mld_s_gs_solver.f90 mlprec/mld_s_id_solver.f90 mlprec/mld_s_ilu_solver.f90 mlprec/mld_s_jac_smoother.f90 mlprec/mld_s_mumps_solver.F90 mlprec/mld_s_onelev_mod.f90 mlprec/mld_s_prec_type.f90 mlprec/mld_s_slu_solver.F90 mlprec/mld_s_sludist_solver.F90 mlprec/mld_z_as_smoother.f90 mlprec/mld_z_base_smoother_mod.f90 mlprec/mld_z_base_solver_mod.f90 mlprec/mld_z_diag_solver.f90 mlprec/mld_z_gs_solver.f90 mlprec/mld_z_id_solver.f90 mlprec/mld_z_ilu_solver.f90 mlprec/mld_z_jac_smoother.f90 mlprec/mld_z_mumps_solver.F90 mlprec/mld_z_onelev_mod.f90 mlprec/mld_z_prec_type.f90 mlprec/mld_z_slu_solver.F90 mlprec/mld_z_sludist_solver.F90 mlprec/mld_z_umf_solver.F90 tests/pdegen/Makefile tests/pdegen/mld_d_pde2d.f90 tests/pdegen/mld_d_pde3d.f90 tests/pdegen/mld_s_pde2d.f90 tests/pdegen/mld_s_pde3d.f90 Further merge changes from fixprec branch.stopcriterion
parent
7cd509730b
commit
a28f9ff872
@ -1,356 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* MLD2P4 version 2.0
|
||||
* MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
* based on PSBLAS (Parallel Sparse BLAS version 3.3)
|
||||
*
|
||||
* (C) Copyright 2008, 2010, 2012, 2015, 2017
|
||||
*
|
||||
* Salvatore Filippone Cranfield University
|
||||
* Ambra Abdullahi Hassan University of Rome Tor Vergata
|
||||
* Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
* Pasqua D'Ambra ICAR-CNR, Naples
|
||||
* Daniela di Serafino University of Campania "L. Vanvitelli", Caserta
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions, and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the MLD2P4 group or the names of its contributors may
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without specific written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* File: mld_cslud_interface.c
|
||||
*
|
||||
* Functions: mld_csludist_fact, mld_csludist_solve, mld_csludist_free.
|
||||
*
|
||||
* This file is an interface to the SuperLU_dist routines for sparse factorization and
|
||||
* solve. It was obtained by modifying the c_fortran_zgssv.c file from the SuperLU_dist
|
||||
* source distribution; original copyright terms are reproduced below.
|
||||
*
|
||||
*/
|
||||
|
||||
/* =====================
|
||||
|
||||
Copyright (c) 2003, The Regents of the University of California, through
|
||||
Lawrence Berkeley National Laboratory (subject to receipt of any required
|
||||
approvals from U.S. Dept. of Energy)
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
(1) Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
(2) Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
(3) Neither the name of Lawrence Berkeley National Laboratory, U.S. Dept. of
|
||||
Energy nor the names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* -- Distributed SuperLU routine (version 2.0) --
|
||||
* Lawrence Berkeley National Lab, Univ. of California Berkeley.
|
||||
* March 15, 2003
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* as of v 3.3 SLUDist does not have a single precision interface */
|
||||
#ifdef Have_SLUDist_
|
||||
#undef Have_SLUDist_
|
||||
#endif
|
||||
|
||||
#ifdef Have_SLUDist_
|
||||
#include <math.h>
|
||||
#include "superlu_zdefs.h"
|
||||
|
||||
#define HANDLE_SIZE 8
|
||||
|
||||
typedef struct {
|
||||
SuperMatrix *A;
|
||||
LUstruct_t *LUstruct;
|
||||
gridinfo_t *grid;
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
} factors_t;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int mld_csludist_fact(int n, int nl, int nnzl, int ffstr,
|
||||
#ifdef Have_SLUDist_
|
||||
complex *values, int *rowptr, int *colind,
|
||||
void **f_factors,
|
||||
#else
|
||||
void *values, int *rowptr, int *colind,
|
||||
void **f_factors,
|
||||
#endif
|
||||
int nprow, int npcol)
|
||||
|
||||
{
|
||||
/*
|
||||
* This routine can be called from Fortran.
|
||||
* performs LU decomposition.
|
||||
*
|
||||
* f_factors (input/output) void**
|
||||
* On output contains the pointer pointing to
|
||||
* the structure of the factored matrices.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef Have_SLUDist_
|
||||
SuperMatrix *A;
|
||||
NRformat_loc *Astore;
|
||||
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
LUstruct_t *LUstruct;
|
||||
SOLVEstruct_t SOLVEstruct;
|
||||
gridinfo_t *grid;
|
||||
int i, panel_size, permc_spec, relax, info;
|
||||
trans_t trans;
|
||||
float drop_tol = 0.0,berr[1];
|
||||
mem_usage_t mem_usage;
|
||||
superlu_options_t options;
|
||||
SuperLUStat_t stat;
|
||||
factors_t *LUfactors;
|
||||
int fst_row;
|
||||
int *icol,*irpt;
|
||||
complex *ival,b[1];
|
||||
|
||||
trans = NOTRANS;
|
||||
grid = (gridinfo_t *) SUPERLU_MALLOC(sizeof(gridinfo_t));
|
||||
superlu_gridinit(MPI_COMM_WORLD, nprow, npcol, grid);
|
||||
/* Initialize the statistics variables. */
|
||||
PStatInit(&stat);
|
||||
fst_row = (ffstr);
|
||||
|
||||
A = (SuperMatrix *) malloc(sizeof(SuperMatrix));
|
||||
zCreate_CompRowLoc_Matrix_dist(A, n, n, nnzl, nl, fst_row,
|
||||
values, colind, rowptr,
|
||||
SLU_NR_loc, SLU_Z, SLU_GE);
|
||||
|
||||
/* Initialize ScalePermstruct and LUstruct. */
|
||||
ScalePermstruct = (ScalePermstruct_t *) SUPERLU_MALLOC(sizeof(ScalePermstruct_t));
|
||||
LUstruct = (LUstruct_t *) SUPERLU_MALLOC(sizeof(LUstruct_t));
|
||||
ScalePermstructInit(n,n, ScalePermstruct);
|
||||
#if defined(SLUD_VERSION_4)
|
||||
LUstructInit(n, LUstruct);
|
||||
#elif defined(SLUD_VERSION_3)
|
||||
LUstructInit(n,n, LUstruct);
|
||||
#else
|
||||
choke_on_me;
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the default input options. */
|
||||
set_default_options_dist(&options);
|
||||
options.IterRefine=NO;
|
||||
options.PrintStat=NO;
|
||||
|
||||
pzgssvx(&options, A, ScalePermstruct, b, nl, 0,
|
||||
grid, LUstruct, &SOLVEstruct, berr, &stat, &info);
|
||||
|
||||
if ( info == 0 ) {
|
||||
;
|
||||
} else {
|
||||
printf("pzgssvx() error returns INFO= %d\n", info);
|
||||
if ( info <= n ) { /* factorization completes */
|
||||
;
|
||||
}
|
||||
}
|
||||
if (options.SolveInitialized) {
|
||||
zSolveFinalize(&options,&SOLVEstruct);
|
||||
}
|
||||
|
||||
|
||||
/* Save the LU factors in the factors handle */
|
||||
LUfactors = (factors_t *) SUPERLU_MALLOC(sizeof(factors_t));
|
||||
LUfactors->LUstruct = LUstruct;
|
||||
LUfactors->grid = grid;
|
||||
LUfactors->A = A;
|
||||
LUfactors->ScalePermstruct = ScalePermstruct;
|
||||
/* fprintf(stderr,"slud factor: LUFactors %p \n",LUfactors); */
|
||||
/* fprintf(stderr,"slud factor: A %p %p\n",A,LUfactors->A); */
|
||||
/* fprintf(stderr,"slud factor: grid %p %p\n",grid,LUfactors->grid); */
|
||||
/* fprintf(stderr,"slud factor: LUstruct %p %p\n",LUstruct,LUfactors->LUstruct); */
|
||||
*f_factors = (void *) LUfactors;
|
||||
PStatFree(&stat);
|
||||
return(info);
|
||||
#else
|
||||
fprintf(stderr," SLUDist does not have single precision, sorry.\n");
|
||||
return(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int mld_csludist_solve(int itrans, int n, int nrhs,
|
||||
#ifdef Have_SLUDist_
|
||||
complex *b,
|
||||
#else
|
||||
void *b,
|
||||
#endif
|
||||
int ldb, void *f_factors)
|
||||
|
||||
{
|
||||
/*
|
||||
* This routine can be called from Fortran.
|
||||
* performs triangular solve
|
||||
*
|
||||
*/
|
||||
#ifdef Have_SLUDist_
|
||||
SuperMatrix *A;
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
LUstruct_t *LUstruct;
|
||||
SOLVEstruct_t SOLVEstruct;
|
||||
gridinfo_t *grid;
|
||||
int i, panel_size, permc_spec, relax, info;
|
||||
trans_t trans;
|
||||
float drop_tol = 0.0;
|
||||
float *berr;
|
||||
mem_usage_t mem_usage;
|
||||
superlu_options_t options;
|
||||
SuperLUStat_t stat;
|
||||
factors_t *LUfactors;
|
||||
|
||||
LUfactors = (factors_t *) f_factors ;
|
||||
A = LUfactors->A ;
|
||||
LUstruct = LUfactors->LUstruct ;
|
||||
grid = LUfactors->grid ;
|
||||
|
||||
ScalePermstruct = LUfactors->ScalePermstruct;
|
||||
/* fprintf(stderr,"slud solve: LUFactors %p \n",LUfactors); */
|
||||
/* fprintf(stderr,"slud solve: A %p %p\n",A,LUfactors->A); */
|
||||
/* fprintf(stderr,"slud solve: grid %p %p\n",grid,LUfactors->grid); */
|
||||
/* fprintf(stderr,"slud solve: LUstruct %p %p\n",LUstruct,LUfactors->LUstruct); */
|
||||
|
||||
|
||||
if (itrans == 0) {
|
||||
trans = NOTRANS;
|
||||
} else if (itrans ==1) {
|
||||
trans = TRANS;
|
||||
} else if (itrans ==2) {
|
||||
trans = CONJ;
|
||||
} else {
|
||||
trans = NOTRANS;
|
||||
}
|
||||
|
||||
/* fprintf(stderr,"Entry to sludist_solve\n"); */
|
||||
berr = (float *) malloc((nrhs) *sizeof(float));
|
||||
|
||||
/* Initialize the statistics variables. */
|
||||
PStatInit(&stat);
|
||||
|
||||
/* Set the default input options. */
|
||||
set_default_options_dist(&options);
|
||||
options.IterRefine = NO;
|
||||
options.Fact = FACTORED;
|
||||
options.PrintStat = NO;
|
||||
|
||||
pzgssvx(&options, A, ScalePermstruct, b, ldb, nrhs,
|
||||
grid, LUstruct, &SOLVEstruct, berr, &stat, &info);
|
||||
|
||||
/* fprintf(stderr,"Float check: after solve %d %lf\n",*info,berr[0]); */
|
||||
if (options.SolveInitialized) {
|
||||
zSolveFinalize(&options,&SOLVEstruct);
|
||||
}
|
||||
PStatFree(&stat);
|
||||
free(berr);
|
||||
return(info);
|
||||
#else
|
||||
fprintf(stderr," SLUDist does not have single precision, sorry.\n");
|
||||
return(-1);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
int mld_csludist_free(void *f_factors)
|
||||
{
|
||||
/*
|
||||
* This routine can be called from Fortran.
|
||||
*
|
||||
* free all storage in the end
|
||||
*
|
||||
*/
|
||||
#ifdef Have_SLUDist_
|
||||
SuperMatrix *A;
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
LUstruct_t *LUstruct;
|
||||
SOLVEstruct_t SOLVEstruct;
|
||||
gridinfo_t *grid;
|
||||
int i, panel_size, permc_spec, relax;
|
||||
trans_t trans;
|
||||
float drop_tol = 0.0;
|
||||
float *berr;
|
||||
mem_usage_t mem_usage;
|
||||
superlu_options_t options;
|
||||
SuperLUStat_t stat;
|
||||
factors_t *LUfactors;
|
||||
|
||||
|
||||
if (f_factors == NULL)
|
||||
return(0);
|
||||
LUfactors = (factors_t *) f_factors ;
|
||||
A = LUfactors->A ;
|
||||
LUstruct = LUfactors->LUstruct ;
|
||||
grid = LUfactors->grid ;
|
||||
ScalePermstruct = LUfactors->ScalePermstruct;
|
||||
|
||||
// Memory leak: with SuperLU_Dist 3.3
|
||||
// we either have a leak or a segfault here.
|
||||
// To be investigated further.
|
||||
//Destroy_CompRowLoc_Matrix_dist(A);
|
||||
ScalePermstructFree(ScalePermstruct);
|
||||
LUstructFree(LUstruct);
|
||||
superlu_gridexit(grid);
|
||||
|
||||
free(grid);
|
||||
free(LUstruct);
|
||||
free(LUfactors);
|
||||
return(0);
|
||||
|
||||
#else
|
||||
fprintf(stderr," SLUDist does not have single precision, sorry.\n");
|
||||
return(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,345 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* MLD2P4 version 2.0
|
||||
* MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
* based on PSBLAS (Parallel Sparse BLAS version 3.3)
|
||||
*
|
||||
* (C) Copyright 2008, 2010, 2012, 2015, 2017
|
||||
*
|
||||
* Salvatore Filippone Cranfield University
|
||||
* Ambra Abdullahi Hassan University of Rome Tor Vergata
|
||||
* Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
* Pasqua D'Ambra ICAR-CNR, Naples
|
||||
* Daniela di Serafino University of Campania "L. Vanvitelli", Caserta
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions, and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the MLD2P4 group or the names of its contributors may
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without specific written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* File: mld_slud_interface.c
|
||||
*
|
||||
* Functions: mld_ssludist_fact, mld_ssludist_solve, mld_ssludist_free.
|
||||
*
|
||||
* This file is an interface to the SuperLU_dist routines for sparse factorization and
|
||||
* solve. It was obtained by modifying the c_fortran_dgssv.c file from the SuperLU_dist
|
||||
* source distribution; original copyright terms are reproduced below.
|
||||
*
|
||||
*/
|
||||
|
||||
/* =====================
|
||||
|
||||
Copyright (c) 2003, The Regents of the University of California, through
|
||||
Lawrence Berkeley National Laboratory (subject to receipt of any required
|
||||
approvals from U.S. Dept. of Energy)
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
(1) Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
(2) Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
(3) Neither the name of Lawrence Berkeley National Laboratory, U.S. Dept. of
|
||||
Energy nor the names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* -- Distributed SuperLU routine (version 2.0) --
|
||||
* Lawrence Berkeley National Lab, Univ. of California Berkeley.
|
||||
* March 15, 2003
|
||||
*
|
||||
*/
|
||||
|
||||
/* as of v 3.3 SLUDist does not have a single precision interface */
|
||||
#ifdef Have_SLUDist_
|
||||
#undef Have_SLUDist_
|
||||
#endif
|
||||
|
||||
#ifdef Have_SLUDist_
|
||||
#include <math.h>
|
||||
#include "superlu_sdefs.h"
|
||||
|
||||
#define HANDLE_SIZE 8
|
||||
|
||||
typedef struct {
|
||||
SuperMatrix *A;
|
||||
LUstruct_t *LUstruct;
|
||||
gridinfo_t *grid;
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
} factors_t;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int mld_ssludist_fact(int n, int nl, int nnzl, int ffstr,
|
||||
float *values, int *rowptr, int *colind,
|
||||
void **f_factors, int nprow, int npcol)
|
||||
{
|
||||
/*
|
||||
* This routine can be called from Fortran.
|
||||
* performs LU decomposition.
|
||||
*
|
||||
* f_factors (input/output) void**
|
||||
* On output contains the pointer pointing to
|
||||
* the structure of the factored matrices.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef Have_SLUDist_
|
||||
SuperMatrix *A;
|
||||
NRformat_loc *Astore;
|
||||
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
LUstruct_t *LUstruct;
|
||||
SOLVEstruct_t SOLVEstruct;
|
||||
gridinfo_t *grid;
|
||||
int i, panel_size, permc_spec, relax, info;
|
||||
trans_t trans;
|
||||
float drop_tol = 0.0, b[1], berr[1];
|
||||
mem_usage_t mem_usage;
|
||||
superlu_options_t options;
|
||||
SuperLUStat_t stat;
|
||||
factors_t *LUfactors;
|
||||
int fst_row;
|
||||
int *icol,*irpt;
|
||||
float *ival;
|
||||
|
||||
trans = NOTRANS;
|
||||
grid = (gridinfo_t *) SUPERLU_MALLOC(sizeof(gridinfo_t));
|
||||
superlu_gridinit(MPI_COMM_WORLD, nprow, npcol, grid);
|
||||
/* Initialize the statistics variables. */
|
||||
PStatInit(&stat);
|
||||
fst_row = (ffstr);
|
||||
|
||||
A = (SuperMatrix *) malloc(sizeof(SuperMatrix));
|
||||
dCreate_CompRowLoc_Matrix_dist(A, n, n, nnzl, nl, fst_row,
|
||||
values, colind, rowptr,
|
||||
SLU_NR_loc, SLU_D, SLU_GE);
|
||||
|
||||
/* Initialize ScalePermstruct and LUstruct. */
|
||||
ScalePermstruct = (ScalePermstruct_t *) SUPERLU_MALLOC(sizeof(ScalePermstruct_t));
|
||||
LUstruct = (LUstruct_t *) SUPERLU_MALLOC(sizeof(LUstruct_t));
|
||||
ScalePermstructInit(n,n, ScalePermstruct);
|
||||
#if defined(SLUD_VERSION_4)
|
||||
LUstructInit(n, LUstruct);
|
||||
#elif defined(SLUD_VERSION_3)
|
||||
LUstructInit(n,n, LUstruct);
|
||||
#else
|
||||
choke_on_me;
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the default input options. */
|
||||
set_default_options_dist(&options);
|
||||
options.IterRefine=NO;
|
||||
options.PrintStat=NO;
|
||||
|
||||
pdgssvx(&options, A, ScalePermstruct, b, nl, 0,
|
||||
grid, LUstruct, &SOLVEstruct, berr, &stat, &info);
|
||||
|
||||
if ( info == 0 ) {
|
||||
;
|
||||
} else {
|
||||
printf("pdgssvx() error returns INFO= %d\n", info);
|
||||
if ( info <= n ) { /* factorization completes */
|
||||
;
|
||||
}
|
||||
}
|
||||
if (options.SolveInitialized) {
|
||||
dSolveFinalize(&options,&SOLVEstruct);
|
||||
}
|
||||
|
||||
|
||||
/* Save the LU factors in the factors handle */
|
||||
LUfactors = (factors_t *) SUPERLU_MALLOC(sizeof(factors_t));
|
||||
LUfactors->LUstruct = LUstruct;
|
||||
LUfactors->grid = grid;
|
||||
LUfactors->A = A;
|
||||
LUfactors->ScalePermstruct = ScalePermstruct;
|
||||
/* fprintf(stderr,"slud factor: LUFactors %p \n",LUfactors); */
|
||||
/* fprintf(stderr,"slud factor: A %p %p\n",A,LUfactors->A); */
|
||||
/* fprintf(stderr,"slud factor: grid %p %p\n",grid,LUfactors->grid); */
|
||||
/* fprintf(stderr,"slud factor: LUstruct %p %p\n",LUstruct,LUfactors->LUstruct); */
|
||||
*f_factors = (void *) LUfactors;
|
||||
PStatFree(&stat);
|
||||
return(info);
|
||||
#else
|
||||
fprintf(stderr," SLUDist does not have single precision, sorry.\n");
|
||||
return(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int mld_ssludist_solve(int itrans, int n, int nrhs,
|
||||
float *b, int ldb, void *f_factors)
|
||||
|
||||
{
|
||||
/*
|
||||
* This routine can be called from Fortran.
|
||||
* performs triangular solve
|
||||
*
|
||||
*/
|
||||
#ifdef Have_SLUDist_
|
||||
SuperMatrix *A;
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
LUstruct_t *LUstruct;
|
||||
SOLVEstruct_t SOLVEstruct;
|
||||
gridinfo_t *grid;
|
||||
int i, panel_size, permc_spec, relax, info;
|
||||
trans_t trans;
|
||||
float drop_tol = 0.0;
|
||||
float *berr;
|
||||
mem_usage_t mem_usage;
|
||||
superlu_options_t options;
|
||||
SuperLUStat_t stat;
|
||||
factors_t *LUfactors;
|
||||
|
||||
LUfactors = (factors_t *) f_factors ;
|
||||
A = LUfactors->A ;
|
||||
LUstruct = LUfactors->LUstruct ;
|
||||
grid = LUfactors->grid ;
|
||||
|
||||
ScalePermstruct = LUfactors->ScalePermstruct;
|
||||
fprintf(stderr,"slud solve: ldb %d n %d \n",ldb,n);
|
||||
/* fprintf(stderr,"slud solve: LUFactors %p \n",LUfactors); */
|
||||
/* fprintf(stderr,"slud solve: A %p %p\n",A,LUfactors->A); */
|
||||
/* fprintf(stderr,"slud solve: grid %p %p\n",grid,LUfactors->grid); */
|
||||
/* fprintf(stderr,"slud solve: LUstruct %p %p\n",LUstruct,LUfactors->LUstruct); */
|
||||
|
||||
|
||||
if (itrans == 0) {
|
||||
trans = NOTRANS;
|
||||
} else if (itrans ==1) {
|
||||
trans = TRANS;
|
||||
} else if (itrans ==2) {
|
||||
trans = CONJ;
|
||||
} else {
|
||||
trans = NOTRANS;
|
||||
}
|
||||
|
||||
/* fprintf(stderr,"Entry to sludist_solve\n"); */
|
||||
berr = (float *) malloc((nrhs) *sizeof(float));
|
||||
|
||||
/* Initialize the statistics variables. */
|
||||
PStatInit(&stat);
|
||||
|
||||
/* Set the default input options. */
|
||||
set_default_options_dist(&options);
|
||||
options.IterRefine = NO;
|
||||
options.Fact = FACTORED;
|
||||
options.PrintStat = NO;
|
||||
|
||||
pdgssvx(&options, A, ScalePermstruct, b, ldb, nrhs,
|
||||
grid, LUstruct, &SOLVEstruct, berr, &stat, &info);
|
||||
|
||||
/* fprintf(stderr,"Float check: after solve %d %lf\n",*info,berr[0]); */
|
||||
if (options.SolveInitialized) {
|
||||
dSolveFinalize(&options,&SOLVEstruct);
|
||||
}
|
||||
PStatFree(&stat);
|
||||
free(berr);
|
||||
return(info);
|
||||
#else
|
||||
fprintf(stderr," SLUDist does not have single precision, sorry.\n");
|
||||
return(-1);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
int mld_ssludist_free(void *f_factors)
|
||||
|
||||
|
||||
{
|
||||
/*
|
||||
* This routine can be called from Fortran.
|
||||
*
|
||||
* free all storage in the end
|
||||
*
|
||||
*/
|
||||
#ifdef Have_SLUDist_
|
||||
SuperMatrix *A;
|
||||
ScalePermstruct_t *ScalePermstruct;
|
||||
LUstruct_t *LUstruct;
|
||||
SOLVEstruct_t SOLVEstruct;
|
||||
gridinfo_t *grid;
|
||||
int i, panel_size, permc_spec, relax;
|
||||
trans_t trans;
|
||||
float drop_tol = 0.0;
|
||||
float *berr;
|
||||
mem_usage_t mem_usage;
|
||||
superlu_options_t options;
|
||||
SuperLUStat_t stat;
|
||||
factors_t *LUfactors;
|
||||
|
||||
|
||||
if (f_factors == NULL)
|
||||
return(0);
|
||||
LUfactors = (factors_t *) f_factors ;
|
||||
A = LUfactors->A ;
|
||||
LUstruct = LUfactors->LUstruct ;
|
||||
grid = LUfactors->grid ;
|
||||
ScalePermstruct = LUfactors->ScalePermstruct;
|
||||
|
||||
// Memory leak: with SuperLU_Dist 3.3
|
||||
// we either have a leak or a segfault here.
|
||||
// To be investigated further.
|
||||
//Destroy_CompRowLoc_Matrix_dist(A);
|
||||
ScalePermstructFree(ScalePermstruct);
|
||||
LUstructFree(LUstruct);
|
||||
superlu_gridexit(grid);
|
||||
|
||||
free(grid);
|
||||
free(LUstruct);
|
||||
free(LUfactors);
|
||||
return(0);
|
||||
|
||||
#else
|
||||
fprintf(stderr," SLUDist does not have single precision, sorry.\n");
|
||||
return(-1);
|
||||
#endif
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue