你已经派生过 em3d-mt
镜像自地址
https://gitee.com/sduem/em3d-mt.git
已同步 2025-08-03 03:16:52 +08:00
89
README.md
89
README.md
@@ -67,94 +67,5 @@ mex -largeArrayDims -L'PATH\TO\YOUR \Pardiso\panua-pardiso-20230718-win\lib' -ll
|
||||
|
||||
Ubuntu:Refer to the official README provided in the Panua-Pardiso package.
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Copyright (C) 2022 until present, by Panua Technologies Sagl, Switzerland. All Rights Reserved.
|
||||
Interface between the Panua-Pardiso 8.0 solver and Matlab.
|
||||
This program can be downloaded from the following site: http://www.panua.ch
|
||||
The above copyright and permission notice must appear in all partial and complete copies of this file.
|
||||
***********************************************************************************************************************/
|
||||
------------
|
||||
INSTALLATION
|
||||
------------
|
||||
This interface for Panua-Pardiso was created using the Matlab external ('mex') interface. For more information on mex, consult
|
||||
the MathWorks website at https://www.mathworks.com/help/matlab/call-mex-file-functions.html. In order to use this interface in
|
||||
Matlab, you will first have to configure mex on your system. This can be done by typing in the Matlab command line
|
||||
|
||||
>> mex -setup
|
||||
|
||||
The easiest way to install the interface is to use the provided Makefile and type in the command line
|
||||
$ make all
|
||||
To remove all mex executables type in the command line
|
||||
$ make clean
|
||||
The provided interface is currently compatible with Linux users. The Makefile specifies four variables
|
||||
that you might need to adapt according to your system setup. These are
|
||||
1. MEXSUFFIX: the suffix appended to the MEX files on your system. For more information type in the Matlab command line
|
||||
>> ext = mexext
|
||||
or visit https://mathworks.com/help/matlab/ref/mexext.html
|
||||
2. MEX: the mex executable located somewhere within your MATLAB installation directory.
|
||||
3. CXX: your C++ compiler (executable).
|
||||
IMPORTANT: The linked C++ compiler must be compatible with your MATLAB installation. MathWorks keeps a detailed list of MATLAB
|
||||
software package versions and the compilers that are compatible with them here:
|
||||
https://mathworks.com/support/requirements/supported-compilers-linux.html.
|
||||
4. PARDISOHOME: the directory where the Pardiso shared library is located.
|
||||
SUGGESTED: your home directory "${HOME}".
|
||||
If you are not using the provided Makefile, you can compile file individually from the command line. The example below
|
||||
creates the mex executable pardisoinit.mexa64
|
||||
$ mex -cxx CXX=g++ CC=g++ LD=g++ -L\~\ -lpardiso -lmwlapack -lmwblas -lgfortran -lpthread -lm -output pardisoinit common.cpp
|
||||
matlabmatrix.cpp sparsematrix.cpp pardisoinfo.cpp pardisoinit.cpp
|
||||
Depending on your system setup you may need to include other flags, such as -largeArrayDims.
|
||||
------------
|
||||
CONTENTS
|
||||
------------
|
||||
├── common.h, .cpp # Commonly used mex check functions.
|
||||
├── matlabmatrix.h, .cpp # Functions to ensure the compatibility of Pardiso with Matlab matrices.
|
||||
├── pardisoinfo.h, .cpp # Available functionalities of the Pardiso solver.
|
||||
├── pardisoinit.cpp # Initialize the Pardiso data structures. Specify type of matrix, and solver. Produces executable.
|
||||
├── pardisoinit.mexa64
|
||||
├── pardisofree.cpp # Release memory associated with all internal Pardiso structures. Produces executable.
|
||||
├── pardisofree.mexa64
|
||||
├── pardisoreorder.cpp # Pardiso reordering (symbolic factorization) of sparse input matrix. Produces executable.
|
||||
├── pardisoreorder.mexa64
|
||||
├── pardisofactor.cpp # Numeric factorization of a sparse matrix. Produces executable.
|
||||
├── pardisofactor.mexa64
|
||||
├── pardisosolve.cpp # Pardiso solution for a system of equations. Produces executable.
|
||||
├── pardisosolve.mexa64
|
||||
├── example_complex.m # Using Pardiso on a sparse, symmetric, and complex matrix.
|
||||
├── example_hermitian.m # Using Pardiso on a sparse complex Hermitian positive definite matrix.
|
||||
├── example_symmetric.m # Using Pardiso on a sparse real and symmetric matrix.
|
||||
├── example_unsymmetrix.m # Using Pardiso on a sparse real and unsymmetric matrix.
|
||||
------------
|
||||
NOTES
|
||||
------------
|
||||
1. Discrepancy in OMP version used.
|
||||
A common error with mex files is the version of OMP that is statically linked to the program. This error would appear
|
||||
after executing the mex file and would read:
|
||||
|
||||
>> OMP: Error #15: Initializing libiomp5.a, but found libiomp5.so already initialized.
|
||||
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program.
|
||||
That is dangerous, since it can degrade performance or cause incorrect results.
|
||||
To work around this issue set the environment variable KMP_DUPLICATE_LIB_OK to TRUE, in order to allow the program
|
||||
to continue its execution. In the Matlab command line this is achieved by typing
|
||||
>> setenv("KMP_DUPLICATE_LIB_OK","TRUE")
|
||||
2. Controlling the number of available cores.
|
||||
The safest way to control the number of cores is by setting the environment variable in the command line, e.g.,
|
||||
$ export OMP_NUM_THREADS=16
|
||||
and then executing Matlab from the same terminal session/window. To check that the number of cores is set
|
||||
correctly, either use
|
||||
|
||||
>> verbose = true;
|
||||
in your code, or print out the value of (after Pardiso has been initialized)
|
||||
>> fprintf('Number of cores %d',info.iparm(3));
|
||||
It always recommended to control the parallel execution of the solver by explicitly setting OMP_NUM_THREADS. If fewer
|
||||
processors are available than specified, the execution may slow down instead of speeding up.
|
||||
Note that the number of threads that can be utilized by Pardiso is bounded by the maximum number of threads
|
||||
allowed by your Panua licence. For more information visit http://www.panua.ch/pardiso.
|
||||
------------
|
||||
MISC
|
||||
------------
|
||||
- The mex interface was first developed by Peter Carbonetto, UBC Vancouver, October 2009. Adapted and modified
|
||||
by Dimosthenis Pasadakis, Panua-Technologies, January 2024.
|
||||
|
||||
|
||||
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户