Skip to content

Commit

Permalink
Merge pull request #279 from wdmapp/pr/mac-fix
Browse files Browse the repository at this point in the history
workaround mem_info compile error on MacOS
  • Loading branch information
germasch authored Sep 22, 2023
2 parents b010a07 + ac7f154 commit eb9bd37
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/gtensor/backend_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#include <algorithm>
#include <cstdint>

#ifdef __linux__
#include <sys/sysinfo.h>
#endif

// ======================================================================
// gt::backend::host
Expand Down Expand Up @@ -69,10 +71,15 @@ class backend_ops<gt::space::host>

static void mem_info(size_t* free, size_t* total)
{
#ifdef __linux__
struct sysinfo info;
sysinfo(&info);
*total = info.totalram;
*free = info.freeram;
#else
*total = 0;
*free = 0;
#endif
}
};

Expand Down

0 comments on commit eb9bd37

Please sign in to comment.