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

cleanup() should only be called on malloc'ed model parameters #2

Closed
marcelmaltry opened this issue Jun 4, 2020 · 2 comments
Closed

Comments

@marcelmaltry
Copy link

Hi, I just trained a model with two linear_spline layers and a branching_factor of 200,000, i.e.

cargo run --release -- somedata_100M_uint64 sosd_rmi linear_spline,linear_spline 200000

The resulting C++ program does not compile with the following error:

sosd_rmi.cpp:11:5: error: no matching function for call to 'free'
    free(L1_PARAMETERS);
    ^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/malloc/_malloc.h:42:7: note: candidate function not viable: no known conversion from 'const double [400000]' to 'void *' for 1st argument
void     free(void *);
         ^
1 error generated.

It seems like in the cleanup() function, free is called on L1_PARAMETERS although it was not allocated with malloc.

Looking at codegen::generate_code() free_code should possibly only be generated in case storage has value StorageConf::Disk(path), not in case of StorageConf::Embed.

@RyanMarcus
Copy link
Contributor

RyanMarcus commented Jun 4, 2020

Doh! Good catch. I'll start working on this. Looking to remove support for the Embed configuration anyway, since it leads to really long compile times of the C code.

@RyanMarcus
Copy link
Contributor

Alright, should be fixed now. I changed the default behavior to include model errors, so check the updated README as well. :)

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