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

Interface routines for quadruple precision #378

Merged
merged 6 commits into from
Aug 24, 2024

Conversation

amontoison
Copy link
Member

@oscardssmith @RalphAS
Do you know what is the best way to provide a Vector of a Ref of Float128 to a Fortran routine?
The Fortran routines probably needs a Vector of Cfloat128, am I right?

@RalphAS
Copy link

RalphAS commented Aug 23, 2024

I've just used Ptr{Float128} in the signature list and Array{Float128} or RefValue{Float128} objects in the actual argument list of the ccall, and relied on the default conversion methods. But then I've only applied this to my own Fortran code which has use iso_c_binding and real(kind=C_FLOAT128).

Cfloat128 also seems to work for my library (changing only the Julia wrapper), with a simple

function Base.unsafe_convert(::Type{Ptr{Cfloat128}}, r::Base.RefValue{Float128})
    return Ptr{Cfloat128}(pointer_from_objref(r))
end

but I don't think that should be needed for pass-by-reference. (Pass-by-value is the can of worms for which we needed Cfloat128.)

@amontoison
Copy link
Member Author

amontoison commented Aug 24, 2024

Thanks @RalphAS for your quick answer!
I found the culprit in the Fortran code of CUTEst, a macro was needed to correctly compile the library in quadruple precision: ralna/CUTEst#62

All tests passed locally. I will upgrade CUTEst_jll.jl with Yggdrasil.

Copy link

codecov bot commented Aug 24, 2024

Codecov Report

Attention: Patch coverage is 71.08434% with 48 lines in your changes missing coverage. Please review.

Project coverage is 78.11%. Comparing base (f2ad6a4) to head (ab15c2f).
Report is 55 commits behind head on main.

Files Patch % Lines
src/libcutest.jl 68.62% 48 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #378       +/-   ##
===========================================
- Coverage   89.11%   78.11%   -11.01%     
===========================================
  Files           5        8        +3     
  Lines         790     1599      +809     
===========================================
+ Hits          704     1249      +545     
- Misses         86      350      +264     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amontoison amontoison merged commit e177a76 into JuliaSmoothOptimizers:main Aug 24, 2024
9 of 15 checks passed
@amontoison amontoison deleted the quadruple branch August 24, 2024 21:26
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

Successfully merging this pull request may close these issues.

2 participants