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

Make it build on Macos and fix how you template a container template #23

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from

Conversation

SokolAndrey
Copy link

@SokolAndrey SokolAndrey commented Nov 21, 2024

Successfully built and tested from the source code following the instructions in the README on

uname -msr
Darwin 23.6.0 arm64

Also tested the build on a Ubuntu machine with a simple script which encodes and decodes random text.

MallocExtension::instance()->ReleaseFreeMemory();
#endif
malloc_stats();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

malloc_stats() doesn't depend on TCMALLOC and requires malloc.h: https://man7.org/linux/man-pages/man3/malloc_stats.3.html

We shouldn't replace malloc.h with stdlib.h. Instead, all the parts of the code that depend on malloc.h must be skipped on macOS:

#ifdef __GLIBC__
#include <malloc.h>
#endif

#ifdef __GLIBC__
malloc_stats();
#endif

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That makes sense. I've tested it by building on both macos and ubuntu and running encoding/decoding. Do you think there is anything else I can test to make sure it actually works?

src/bpe_model_trainer.cc Outdated Show resolved Hide resolved
src/trainer_interface.cc Outdated Show resolved Hide resolved
@@ -289,7 +289,7 @@ namespace random {

std::mt19937 *GetRandomGenerator();

template <typename T, template<class> typename C>
template <typename T, template <typename...> class C>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must check that this doesn't break gcc on Linux, in return.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you pls give me some direction how we should test it besides building on a linux machine?

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

Successfully merging this pull request may close these issues.

3 participants