Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <50F205B3.3010902@gmail.com>
Date: Sat, 12 Jan 2013 22:54:11 -0200
From: Claudio André <claudioandre.br@...il.com>
To: john-dev@...ts.openwall.com
Subject: Changes to common-opencl.c

Hi, in order to allow multi-gpu setups:

I would like to change the behavior of common opencl functions. The new 
configuration will allow Sayantan to use common-opencl functions (only 
functions dealing directly with multi-gpu running management is not 
going to be shared).

I will create a new function.
- start_opencl_devices()
Called once by john 'core'
It does the same dev_init do, but keeps information for all OpenCL 
devices (not only for the platform selected, as we do now).
It will return the correct (sequential) ocl_gpu_id (e.g. Bull's cpu is 
2: third device). So, legacy code still works as expected.

When finished:
- platform[all], devices[all], context[for each device], queue[for each 
device] are going to be initialized by john 'core' and keep this way for 
ever.
- Each plataform inside platform[MAX_PLATFORMS] will have its (all) 
devices in devices[MAXGPUS];
- e.g. Bull: plataform[0] = NVIDIA (num_devices=1), plataform[1] = AMD 
(num_devices=2) => total of devices in devices[MAXGPUS] equal 3.
- e.g. Bull: devices[0] = GTX 570, devices[1] = Radeon 7970, devices[2] 
= CPU
- So, if i have -pla:1 -de:0 i can compute that devices[ocl_gpu_id = 1] 
and vice-versa.
- formats will only call opencl_init_dev to get ocl_gpu_id (to run using 
many devices). Or ocl_gpu_id becames a vector. Or both.
- it is not a problem if command line accepts -pla:1 and -de:0 or 
--devices=1,2,3

So:
- legacy code works as expected and GPU macros still works.
- Sayantan can start using common-opencl macros and functions: cpu(), 
gpu(), build_opt(), build_save(), etc.

Problems:
- hot-plug is not going to be handled. Well, it is not handled now too.

Questions:
- i put *start_opencl_devices()* in john.c (john_init) is it a good place?
- where should i put *clean_opencl_devices()*. I mean, there is a 
john_finishing?
- now it is possible to have --platform=1 --device=0 or --devices=1,2,3. 
But, in such a case there are three variables keeping the 'same 
information' inside formats. device_id, platform_id and ocl_gpu_id (the 
sequential number). Can we select how JtR will work? [It is not really 
true, but i know how to solve this in everyone formats except 
Sayantan's]. So, i can't make a propose.

Important:
- I changed all but Sayantan's formats to this new API (only one line 
per format). I mean.
   . we do the 'initialization' of opencl using platform_id and device_id.
   . but then uses ocl_gpu_id. See the questions above.
- I need to understand Sayantan usage of copied common-opencl.c code to 
change it. Even better, Sayantan can say his opinion on the matter.
- magnun's code as listOpenCLdevices was not tested.

Patch (only a few formats was tested)
https://github.com/claudioandre/JohnTheRipper/commit/bcde5f7ddbc3686a346274d6c6ec5a05183bfdd3

Claudio

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.