Skip to content
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

Custom function fails to to fit in Python, only performing a single iteration. #102

Open
kulius7 opened this issue Feb 4, 2022 · 1 comment

Comments

@kulius7
Copy link

kulius7 commented Feb 4, 2022

Hello,
I am struggling to define a custom fitting function for use in pyGpufit.
I have already tried several variations, but never had a successful fit, so I would appreciate some help or tips.
If this is the wrong place to present such a problem, please feel free to remove it or let me know.
The function in question is a 2-dimensional parametric ellipse equation, defined as follows:
2d_ellipse_equation
I followed the documentation when implementing the function. All necessary prerequisites (CUDA, Python, Visual Studio, etc.) are installed. The function was defined as ELLIPSE_2D with ModelID = 13 in the constants.h. The cuda device function, ellipse_2d.cuh containing all partial derivatives was written and thoroughly checked. I have attached it to this issue, please mind that I can't program in C/C++ and thus adapted the gauss2d.cuh device function file.
The .cuh file was included in models.cuh, as well as the switch case was added.
I used CMake GUI to configure the compiler, opened the solution file with Visual Studio 2022 and Re-built the project (I tried Debug and Release configs). No errors were encountered here.
The GpuFit.dll file, as well as the modified gpufit.py files were then used to perform a test fit of this ellipse function. For the actual test fit I modified the gauss2d.py example file, which was included.
I am fairly certain that the issue lies with the custom function, since simply changing the ModelID to another function (from 13 to e.g. 2) in Python with the custom-built library starts fitting, also noticeable in sustained load on the GPU (with a sufficient number of fits). Fitting using the custom function with ModelID = 13 however, will finish within a few seconds, no matter the specified number of fits and always returning the unchanged, initial parameters.
I have included all altered files in a zip file, as well as the testing file in Python.
gpufit_issue.zip
Any help or insight would be greatly appreciated!

@superchromix
Copy link
Collaborator

Have you checked the return value of the call to gpufit(), and the output_states parameter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants