Add option to use more complex python code as parameter value#9
Add option to use more complex python code as parameter value#9JanVogelsang wants to merge 1 commit intoFZJ-JSC:masterfrom
Conversation
|
Can you share a few |
|
I just have a single concrete example where I use this functionality in my benchmarks (manually generating a cpu-bind-mask to prevent the cpu pinning bug on the JSC systems to affect our results): - name: cpu_bind_mask
type: string
separator: ;
mode: python
"_": |
exec("cpu_bind_masks = list()\nbits_per_task = $threads_per_task\ncurrent_block = 0\nnum_blocks = 0\ncurrent_block_free = 4\nfor _ in range($tasks_per_node):\n bits_left = bits_per_task\n cpu_bind_masks.append('0x')\n while bits_left >= current_block_free:\n mask = '1'*current_block_free\n cpu_bind_masks[-1] += hex(int(mask, 2))[2:].upper()\n bits_left -= current_block_free\n current_block_free = 4\n num_blocks += 1\n if bits_left > 0:\n mask = '1'*bits_left + '0'*(4-bits_left)\n cpu_bind_masks[-1] += hex(int(mask, 2))[2:].upper()\n current_block_free -= bits_left\n cpu_bind_masks[-1] += '0'*current_block\n current_block += num_blocks");return ",".join(cpu_bind_masks)However, this is equivalent to any parameter that can't be written in a single line, e.g.: - {name: scale, type: int, mode: python, "_": "import math; math.sqrt($num_nodes)"Ideally, if one could just define custom functions that one could then call inside parameter value definitions (i.e., |
|
Ping! |
|
I have been informed that you are aware that we have made major internal changes as part of a master's thesis that we are currently working on. I have also been told that you have already been provided with the code produced as part of that thesis for testing, and that the changes proposed here are not compatible with it without further modification. Unfortunately, I don't know the details of these tests and what caused the problems. If you have any further information on this, it would be helpful if you could share it with us. One of our next steps will be to release the master's thesis code and further code extension. I cannot give an exact timetable at this stage as this will depend on other factors. |
|
@thobreuer As far as I am concerned, the thesis is entirely independent of the changes in this PR. Is there any update on that? |
Currently, JUBE only allows parameters with the
modeset topythonto be simple expressions, which is quite restrictive.This PR adds the possibility for any arbitrary python code to be passed as a parameter value, which will then use the code's return value as parameter value.