jump-dev / Gurobi.jl

A Julia interface to the Gurobi Optimizer
http://www.gurobi.com/
MIT License
221 stars 80 forks source link

Update scripts for Clang v0.17 #532

Closed odow closed 11 months ago

odow commented 11 months ago

Closes #530

@simonbowly you could try building with this. It has a few tweaks, like using Cchar instead of UInt8

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (db2d8e6) 90.87% compared to head (36bc252) 90.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #532 +/- ## ======================================= Coverage 90.87% 90.87% ======================================= Files 5 5 Lines 2422 2422 ======================================= Hits 2201 2201 Misses 221 221 ``` | [Files](https://app.codecov.io/gh/jump-dev/Gurobi.jl/pull/532?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev) | Coverage Δ | | |---|---|---| | [src/Gurobi.jl](https://app.codecov.io/gh/jump-dev/Gurobi.jl/pull/532?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev#diff-c3JjL0d1cm9iaS5qbA==) | `80.00% <ø> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

odow commented 11 months ago

Seems reasonable?

simonbowly commented 11 months ago

Yeah, a few adjustments got it building for v10. The changes look minor, but there are some failing MOI tests on my mac that I haven't dug into yet.

simonbowly commented 11 months ago

It looks like some constraints silently fail to be added? Perhaps the CChar change could cause this, this update changes const GRB_LESS_EQUAL = '<' and friends to const GRB_LESS_EQUAL = Cchar('<').

simonbowly commented 11 months ago

Manually adjusting the character constants (6bdd625) resolved this for me. I don't see an option to fix this in Clang.jl. I guess worst case these symbols can go in the preamble?

odow commented 11 months ago

Hmm. It'd be nice to know why. You could just do a find-and-replace on the file once it has been built?

odow commented 11 months ago

Otherwise just a note in the gen.jl script is okay. It's a very small job that happens infrequently.

simonbowly commented 11 months ago

I might just add them to the ignore list and preamble. This is a set of symbols that isn't likely to change.

As for why it fails, you may be on the right track with the Char<->[U]Int8 mapping. Evidently this differs by processor type, not by OS? If you happen to have an ARM chip handy that might shed some light on it.

It's a bit worrying that that MOI test seems to only find an issue when it checks the number of constraints in a model though? Makes it seem like an error code check is not being done?

odow commented 11 months ago

I didn't look into why it failed yet, but it's probably something to do with lines like this: https://github.com/jump-dev/Gurobi.jl/blob/db2d8e6f88599c5b78512fb681f53ea86cb5a22b/src/MOI_wrapper/MOI_wrapper.jl#L1363

The C API calls will convert properly, but

julia> 'B' == Cchar('B')
false