-
Notifications
You must be signed in to change notification settings - Fork 116
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
Very slow build of the bspline object #133
Comments
Hi Lucian, Glad that you may have a use case for SPLINTER. I did a quick test and on my computer a cubic (degree 3) B-spline interpolates a 200x200 table in approximately 10 seconds. I ran this single-threaded on an Intel Core i7-8700K CPU. Note that I used the Python interface and the compiled source in develop-branch. We haven't released this version, but if I remember correctly it should have equal performance to the latest release. Regarding interpolation of larger tables:
Please keep us posted! Bjarne EDIT: The above example used a version of SPLINTER compiled to debug mode. In release mode, building the B-spline takes less than 0.5 seconds. |
Hi Bjarne Thank you for the quick feedback. For me, the 200x200 tables take about 4 minutes. When using a resolution of 1000x1000, i kept it running over the night, but it did not finish. The degree order is set to 2. This is true for all thermophysical tables. The full call to the splinter library looks as follows:
The output looks as follows for the table h = f(p,T):
The material I am looking at is liquid hydrogen in the vicinity of the two phase region. Hence, there are some considerable jumps in the properties when passing from the liquid to the gaseous region. In case, I can also provide you the table including a small Matlab routine to visualize the data in a plot. The output looks as follows for e.g. the density = f(p,h) You mentioned to use a different solver from the Eigen-library. How can I achieve this? Is there a function to select a different solver? Which one would you suggest? Also the tables usually never change. So yes, it would absolutely make sense to store the bspline. Also here, how can I save and load them from within my c++ code? Although, as said above 1000x1000 is currently not working for me. Thank you so much |
Hi Bjarne Sorry for the new message, but I did some further testing and it does not look like it is related to my tables. In the folder that I cloned from your git repository, there is a folder called test. I compiled the sources as shown below using two different levels of optimization.
The executable is then started using:
I modified bsplinetestingutilities.cpp so that it creates a table of 200x200 instead 20x20 and added some runtime statements as shown below:
The output is the following and shows that even when using your testing function, the build commands takes around 3min.
Can you tell me whether you encounter the same behavior on your side? My CPU is a Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz |
Thank you for posting your test results. When inspecting your output, I noticed that SPLINTER prints the following line "BSpline::Builder::computeBSplineCoefficients: Computing B-spline control points using sparse solver." I think this means that SPLINTER has been compiled to debug mode. Perhaps you can try to compile to release mode by adding the flag -DNDEBUG. |
Another follow-up. I went back to check if had tested SPLINTER in debug mode myself, and indeed I had. I made an edit to my previous comment to mention this. When the sources are compiled to release mode, the 200x200 grid interpolation takes less than 0.5 seconds and the 1000x1000 grid interpolation takes around 100 seconds. |
Hi Bjarne Thank you for your inputs, I recompiled with the -DNDEBUG flag, however, the change is not as you mention in my case. I tried the following:
Again, thank you a lot for your time and assistance |
I am building with CMake using the configuration in CMakeLists.txt. My quick test was a modified version of the Python-example in I will try to get some assistance from @gablank, who made SPLINTERS compiler setup. |
That would be great. We believe that having smooth interpolation of our table data could |
Another follow up from my side. I switched to the python example you mentioned and increased the resolution to 200x200.
And for the monitoring of time
Gives me the following output
|
At the top of the script you'll see a line that looks like this: Have you made sure to compile to release mode? With my build setup, I have to change the path to: Last thing I can think of is to also test building from the develop-branch, like I did. But as I said earlier, I do not believe that to be the issue. |
Yes, I changed this line since i installed in
This should be correct, if I am not wrong? |
It looks correct to me... Do you mind testing the develop-branch? I see that the example has been modified since the version in the master branch (the degree of the spline is a bit different). I have mentioned your issue to @gablank. He is quite busy at the moment and it may take a few days before he can look at it. |
Yes, i checked out the develop branch but when running the same python command i get the following error:
|
You can try to manually add the file |
Ok, just copied the version-file from splinter/version to splinter/python/splinterpy
So, it looks as if this changes quite a bit |
Hello, Cool to hear you have an interesting use for our library! Could you run |
That was quite the difference. Happy you finally got the numbers down. I will have to take a look at the changes we have made in the develop branch to pin down the culprit. I cannot remember introducing such significant improvements to the interpolation performance. Hopefully, @gablank and I will get around to preparing release 4.0 within next week. Please let us know if you wish to help in any way or if you have any suggestions for final improvements. |
I tried to recompile my c++ sources with the development library. However, although following the docs/cpp_interface.mp
What would be the correct syntax here? |
Ok, i believe the correct syntax should be without the
For my CFD solver, the time to build the interpolator has decreased for 300x300 tables from 1150seconds to 5seconds, a factor of 230. Thank you again for all the assistance. |
Hi Bjarne The library seams to work. However, I encounter problems when switching to degree's higher than 1. Kindly |
Hi everyone
I integrated the splinter library into an inhouse cfd software for testing with lookup-table methods.
As I have tables for various thermophysical quantities (e.g. rho = f(p,h), ....) I create an BSpline object
for each of these tables.
splinterPtr_ = make_unique<SPLINTER::BSpline>(SPLINTER::BSpline::Builder(samples).degree(order_).build());
Originally, I was using an internal implementation for table interpolation using tables with a resolution if 1000x1000,
but I had to realize this seams to be too fine for BSpline. However, even when using a relatively coarse table of 200x200,
the command shown above takes several minutes to complete. Is this a normal behavior? Any options to accelerate this
process?
Kindly
Lucian
The text was updated successfully, but these errors were encountered: