Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] Single hwloc.h header files that work on linux and windows
From: Samuel Thibault (samuel.thibault_at_[hidden])
Date: 2013-01-03 16:42:33


Hello,

Rolf vandeVaart, le Thu 03 Jan 2013 22:30:58 +0100, a écrit :
> And config.h is specific to how the library was configured.

Not very much actually.

> Is there a special hwloc.h and supporting headers that is system independent so
> I can include them and build on both windows and linux?

There isn't any at the moment.

> Or do I need to have two different sets of header files, one for linux
> and one for windows? Perhaps I just need a config.h for windows and
> one for linux and select them at build time.

That should probably work. The whole beginning of config.h is always
the same. The only generated parts is the following, with comments:

- HWLOC_LINUX_SYS: just to know whether we are on Linux. That could have
  been an #ifdef __linux__ actually. That just defines whether
  hwloc_set_linuxfs_hooks is available, and enables some parts of the
  inlines, which you don't care about.

- HWLOC_HAVE_CPU_SET: That just defines whether we can provide the glibc
  inlines. Again, you don't care.

- HWLOC_HAVE_WINDOWS_H: Used only below in config.h, to provide the
  proper definition on windows or on Unix.

- hwloc_pid_t/hwloc_thread_t: will be either pid_t/pthread_t or HANDLE,
  depending on being on Unix or Windows.

- HWLOC_SYM_TRANSFORM, HWLOC_SYM_PREFIX, HWLOC_SYM_PREFIX_CAPS: These
  are only used for the embedded case, which I don't think you want to
  support.

So to summarize, having a windows version and a unix version should just
work.

Samuel