mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #750] Match ADL/NVML device to "our" device number, using PCI ID #386
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#386
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 @magnumripper on GitHub (Sep 20, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/750
Issue: http://www.openwall.com/lists/john-users/2014/09/17/1 (can also happen with AMD)
For nvidia:
http://developer.download.nvidia.com/compute/cuda/5_5/rel/nvml/nvml.5.319.43.pdf page 49:
6.11.2.18 nvmlReturn_t DECLDIR nvmlDeviceGetHandleByPciBusId (const char ∗ pciBusId, nvmlDevice_t ∗ device)
Acquire the handle for a particular device, based on its PCI bus id.
For all products.
This value corresponds to the nvmlPciInfo_t::busId returned by nvmlDeviceGetPciInfo().
@magnumripper commented on GitHub (Sep 20, 2014):
I can't seem to find anything in ADL for matching by PCI ID. We may have to use something else.
@magnumripper commented on GitHub (Sep 20, 2014):
It turns out we may need this change at a lower (or earlier) level to guarantee proper functionality with MPI and --fork. This means the issue with ADL/NVML will probably not need a separate fix.
https://anteru.net/2014/08/01/2483/
We should build a device list like this, in PCI order or something.
@ghost commented on GitHub (Sep 20, 2014):
My original idea is just to save PCI information about all devices. When needed, just try to find it in a list. POC
@magnumripper commented on GitHub (Sep 20, 2014):
Looks good. I suppose it doesn't solve the (alleged) issue with device order not being guaranteed consistent between forks or MPI processes but in reality I have never seen that happen so your code might be all we need.
@magnumripper commented on GitHub (Sep 21, 2014):
BTW I found an open source implementation of clinfo. It's a good source for information (though I had to make a PR for some of our recent discoveries).
https://github.com/Oblomov/clinfo/
@ghost commented on GitHub (Sep 21, 2014):
Well,
cl_device_id devices[MAX_GPU_DEVICES]is saved and safe.I can't solve the issue with device ordering, but I prefer to order devices the way OpenCL API does. So, I will never do something different from clinfo or a 'hello world' application.
If devices change over MPI, I will use PCI details to find any. BTW: do we need a test case to test? I mean:
@magnumripper commented on GitHub (Sep 21, 2014):
MPI is basically the same as --fork (for this discussion). The options.node_min variable is essentially the machine ID.
@magnumripper commented on GitHub (Sep 21, 2014):
The alleged problem is that OpenCL does not guarantee that the list ends up in the same order between runs. In practice, it does though. But theoretically, device 0 and 1 on Well could swap between two runs.
@magnumripper commented on GitHub (Sep 21, 2014):
I think our only priority is to ensure we enumerate the correct ADL/NVML device numbers that matches our device list, at init. Let's ignore the theoretical problems until we see them.
@magnumripper commented on GitHub (Sep 24, 2014):
Hmm I can't see how your patch would fix the problem. The problem is that OpenCL and ADL/NVML may have different device numbers, so OpenCL device 0 may be ADL device 1 and OpenCL device 1 maybe NVML device 0. In order to fix it, we need to ask OpenCL for PCI id of all devices, and then ask ADL (and/or NVML) for PCI id of all devices. Then match them.
Or do I miss something?
@ghost commented on GitHub (Sep 25, 2014):
You mean get_pci_info (line 261) has to call ADL (or NVML) to get PCI data. There are such calls?
@magnumripper commented on GitHub (Sep 25, 2014):
An NVML call is at top of this issue,
nvmlDeviceGetPciInfo(). I haven't yet found anything for AMD but I'm pretty sure there's something we can use.@ghost commented on GitHub (Sep 25, 2014):
I see. It is useless to pair PCI info only. I have to know what the library considers 0, 1, ...
So, lets try to search on AMD info.
@magnumripper commented on GitHub (Sep 25, 2014):
It's even worse: ADL is OD5 or OD6.
On Well, OpenCL has devices 0=Bonaire, 1=Capeverde and 2=Juniper
The Bonaire is OD6 device 0
The Capeverde and Juniper are OD5 devices 6 and 8 (not sure which is which)
@magnumripper commented on GitHub (Sep 25, 2014):
BTW current bleeding-jumbo is supposed to just assume that the lowest OpenCL device number for AMD corresponds to the lowest ADL device number, and so on. And the lowest OpenCL device number for nvidia corresponds to the lowest NVML device number. In case of Well, that would happen to be correct but there seems to be a bug somewhere - I do not get any temp/fan info at all.
@ghost commented on GitHub (Sep 25, 2014):
I have a commit to test:
cadf6249a1It outputs what it is finding. Just haven't tested it properly yet.
@magnumripper commented on GitHub (Sep 26, 2014):
I committed some code with (for now) some extra output. For nvidia, it shows the NVML device number as well as the PCI ID. For AMD, I still don't know how/what to match but anyway I list OD5/OD6 and their device number as picked by JtR.
Like I said, current scheme is "lowest OpenCL device number for AMD corresponds to the lowest ADL device number, and so on". Here's that code, line 271 of common-opencl.c:
Future code might be more like this (very roughly):
@magnumripper commented on GitHub (Sep 26, 2014):
This mapping should take place in
amd_probe()andnvml_probe()in common-gpu.c though. So we just usesequential_idto name devices in common-opencl.c and theget_temp()functions gets to do the mapping. There already is a weird mapping for AMD, sequential_id -> amd_id -> od5/6_id withinamd_probe()andamd_get_temp().@ghost commented on GitHub (Sep 26, 2014):
Indeed, NVIDIA is not a problem:
@magnumripper commented on GitHub (Sep 26, 2014):
Yeah that looks correct. Are you testing this or should I?
@ghost commented on GitHub (Sep 26, 2014):
I can't (for a while). Not committed.
@ghost commented on GitHub (Sep 27, 2014):
But you decided to put these routines earlier than OpenCL initialization, so OpenCL details are not available. Are you going to load the PCI info using NV/AMD calls to compare latter?
In
c81dba9501you can see and comment on what I have for now. It is the opposite: common-opencl knows PCI detais and compare using native calls when necessary.@ghost commented on GitHub (Sep 27, 2014):
Have you found this? Looking at adl_structures.h.
@magnumripper commented on GitHub (Sep 27, 2014):
Yeah I saw it but MultiVPU appears to be something about Crossfire or something like that. Maybe it can still be used though.
@magnumripper commented on GitHub (Sep 27, 2014):
Oh. Well your approach is better then! I have a really hard time keeping track of all of this!
@magnumripper commented on GitHub (Sep 27, 2014):
I must be dumb. I can't find any function that uses ADLAdapterLocation or ADLMVPUStatus.
@magnumripper commented on GitHub (Sep 27, 2014):
OK that's because we do not have adl_api.h in our tree:
http://sterlingdesktops.com/pub/lsadl/lsadl-0.1.2/adl_api.h
@magnumripper commented on GitHub (Sep 27, 2014):
Hmm but that one doesn't come from AMD. There has to be a standard file somewhere?
@ghost commented on GitHub (Sep 27, 2014):
I haven't found any (and i just download the SDK). The includes dir is a desert.
@ghost commented on GitHub (Sep 27, 2014):
To try to undestand it, my best guess is (inside SDK folder).
Doc:
Sample:
@magnumripper commented on GitHub (Sep 27, 2014):
I think it may be worthwile to build http://sterlingdesktops.com/pub/lsadl/lsadl-0.1.2.tar.bz2 and see what it outputs (assuming it's like clinfo but for ADL)
@magnumripper commented on GitHub (Sep 27, 2014):
Why the f@ck would anyone want gtk in such a tool? I need a command line tool.
@magnumripper commented on GitHub (Sep 27, 2014):
Nah it doesn't list anything new anyway. Scrap that tool.
@ghost commented on GitHub (Sep 29, 2014):
You gave up too soon. Latest commit is a hope. AMD doesn't have the same kind of API, but it seems to work.
@magnumripper commented on GitHub (Oct 3, 2014):
Excellent, I believe we can close this.