[GH-ISSUE #1468] OpenCL: Common support for multiple devices #945

Open
opened 2026-10-14 03:29:24 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @magnumripper on GitHub (Jun 24, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1468

RFC @claudioandre @Sayantan2048

We should figure out a KISS way of supporting multi-device use for more formats, with as little effort as possible (I'm lazy).

Brainstorming:

  1. All common OpenCL variables/functions should work on arrays. Some already do. For example, local_work_size, global_work_size, crypt_kernel and so on should all be arrays of [MAX_GPU_DEVICES].
  2. A format calling opencl_init would init all devices specified (I think this already happens)
  3. Auto-tune should be made for all chosen devices, storing LWS/GWS results per device. Note: If we deem two or more devices identical, we should obviously just re-use the values and not test again.
  4. Auto-tune can (already) aim for a duration time, eg. 200ms.
  5. Say we end up with a global_work_size[0] of 1024 and global_work_size[1] of 2048. We'd simply set max_keys_per_crypt to 3072.
  6. set_salt would send same salt to each device.
  7. crypt_all() would iterate through the device list and send the number of keys to each device that corresponds with its global_work_size. Then launch each kernel, and so on.

That's about it, I think.

Originally created by @magnumripper on GitHub (Jun 24, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1468 RFC @claudioandre @Sayantan2048 We should figure out a [KISS](https://en.wikipedia.org/wiki/KISS_principle) way of supporting multi-device use for more formats, with as little effort as possible (I'm lazy). Brainstorming: 1. All common OpenCL variables/functions should work on arrays. Some already do. For example, local_work_size, global_work_size, crypt_kernel and so on should all be arrays of [MAX_GPU_DEVICES]. 2. A format calling opencl_init would init all devices specified (I think this already happens) 3. Auto-tune should be made for all chosen devices, storing LWS/GWS results per device. _Note:_ If we deem two or more devices identical, we should obviously just re-use the values and not test again. 4. Auto-tune can (already) aim for a duration time, eg. 200ms. 5. Say we end up with a global_work_size[0] of 1024 and global_work_size[1] of 2048. We'd simply set max_keys_per_crypt to 3072. 6. set_salt would send same salt to each device. 7. crypt_all() would iterate through the device list and send the number of keys to each device that corresponds with its global_work_size. Then launch each kernel, and so on. That's about it, I think.
Author
Owner

@sayan1an commented on GitHub (Jun 26, 2015):

It may be simple(r) for slow formats adhering to standards of JtR. But those which do not, I see a list of hurdles. Maybe we'll overcome them, but l'm little skeptical about how worthwhile it'll be. For example, key generation is serialized compared to fork which may slowdown our multi gpu efforts.

<!-- gh-comment-id:115492355 --> @sayan1an commented on GitHub (Jun 26, 2015): It may be simple(r) for slow formats adhering to standards of JtR. But those which do not, I see a list of hurdles. Maybe we'll overcome them, but l'm little skeptical about how worthwhile it'll be. For example, key generation is serialized compared to fork which may slowdown our multi gpu efforts.
Author
Owner

@magnumripper commented on GitHub (Jun 26, 2015):

Very few formats are that fast and virtually all new formats are super slow. I'm thinking we'll have this as an alternative to fork when applicable. Formats not implementing this should be mostly unaffected if we design this with care.

<!-- gh-comment-id:115723106 --> @magnumripper commented on GitHub (Jun 26, 2015): Very few formats are that fast and virtually all new formats are super slow. I'm thinking we'll have this as an alternative to fork when applicable. Formats not implementing this should be mostly unaffected if we design this with care.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#945
No description provided.