Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some symbols of ma57 in the dummy library libhsl #7

Open
amontoison opened this issue Jul 7, 2024 · 4 comments
Open

Add some symbols of ma57 in the dummy library libhsl #7

amontoison opened this issue Jul 7, 2024 · 4 comments
Assignees

Comments

@amontoison
Copy link
Member

amontoison commented Jul 7, 2024

Charlie Varanet recently released Uno, an optimization solver that can use MA57 as a linear solver.
However, just like GALAHAD, Uno needs the symbols of MA57 at compilation time (JuliaPackaging/Yggdrasil#8937).
We should add dummy subroutines for the following symbols so that users can rely on HSL_jll.jl as we do with Ipopt.jl and, in the near future, GALAHAD.jl:

ma57id_
ma57ad_
ma57bd_
ma57cd_
ma57dd_

I think the following code should be enough:

SUBROUTINE MA57ID()
END SUBROUTINE MA57ID

SUBROUTINE MA57AD()
END SUBROUTINE MA57AD

SUBROUTINE MA57BD()
END SUBROUTINE MA57BD

SUBROUTINE MA57CD()
END SUBROUTINE MA57CD

SUBROUTINE MA57DD()
END SUBROUTINE MA57DD

or do we need to provide dummy subroutines with all arguments?

cc @cvanaret @jfowkes @nimgould

@amontoison amontoison self-assigned this Jul 7, 2024
@nimgould
Copy link

nimgould commented Jul 7, 2024

My temptation would be to provide all dummy arguments so that compilers can check that the calls are correct. I didn't do this in the past for the HSL interfaces for GALAHAD as MA57 isn't called directly; hsl_ma57 is used instead. But, I have now changed this. Also, MA57 supports an additional call to MA57ED, so that should be added as well for completeness. Note that the GALAHAD dummy interface is generic, so you will need to remove the USE HSL_KINDS_real, ONLY: ip_, rp_ statements, and replace the calls to the preprocessor so that MA57IR -> MA57ID (etc) and INTEGER ( KIND = ip_ ) -> INTEGER and REAL ( KIND = rp_ ) -> DOUBLE PRECISION (yes, a step back in time!)

@amontoison
Copy link
Member Author

amontoison commented Jul 7, 2024

Thanks Nick!

I propose the following code:

SUBROUTINE MA57ID(CNTL, ICNTL)
    DOUBLE PRECISION CNTL(5)
    INTEGER ICNTL(20)
    RETURN
END SUBROUTINE MA57ID

SUBROUTINE MA57AD(N, NE, IRN, JCN, LKEEP, KEEP, IWORK, ICNTL, INFO, RINFO)
    INTEGER N, NE, IRN(NE), JCN(NE), IWORK(5*N), LKEEP, KEEP(LKEEP),
 &          ICNTL(20), INFO(40)
    DOUBLE PRECISION RINFO(20)
    RETURN
END SUBROUTINE MA57AD

SUBROUTINE MA57BD(N, NE, A, FACT, LFACT, IFACT, LIFACT,
 & LKEEP, KEEP, PPOS, ICNTL, CNTL, INFO, RINFO)
    INTEGER N, NE, LFACT, LIFACT, LKEEP
    DOUBLE PRECISION A(NE), FACT(LFACT), CNTL(5), RINFO(20)
    INTEGER IFACT(LIFACT), INFO(40), KEEP(LKEEP), PPOS(N), ICNTL(20)
    RETURN
END SUBROUTINE MA57BD

SUBROUTINE MA57CD(JOB, N, FACT, LFACT, IFACT, LIFACT, NRHS, RHS, LRHS, W,
 &                LW, IW1, ICNTL, INFO)
    INTEGER JOB, N, LFACT, LIFACT, NRHS, LRHS, LW
    DOUBLE PRECISION FACT(LFACT), RHS(LRHS, NRHS), W(LW)
    INTEGER IFACT(LIFACT), IW1(N), ICNTL(20), INFO(40)
    RETURN
END SUBROUTINE MA57CD

SUBROUTINE MA57DD(JOB, N, NE, A, IRN, JCN, FACT, LFACT, IFACT, LIFACT,
 &                RHS, X, RESID, W, IW, ICNTL, CNTL, INFO, RINFO)
    INTEGER JOB, N, NE, LFACT, LIFACT
    DOUBLE PRECISION A(NE), FACT(LFACT), RHS(N), X(N), RESID(N), CNTL(5)
    INTEGER IRN(NE), JCN(NE), IFACT(LIFACT), IW(N), ICNTL(20), INFO(40)
    DOUBLE PRECISION RINFO(20)
    DOUBLE PRECISION W(N, *)
    RETURN
END SUBROUTINE MA57DD

@cvanaret Do you need another modification such you can check if you have a dummy HSL routine or not in Uno?

@nimgould
Copy link

nimgould commented Jul 8, 2024

Alexis, as this is a fortran 77 code, everything has to start in column 7 (or beyond) except for the continuation (&) which must be in column 6. Also check the 72 column limit

@jfowkes
Copy link
Collaborator

jfowkes commented Jul 8, 2024

I would strongly encourage people to migrate to using the F90 HSL_MA57 wrapper, especially now that it has a C interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants