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

Better error "Sorted function argument too long" #289

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jodavies
Copy link
Collaborator

@jodavies jodavies commented Aug 5, 2018

Print the required MaxTermSize in words to allow easy configuration of setup.

@coveralls
Copy link

coveralls commented Aug 5, 2018

Coverage Status

coverage: 50.08% (+0.08%) from 49.999%
when pulling ac2c0ce on jodavies:sort-info
into 83e3d41 on vermaseren:master.

@tueda
Copy link
Collaborator

tueda commented Aug 5, 2018

Sounds nice. Possible problems would be:

  1. Could it make every sorting in arguments a bit slow? If so, we should compute the required WORD size only when the argument doesn't fit.
  2. Maybe you need to consider ErrorMessageLock for the change in Malloc1()? (I'm not sure because anyway Error1() causes the catastrophe Exit may fail to exit with TFORM #14 via Terminate().)

@vermaseren
Copy link
Owner

vermaseren commented Aug 5, 2018 via email

@tueda
Copy link
Collaborator

tueda commented Aug 5, 2018

Another thing: I don't see any reason why tmpss is declared in the beginning of EndSort. It can be just put in the else block. Physicists and programmers love the principle of locality :-)

@jodavies
Copy link
Collaborator Author

jodavies commented Aug 5, 2018

I would imagine that all data is in cache, but I did not do any benchmarks. The new way avoids the problem by only checking if indeed it is too large; also then you do not need tmpss. Declaration wise, I was trying to follow the style of most of the form code.

In tools.c, there are ErrorMessageLock if MALLOCDEBUG is not defined, which is the usual state, no?

@vermaseren
Copy link
Owner

vermaseren commented Aug 5, 2018 via email

@tueda
Copy link
Collaborator

tueda commented Aug 5, 2018

In tools.c, there are ErrorMessageLock if MALLOCDEBUG is not defined, which is the usual state, no?

Ah, you are absolutely right. Somehow I confused between #ifdef MALLOCDEBUG and #ifndef MALLOCDEBUG blocks. As Jos said, it is not the place that emits errors about MaxTermSize and there are many places. But they are beyond of the scope of this patch, so to me it is fine to merge it. (If you like cleanliness, you can git-rebase the two commits.)

@vermaseren and @benruijl, Opinions for Josh's patch? (And what would be a good process to proceed and merge such PRs?)

@jodavies
Copy link
Collaborator Author

With those modifications, I still have some problems with "(1)Output should fit inside a single term. Increase MaxTermSize?". However, none of my messages are printed. This means (and I have verified) that one arrives at this error, not by jumping to the `TooLarge' label, but by taking the if branch here: https://github.com/vermaseren/form/blob/master/sources/sort.c#L963 .

It is not clear to me what causes this, and where I can determine how big the too-large-term is.

I get the error even for very large values of maxtermsize, which does not make any sense to me.

Can one land at this error for other reasons?

Thanks,
Josh.

@vermaseren
Copy link
Owner

vermaseren commented Aug 23, 2018 via email

@vsht
Copy link

vsht commented Jun 12, 2024

I think that a better error message here would be very useful. The current one only creates unnecessary confusion, as in #538

@jodavies
Copy link
Collaborator Author

With those modifications, I still have some problems with "(1)Output should fit inside a single term. Increase MaxTermSize?". However, none of my messages are printed. This means (and I have verified) that one arrives at this error, not by jumping to the `TooLarge' label, but by taking the if branch here: https://github.com/vermaseren/form/blob/master/sources/sort.c#L963 .

It is not clear to me what causes this, and where I can determine how big the too-large-term is.

I get the error even for very large values of maxtermsize, which does not make any sense to me.

Can one land at this error for other reasons?

Thanks, Josh.

These cases are related to #515 , which added some relevant commentary. From here it is not possible to print a useful error message stating the maxtermsize which would be required though. The way to do that would be to let FORM continue and fail later, instead of terminating "early".

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.

5 participants