Comments (12)
Alright, the pickling problem has been solved. The issue was in the way manim imported the project module, by spec. Importing it normally works.
I've made a new branch with the according edited file, (and again, no PRs and merges for that branch):
Edited extract_scene.py
The changes are simple:
- Import the
multiprocess
library - Change the way the project module is imported
- Switch the direct scene rendering call for a process wrapped one
- Turn off open_file_if_needed. No need to fix this, when someone renders multiple videos at once putting them into preview doesn't make sense anyway (unless we'd put them into a playlist, but that's not exactly a high priority I'd think)
The problems that are still left:
- Simple as this implementation is, currently it just replaces serial rendering instead of adding the option.
- Some of you might remember I said that with
threading
the visual feedback looked almost okay... That is certainly not the case anymore. The processes now all dump their progress into the same bar, and the info dump on created files and played animations usually isn't a beauty either.
I really need to do other things for a while though, so I'm leaving that cleaned up Proof of Concept file not just for others but also for myself to come back to later as well.
And if someone wants to test the waters with adapting the UI already that'd be welcome as well. I won't be doing that as that's completely out of my realm of experience.
from manim.
There's now an issue with the new Tex handling, which will presumably be fixed by #98, so I'm waiting on that to continue.
I've worked a bit more on the likely to be implemented structure, and will leave that here mostly for myself, and as a general reference.
In order to properly implement multiprocessing we'll likely have to do something like this:
- Once a final config file is in place, it'll need a bool for whether multiprocessing is used or not and an argument for the process count. Or maybe make it simpler and just have 1 process act as a False upon check. If it isn't enabled (by default or cli), trod along normally, else switch to the new code.
- Initialize a worker pool in
extract_scene.py
. Each scene will be thrown into the pool using an async method. Which one is yet to be determined (apply, map, starmap, etc.) - The splitting logic will likely have to be placed in
scene.py
, withinself.construct()
. Due to the way it's structured the only real place I see this working is right inplay()
.
We'll probably have to wrap and adapt this part in specific:
animations = self.compile_play_args_to_animation_list(*args, **kwargs)
self.begin_animations(animations)
self.progress_through_animations(animations)
self.finish_animations(animations)
- These newly created
play
processes all need to be tracked and waited for to finish within the scene, before moving on fromself.construct()
, else only evil things can be expected to happen: - Because the
partial_movie_file_list.txt
should be produced only after all processes forplay
statements are finished, there should be no problems here. If somehow videos are spliced together in wrong order, this would be the place to look.
from manim.
We live in a post-#98 world. Can we revisit this?
Also, RE point 1. above: you don't need a bool AND an argument. You can just set the default number of workers to 1
for no multiprocessing.
from manim.
We live in a post-#98 world. Can we revisit this?
Not forgetting about this, but while #98 was brewing I had been working on the 3 new geometry classes (#187) to which I still I need some input too. Since both are pretty much entirely on my shoulders working on one delays the others and I'm not sure which to prioritize. The classes definitely have more general utility.
Also, RE point 1. above: you don't need a bool AND an argument. You can just set the default number of workers to
1
for no multiprocessing.
Right, like I mentioned there.
from manim.
Making a note to myself here to also wait for #166 to be finished since it touches the same files multiprocessing has to be spliced into.
from manim.
Just wanted to say that there are some changes planned down the line for the config system that would work perfectly with multiprocessing but not with multithreading. So in case there is a change from multiprocessing to multithreading down the line, please let me know first so we can discuss.
from manim.
Update here:
The next TO DO item on the config system is to make it not global anymore, but local to each Scene class. Once this is done, it should be fairly simple to implement parallel scene rendering using multiprocessing.
There have also been refactors in the scene file writer that may make this easier.
from manim.
Related to multiprocessing: sphinx has an option to run in parallel. If we make sure our docs can build in parallel, then we should be able to speed up sphinx builds by 2x or 4x (assuming the RTD machines have many CPUs...)
from manim.
Just wanted to say that there are some changes planned down the line for the config system that would work perfectly with multiprocessing but not with multithreading. So in case there is a change from multiprocessing to multithreading down the line, please let me know first so we can discuss.
This isn't ever going to happen though. In terms of performance multiprocessing would be a massive increase in speed for most cases while multithreading would be... well not completely useless, but honestly, mostly.
The next TO DO item on the config system is to make it not global anymore, but local to each Scene class. Once this is done, it should be fairly simple to implement parallel scene rendering using multiprocessing.
There have also been refactors in the scene file writer that may make this easier.
Speaking of which, how far along is this exactly?
Related to multiprocessing: sphinx has an option to run in parallel. If we make sure our docs can build in parallel, then we should be able to speed up sphinx builds by 2x or 4x (assuming the RTD machines have many CPUs...)
Sounds good. Is my still planned multiprocessing project related to implementing that at all though? If, how?
from manim.
This isn't ever going to happen though. In terms of performance multiprocessing would be a massive increase in speed for most cases while multithreading would be... well not completely useless, but honestly, mostly.
Fair!
The next TO DO item on the config system is to make it not global anymore, but local to each Scene class. Once this is done, it should be fairly simple to implement parallel scene rendering using multiprocessing.
There have also been refactors in the scene file writer that may make this easier.Speaking of which, how far along is this exactly?
Honestly, the only thing left to do is make each Scene
have its own instance of a ManimConfig
object. This is not a difficult PR, but it will break basically every scene in existence. So there's that to consider. Is this something that's blocking this project? We could try to speed that up if so.
Related to multiprocessing: sphinx has an option to run in parallel. If we make sure our docs can build in parallel, then we should be able to speed up sphinx builds by 2x or 4x (assuming the RTD machines have many CPUs...)
Sounds good. Is my still planned multiprocessing project related to implementing that at all though? If, how?
Well, the manim_directive
uses manim to render all the examples. Each directive can be marked as safe or unsafe to parallelize. Right now, it is marked as unsafe because manim has no support for parallelization. So in the course of working on this project, it would be good to keep in mind for further down the line. (Having said that, I don't actually know if multiprocessing would count as "safe", or if it's something that sphinx would even recognize...)
from manim.
Hi all! Is there any update on this?
from manim.
Unfortunately not from my side at least. I can't live off of this and have other stuff to attend, especially right now, so I simply can't tackle it. I'd have to reconnect with the current state of the repo too. What originally kept me tethered to Manim was somewhat temporarily severed by the pandemic. I might get back in touch with all of this eventually, but if I do... it will be another year, and that's the optimistic estimate.
from manim.
Related Issues (20)
- cannot export a custom aspect ratio video HOT 2
- Error when running TransformMatchingShapes sample: ParseError: no element found: line 1, column 0 HOT 3
- put_start_and_end_on does not work with Arrow3D HOT 6
- Mac installation: since changes in Homebrew for Python 3.12, `pip3 install manim` doesn't work. Improvement of the doc is needed. HOT 6
- Difference between pixel width, pixel hiegth, frame_widht, frame_height, frame_size etc. HOT 1
- How to use google fonts in MathTex HOT 1
- How to customize the Write animations HOT 1
- Matrix with Mathtex HOT 1
- Graph labels not working as expected when passing "vertex_config" HOT 2
- USE GPU to render HOT 2
- Add params / flags for `scene.render()` HOT 2
- As
- Manim doesn't find the scene inside of the driver file when I run manim -qpl main.py (Is something wrong or outdated?) HOT 6
- SVG incorrectly rendered
- Working with Manim in Jupyer Notebook HOT 1
- `register_font` should be exposed in Manim
- Problem with updating the angle measure HOT 5
- Fraction line disappears when use polyglossia in tex preambula HOT 2
- (CI): Fix `.. versionremoved` not found
- Error in OpenGL SurfaceExample: `'Sphere' object has no attribute 'uv_func'` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manim.