-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duneuro Optimization 1 : input files for duneuro #4
Comments
Thank you Takfa, I am a bit of an outsider on this project: is there a technical specification for the ASCII duneuro input data files and the Vista format? The link you provided seems to only describe the Simbio .par parameter file. If there are open formats used in other software such as Vista in Simbio I agree it would be best if this can be adopted, perhaps there are even open source IO functions we could reuse either in Matlab or C++. |
Hi @martcous, Thanks for your feedback. Indeed there is no much online documentation about the file format that we are using and even on the vista file. I found some of these files and few pdf files that explain some part here I will check with the German group if there are any other links for documentation. Furthermore, I have checked about the vista files and indeed there is already some function in cpp and mex already but I think we need to add them within the i/o functions of duneuro, somewhere here: https://gitlab.dune-project.org/duneuro/duneuro/-/tree/master/duneuro/io |
Hi everybody.
Sorry. Wordy mondy. |
In Matlab, reading/writing floating points in text fields is indeed terribly slower than binary files (because of the conversion, a lack of optimization, and also simply because the files are much bigger). I've been facing this problem many time. @juangpc In the case where:
|
Great!
Aha. I didn't know that. Thank you.
For the duneuro part, linux and darwin will work pretty much out of the box. windows... 😟 complicated.
|
Hello all, Nice to read all these relevant comments and learn these new things here :). If I can add some comments, regarding the previous steps of this project, http://duneuro.org/ ==.at the section documentation However, this is working only on Linux ... with @juangpc we have spent a lot of time trying to generate the mex files for windows... at the end nothing :( ... with more persistence, we were able to generate the binaries :) Furthermore, in order to generate these Mex files, which are related to the OS and the Matlab version, the users must compile the Duneuro code on their computer... which is not easy for most of the brainstorm users. The ideal case is to have cross-versions and cross-platforms mex files for the users without asking them to compile the duneuro core code... as it's the case for SimBio in fieldtrip. I don't know how much work these needs and how long it will take. Regarding the current version, with the binaries, the main change that we need is adding new binaries input files for duneuro, @juangpc has successfully added the code that writes the duneuro output as binaries and it was slightly faster than the text files. Changing only the input files will not affect much the actual version of the brainstoem code. |
I'd vote against optimizations that would require 1) the users to compile something on their computers or 2) doesn't work on windows. It's probably better to have something slower but easier to deploy. |
Hi all, All the times reported are for a mac book pro (which has a particularly high bandwidth ssd), so I think it would be interesting to see the results in other machines. Specially @tmedani I would like to see how is it it takes between 10 and 30 min in your laptop and a few minutes in this apple. And also, how the numbers compare with the mex implementation. With these results in mind. Knowing that the implementation is ansi c, completely cross-platform and based on matlab's mex api. The code has about all the possible verification checks I've been able to think of so that it doesn't crash. It will compile for all 3 major operating systems and both for 32 and 64 word lengths. Thus, if this solution was to be adopted, it wouldn't require users to compile anything. I would like to add that if you still think that it is not a good idea, I would support it no problem. I did the implementation because I wanted to check the difference but that's all. Thanks. |
I'm a bit confused because I thought that you wanted to use MEX files to avoid writing the msh file on the hard drive, and pass it directly in memory to duneuro. This benchmark does not respond either to the main optimization proposed by @tmedani in this issue, which was to use binary instead of text for the other files. But thanks anyway, this is good to know. Would you ever use more than 1 million vertices? Given this benchmark, I'd say the main thing to consider is the ease of distribution and maintenance Your are now the most experienced with all these parameters, so you should probably make the decision. |
So, maybe I'm the one confused. But I'll explain the way I see it. Right now DUNEuro based tool is based on DUNE which only opens the mesh files as text This benchmark studies (or tries to? 😅 ) this third option. Option ii is also ok because you keep matlab code in on the matlab side and c++ code in the duneuro tool (which you're already compiling). But... I just can't get over the idea of reading and writing back a file, just to open it back again.
I think we go up to ~10M vertices. In my laptop that's up to ~5min but I can see it being ~20min in a non-ssd hard drive through the sata bus.
Completely understand. Just want to help. Well, this is working now. If you want to or feel like it could help. Let me know. |
If you think it can help, go ahead with further integration. |
Hi here is the results in my computer, starting from 1.000000e+05 vertices
|
Hi all, Always I'm learning new things here :) It is nice to know that some MEX API can be much faster than the current Matlab code and since the mex can work on all platforms maybe it worth it. few comments regarding the discussions,
From Juan tests, it seems that I overestimated the computation time, these numbers come from my previous discussions with the Duneuro team, and also from the basic testing scenarios that I did. as discussed with Juan, in order to use these med, we can also include the c/cpp code and then check internally if the user's computer has the c/cpp compiler in order to generate locally these mex files, otherwise, the standard Matlab code can be used. Regarding the CPP code, it seems that the i/o codes are part of DUNEURO and note DUNE,
Therefore we can define our own mesh format (maybe also for tensors, dipoles, and sensors), write the data in a binary from Matlab, and then read it from duneuro which then passes it to the FEM code, without any text file. I'm not sure how much time we can save regarding the efforts that are needed for all this. |
Hello,
This is in the todo list and we can discuss it here, low priority but important.
right now, the input for duneuro are ASCII files,
From brainstorm, in the case of the isotropic model, we use the *.msh
file for the geometry and *.cond for the conductivity and in the case of the anisotropy, we use the Cauchy files (.knw and .geo).
The w/r of these files takes ~10 to 30 min in the case of the millions of nodes and elements, which is around ~ 5% to ~20% of the computation time.
This is working, but we can improve by using binary input files.
This will need change on the duneuro c++ code (@juangpc ;) nice challenge)
Before that, we need to discuss which format to use as a standard between us and the duneuro team.
In SimBio the vista file format is used, https://www.mrt.uni-jena.de/simbio/index.php?title=File_Formats
Best
Takfarinas
The text was updated successfully, but these errors were encountered: