Search in sources :

Example 1 with PardisoSolver

use of maspack.solvers.PardisoSolver in project artisynth_core by artisynth.

the class BusyThread method main.

public static void main(String[] args) {
    Vector<SparseElement> sparseMatrix = new Vector<SparseElement>();
    int pardisoMatSize = 0, pardisoNumVals = 5;
    double[] ra = null;
    int[] ia = null;
    int[] ja = null;
    VectorNd bsol = new VectorNd(0);
    VectorNd vsol = new VectorNd(0);
    pardisoNumVals = importSparseMatrix("lib/Xmat325.txt", sparseMatrix, pardisoMatSize);
    pardisoMatSize = nDia;
    ia = new int[pardisoMatSize + 2];
    ra = new double[(int) (nonZeroVactor * pardisoNumVals)];
    ja = new int[(int) (nonZeroVactor * pardisoNumVals)];
    sym = true;
    pardisoNumVals = sparse_2_pardiso(sparseMatrix, pardisoNumVals, ra, ia, ja);
    // int size = pardisoNumVals;
    // System.out.println("[");
    // for (int i = 0; i < size; i++)
    // {
    // System.out.print(ra[i] +",");
    // if (i%10 == 9)
    // System.out.println();
    // }
    // System.out.println("]");
    PardisoSolver pardiso = new PardisoSolver();
    System.out.println("pardisoMatSize:" + pardisoMatSize);
    System.out.println("pardisoNumVals:" + pardisoNumVals);
    System.out.println("ra.length:" + ra.length);
    System.out.println("ia.length:" + ia.length);
    System.out.println("ja.length:" + ja.length);
    vsol.setSize(pardisoMatSize);
    bsol.setSize(pardisoMatSize);
    for (int i = 0; i < pardisoMatSize; i++) {
        bsol.set(i, i % 4);
    }
    pardiso.analyze(ra, ja, ia, pardisoMatSize, Matrix.SYMMETRIC);
    BusyThread busy = new BusyThread();
    busy.start();
    for (int i = 0; i < 1000000; i++) {
        System.out.println(i + " factoring ...");
        pardiso.factor(ra);
        System.out.println("solving ...");
        pardiso.solve(vsol.getBuffer(), bsol.getBuffer());
    }
}
Also used : PardisoSolver(maspack.solvers.PardisoSolver) VectorNd(maspack.matrix.VectorNd) Vector(java.util.Vector)

Example 2 with PardisoSolver

use of maspack.solvers.PardisoSolver in project artisynth_core by artisynth.

the class Main method fixPardisoThreadCountHack.

/**
 * On Windows, we have sometimes seen that Pardiso getNumThreads() needs to
 * be called early, or otherwise the maximum number of threads returned by
 * mkl_get_max_threads() becomes fixed at 1. In particular, we seem to have
 * to do this before models are loaded.
 */
private static void fixPardisoThreadCountHack() {
    PardisoSolver solver = new PardisoSolver();
    solver.getNumThreads();
    solver.dispose();
}
Also used : PardisoSolver(maspack.solvers.PardisoSolver)

Example 3 with PardisoSolver

use of maspack.solvers.PardisoSolver in project artisynth_core by artisynth.

the class Main method exit.

/**
 * Have our own exit method so that if we're running under matlab, we don't
 * actually exit.
 */
public static void exit(int code) {
    File testForFglrxDriver = new File("/var/lib/dkms/fglrx/8.911");
    if (testForFglrxDriver.exists()) {
        // this version of the FGLRX driver has a bug that causes the JVM to
        // crash in XQueryExtension on exit, so instead we exit directly.
        System.out.println("Fglrx driver detected; exiting directly");
        PardisoSolver solver = new PardisoSolver();
        solver.systemExit(code);
    } else if (myRunningUnderMatlab) {
    // throw new IllegalArgumentException ("Quit");
    } else {
        System.exit(code);
    }
}
Also used : PardisoSolver(maspack.solvers.PardisoSolver) File(java.io.File)

Aggregations

PardisoSolver (maspack.solvers.PardisoSolver)3 File (java.io.File)1 Vector (java.util.Vector)1 VectorNd (maspack.matrix.VectorNd)1