mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #875] OMP_SCALE auto-tuning #480
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#480
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jfoug on GitHub (Dec 10, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/875
Continued from #871
@jfoug commented on GitHub (Dec 10, 2014):
These messages moved here from the other issue page, so that this issue is self contained.
@magnumripper commented on GitHub (Dec 10, 2014):
Assuming min_keys_per_crypt was already set [in init()] we can start at that value and double. Most formats set min_keys_per_crypt to the raw minimum (eg NBKEYS) multiplied with number of threads but not by OMP_SCALE.
We probably need to init() prior to doing this tune session (eg. for getting min_keys_per_crypt initialized) and we probably can't call it again - but we need to have the format re-allocate buffers etc. for the new setting. Maybe we could set up fmt->methods.reset() to handle the change?
@jfoug commented on GitHub (Dec 11, 2014):
I have been thinking more about the 'tune' code/script. I really think it would be best to only have it impact the one run, not go into a loop. Then have an external script drive the process. We can also reduce as well as increase. So we could test 1/2 1/4, etc also, since there likely will be some formats that are OVER scaled to the pc. That is the hard fact of having hard coded things like this. They help overall, but are likely only optimal for the hardware they originally were tuned on.
The auto tune problem comes where param->max_keys is 1. There is no way to go down there.
Yes, this could be done after the init(), but then there could be other issues, since the format has allocated and set itself up for a specific count and now we are reducing. For increasing, it is easy, do it before. For reduction, we should know what max is to start with, let init happen, and then reduce (but make sure that we are left mod(starting_max)==0
Just thinking out loud.
@magnumripper commented on GitHub (Dec 11, 2014):
Many OpenCL formats auto-tune at each run, in a fraction of a second when well done. I believe we could do this for OMP too, and simply drop any default OMP_SCALE.
@jfoug commented on GitHub (Dec 11, 2014):
We really 'should' store the information from auto-tuning, then try a little harder (just like is done with autoconf and the -C switch). That way, JtR would re-autotune at each build but once built, it would simply read it's cache
@magnumripper commented on GitHub (Dec 11, 2014):
That would be great for you and me, but not for a distro with binary packages.
@jfoug commented on GitHub (Dec 11, 2014):
A lot of pie in the sky talk now. We probably SHOULD focus on J1 ATM, and simply let these ideas fester a bit. Often I get a real 'ah ha' moment, often days later, that if I would have dug in and started to work on something right away would never have gotten as good results. BUT there are very good ideas here.
@magnumripper commented on GitHub (Dec 11, 2014):
Yeah, let's leave this cooking for a while and we'll come up with something clever post J1
@jfoug commented on GitHub (Dec 11, 2014):
why not for distro? We simply write to ~/.john.local.conf I would think it even better for binary distro, since there the user may not be able to tweak the code.
@magnumripper commented on GitHub (Dec 11, 2014):
Oh, right. Since you talked about a build I was thinking tune for compile but that is obviously not what you meant.
@magnumripper commented on GitHub (Dec 11, 2014):
It's just that we had all these ideas for OpenCL but in the end the auto-tuning is so very fast that there is absolutely no need to cache the results. So for OpenCL we do support a john.conf value but I never ever use that myself.
@jfoug commented on GitHub (Dec 11, 2014):
Here are more really bad ones:
These are from OMP=1
These are from OMP=4
@magnumripper commented on GitHub (Dec 11, 2014):
Strange. OMP_SCALE is 1, but I would think that should suffice at that speed.
@magnumripper commented on GitHub (Dec 11, 2014):
Not seen on OSX w/ OpenSSL 1.0.1j
@jfoug commented on GitHub (Dec 11, 2014):
This may be cygwin related stuff (just like the krb5 stuff). It may be that the porters on cygwin were not able to get certain MT stuff working, so wrapped certain parts of code with mutexes. If that is the case, once I detect them, I will add
at approriate places.
@jfoug commented on GitHub (Dec 11, 2014):
Here are benchmark tests run, against 3 runs, on cygwin64 and Ubuntu-64 (virtualbox VM), on my AMD xop dual laptop. ..........
Moved to #877
@jfoug commented on GitHub (Dec 27, 2014):
ab3e6d3Here is an initial 'stab' at this. It works, and certainly makes for finding optimal OMP_SCALE a little easier. At least, there is no compile needed. Just have john.conf open in an editor, edit the line, save and re-run. This is not the 'auto' tuning, BUT it is a POC, that we can later enhance into some auto-tuning method. It works.To increase, you have to do it prior to init call. To decrease, you do it after. NOTE, there needs to be some sanity checking on decrease, I have none in code at this time.
@jfoug commented on GitHub (Dec 27, 2014):
Problem with prior commit. I had the scale at 4.0. My bad. It has been set to 1.0
1c5304bhere, and that should make it run just like it did prior to the scale set.NOTE, this should be something we have overloaded in john.local.conf
@magnumripper commented on GitHub (Dec 28, 2014):
I added possibility to override the config file setting in
fa0b57d. Your way was very Windows-ish, lol. I also cleaned up the code a bit.@jfoug commented on GitHub (Dec 30, 2014):
I am going to move this issue out of J2 for now. I am not sure it is 100% possible to do auto-tuning, without a significant update to many formats. So this model (where we can override by hand, can get the job done for us. It is not the fastest way we could do it, but for now, it is what we have.
We might still try to build a script around this method, to allow a user to run the script and find the best (with smallest OMP_SCALE) on a specific PC. But I think if we get the tuning done on high end intel, high end AMD, low end intel and low end AMD, then we might better build a table within each format, and have ./configure set some flag that handles this at compile time. BUT that is beyond the scope of this issue. This issue has been completed with env-var OMP_SCALE
@magnumripper commented on GitHub (Dec 30, 2014):
We also now have a much easier way to tune new formats. Start with the usual code (one that uses
*=in init() as opposed to hard-coding any MAX_KEYS_PER_CRYPT macro there) but define OMP_SCALE to 1. Then run it in a for loop setting OMP_SCALE environment variable. Something like this:(I never quite understood why I can't use
for OMP_SCALE in ...without exporting OMP_SCALE)@jfoug commented on GitHub (Dec 30, 2014):
Yup, MUCH easier than it was, but still not super simple. But once we get a list of formats that 'CAN' be env-OMP_SCALE tuned properly (i.e. use *= in init), then we can script build and produce some CSV input that can be put into excel or something. Then we can slowly build a table of 'best tunes' for some common machines, and then runtime (or compile time) choose what is near optimal for the users machine.
Again, not a true 'auto-tuner', BUT better than we had.
@magnumripper commented on GitHub (Dec 31, 2014):
BTW we have to remember to not do any OMP tuning when built with debug, memdbg and/or ASAN (or any other thing that affects performance).
@magnumripper commented on GitHub (Sep 4, 2015):
I think this issue was obsoleted by lots of work we did half a year ago plus even more work @zzlei did this summer.
@jfoug commented on GitHub (Sep 4, 2015):
It is not obsoleted, BUT it has actually been updated so that it works better across more current platforms. So taking the full step of probing and detecting, or simple 'providing' overrides to allow someone to do it easily themselves may now not be that great on ROI
2 or 3 years from now, it might be, when we have to spend a lot of time getting things re-tuned with whatever the state of hardware is at that time, but we certainly can kick the can down the road until then, lol.
@magnumripper commented on GitHub (Sep 4, 2015):
We'll probably revisit this at some point but not much of the info here is up to date now so it's probably better to open a new issue at that time.
I just finished a minor audit of all open issues without a milestone, and closed a few. I also renamed your "Jumbo-2 (not critical)" milestone, or what it was called, to "Jumbo-3" but they're just labels anyway - we might end up fixing some of those prior to J2 anyway.
@jfoug commented on GitHub (Sep 4, 2015):
We probably should have milestones for most issues, even if the milestone is
tasks to do only when you are so bored because you are buried in snow in a cabin in the woods😏@magnumripper commented on GitHub (Sep 4, 2015):
I actually considered that, to separate them from "issues that are yet to classify". We could have a milestone of "later".
@jfoug commented on GitHub (Sep 4, 2015):
later is so boring, but yes, it works, lol. Some of the issues are really more discussion issues, so they should have some non-milestone milestone that separates them. There are not too many of them, but some. Some (as I hate to think, the unicode port) are pretty pie in the sky. They would be great IF we could do them, but they may actually be larger than what actually ever gets done.
@jfoug commented on GitHub (Sep 4, 2015):
Actually, this issue sort of fit into that category. A very good thing if we could do it, but probably a much bigger project that was doable. The way we worked around this, hard coding stuff was a very good stop gap.
But there are others in this group. I really think the configure script was looked at this way for a long time. Yes, we thought it would be great, but it was just more than we knew how to do. Yet now, I can not see john without it and would NEVER want to go back.