Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 27 May 2013 17:08:54 -0400
From:  <jfoug@....net>
To: john-dev@...ts.openwall.com
Subject: Re: OMP for raw formats

I think we can work around AMD's slow thread switching, by making the OMP code never to have to task switch.  This was done in dynamic, and I think we can do this in fast raw formats also.  This likely will get little to no gain on slow formats.

To do this, we need to change the for loop from:

#pragma omp parallel for
for (i = 0 ; i <  count; += MAX_KEYS_PER_CRYPT)

to:

int inc = (count / omp_t) + 1;
#pragma omp parallel for
for (i = 0; i < count; i += inc) {
  /* inside the threads workload */
  for (j = 0; j < inc; ++j)
     process_item(i*cnt+j)
}

So if we 8 threads, and 1024 items, it will start 8 threads, and give each thread 129 items to work on (last thread will only get 121 items).  Thus, there is no thread switching.  That should help.

NOTE, this is if I understand what OMP is doing under the hood, which may not be correct.

I am going to give this a shot on raw-MD5 and see what it does (core i7).  But if there is no slowdown on intel, and it gets things working on AMD, then it is a win/win.

Jim.

---- magnum <john.magnum@...hmail.com> wrote: 
> Jim recently enabled OMP for the fast raw formats and that ymade me enable it for nt2 as well (it was there but disabled). They all work fine on Intel i7 but I see massive performance regressions on AMD hardware, not only XOP/Bull but also older AMD. Even using OMP_NUM_THREADS=1 the speed is terrible. I think we need to revert this or figure out some way to handle it.
> 
> One way to handle it is to add some macro like USE_RAW_OMP to Makefile (perhaps default commented out, perhaps not?) and only enable OMP for these formats if it's defined.
> 
> Or maybe it can be tweaked. I have tried bumping OMP_SCALE to astronomous figures to no avail.
> 
> This problem likely applies to dynamic too, but I never noticed (and did not check now).
> 
> magnum

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.