Hi Dade,
Luxcore not displays memory used in rendering stats. Previously Luxrender displays like (Memory: 325MB / 3071 MB).
Could you please add this feature as it will be useful in rendering large scenes in GPU. Thanks.
Memory stats while rendering
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Re: Memory stats while rendering
Hi BYOB,
After some addition and deletion of the old code, I made the following code to work out the memory usage of GPU.
I added it after # Triangle count code in get_pretty_stats function.
# Memory usage (only available for OpenCL engines)
if str.endswith(engine, 'OCL'):
device_stats = stats.Get("stats.renderengine.devices")
max_memory = float('inf')
used_memory = 0
for i in range(device_stats.GetSize()):
device_name = device_stats.GetString(i)
# Max memory available is limited by the device with least amount of memory
device_max_memory = stats.Get("stats.renderengine.devices." + device_name + ".memory.total").GetFloat()
device_max_memory = int(device_max_memory / (1024 * 1024))
if device_max_memory < max_memory:
if device_max_memory != 0:
max_memory = device_max_memory
device_used_memory = stats.Get("stats.renderengine.devices." + device_name + ".memory.used").GetFloat()
device_used_memory = int(device_used_memory / (1024 * 1024))
if device_used_memory > used_memory:
used_memory = device_used_memory
pretty.append('Memory: %d MB/%d MB' % (used_memory, max_memory))
At first the code returns used_memory perfectly but max_memory always was 0.
When I checked the system console, Besides CPU and GPU it displays a device NATIVE_THREAD with max memory = 0.
It might be because of that. So i introduced the following line in code.
if device_max_memory != 0:
After that it perfectly returns the GPU memory size as 3072 MB for AMD (R9 280x/ 7970).
I know C++ programming not python, so the code is a rough implementation .
Hope it is helpful .
After some addition and deletion of the old code, I made the following code to work out the memory usage of GPU.
I added it after # Triangle count code in get_pretty_stats function.
# Memory usage (only available for OpenCL engines)
if str.endswith(engine, 'OCL'):
device_stats = stats.Get("stats.renderengine.devices")
max_memory = float('inf')
used_memory = 0
for i in range(device_stats.GetSize()):
device_name = device_stats.GetString(i)
# Max memory available is limited by the device with least amount of memory
device_max_memory = stats.Get("stats.renderengine.devices." + device_name + ".memory.total").GetFloat()
device_max_memory = int(device_max_memory / (1024 * 1024))
if device_max_memory < max_memory:
if device_max_memory != 0:
max_memory = device_max_memory
device_used_memory = stats.Get("stats.renderengine.devices." + device_name + ".memory.used").GetFloat()
device_used_memory = int(device_used_memory / (1024 * 1024))
if device_used_memory > used_memory:
used_memory = device_used_memory
pretty.append('Memory: %d MB/%d MB' % (used_memory, max_memory))
At first the code returns used_memory perfectly but max_memory always was 0.
When I checked the system console, Besides CPU and GPU it displays a device NATIVE_THREAD with max memory = 0.
It might be because of that. So i introduced the following line in code.
if device_max_memory != 0:
After that it perfectly returns the GPU memory size as 3072 MB for AMD (R9 280x/ 7970).
I know C++ programming not python, so the code is a rough implementation .
Hope it is helpful .
Re: Memory stats while rendering
When you edit your post, click the 5th button (icon </>) to create code tags so the indentation is not lost:
By the way, did you check the stuff mentioned as todo in the issue?
Code: Select all
if bla:
blub()
P.S. you can also create a pull request, like described here: viewtopic.php?f=5&t=135When implementing this, check if stats.renderengine.devices really only returns the enabled devices (important for max. available memory calculation).
Re: Memory stats while rendering
By the way, did you check the stuff mentioned as todo in the issue?
P.S. you can also create a pull request, like described here: viewtopic.php?f=5&t=135
[/quote]
In future I will do it that way (Hope those steps are easy to follow ).
I missed that point. Also I have single GPU and can't test this featureWhen implementing this, check if stats.renderengine.devices really only returns the enabled devices (important for max. available memory calculation).
P.S. you can also create a pull request, like described here: viewtopic.php?f=5&t=135
[/quote]
In future I will do it that way (Hope those steps are easy to follow ).
Re: Memory stats while rendering
Damn. I think this is more work than the actual coding.
If you have to set it up the first time for such a small patch, it will seem like much work for little impact.
But if you submit more patches in the future, it takes a lot of work off of our shoulders if we can just review pull requests instead of copy/pasting code from the forum.
Thank you for your interest in contributing
Re: Memory stats while rendering
You will also appear has author of the patch in official source code repositories. Something that is totally lost if someone else commit the code for you.B.Y.O.B. wrote: ↑Sun Apr 29, 2018 8:41 am If you have to set it up the first time for such a small patch, it will seem like much work for little impact.
But if you submit more patches in the future, it takes a lot of work off of our shoulders if we can just review pull requests instead of copy/pasting code from the forum.
Re: Memory stats while rendering
Hi,Dade wrote: ↑Sun Apr 29, 2018 9:53 amYou will also appear has author of the patch in official source code repositories. Something that is totally lost if someone else commit the code for you.B.Y.O.B. wrote: ↑Sun Apr 29, 2018 8:41 am If you have to set it up the first time for such a small patch, it will seem like much work for little impact.
But if you submit more patches in the future, it takes a lot of work off of our shoulders if we can just review pull requests instead of copy/pasting code from the forum.
At present I'm playing with LuxCore C++ code (totally biased ideas).
Once I can significantly contribute to the project, I will create requests in github.
Meanwhile, I observed some small cleanups in Luxcore code. as the changes are very small and taking time (learning github process) into consideration, I'm posting it in seperate thread in this forum.
Next time I will do it in github .