Skip to content

Commit

Permalink
bring back android part
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxson committed Sep 6, 2024
1 parent c4a1276 commit 89e70fe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -19556,7 +19556,7 @@ static bool ggml_thread_apply_priority(int32_t prio) {
return true;
}

#elif (defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
#elif defined(__gnu_linux__)
// TODO: this may not work on BSD, to be verified

static bool ggml_thread_apply_affinity(const bool * mask) {
Expand All @@ -19572,7 +19572,14 @@ static bool ggml_thread_apply_affinity(const bool * mask) {
}
}

#ifdef __ANDROID__
err = sched_setaffinity(0, sizeof(cpuset), &cpuset);
if (err < 0) {
err = errno;
}
#else
err = pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
#endif
if (err != 0) {
fprintf(stderr, "warn: failed to set affinity mask 0x%llx : %s (%d)\n", (unsigned long long)mask, strerror(err), err);
return false;
Expand Down

0 comments on commit 89e70fe

Please sign in to comment.