[hwloc-devel] Create success (hwloc git dev-1095-gf683068)

2016-04-05 Thread MPI Team
Creating nightly hwloc snapshot git tarball was a success.

Snapshot:   hwloc dev-1095-gf683068
Start time: Tue Apr  5 21:01:02 EDT 2016
End time:   Tue Apr  5 21:02:58 EDT 2016

Your friendly daemon,
Cyrador


Re: [hwloc-devel] Three patches for MSVC/ICL builds on Windows.

2016-04-05 Thread Peyton, Jonathan L
> This one is applied (not pushed yet).
Great!

> Samuel pushed a better fix
> I am dropping the dirent changes and just disabling hwloc-ps entirely on 
> Windows.
> The user32 part is applied.
This sounds good to me.

> For strdup and putenv, my MSVC fails with "The POSIX name for this item is 
> deprecated. Instead use the ISO C++ conformant name: _foo."
> I wonder why you didn't have this problem?
I got warnings instead of errors.  Did you compile with -WX?

> Is _stricmp() OK instead of your code for hwloc_strcasecmp() ?
Yes this seems fine.

> strncasecmp and strtoll don't seem needed anymore.
It seems strncasecmp has been replaced inside the source files as 
hwloc_strncasecmp() (except linux/solaris files) and strtoll isn't called 
anywhere.

> Don't you have S_IFMT and S_IFREG/DIR without _ prefix?
I sure do.  I had only seen _S_IFREG and _S_IFDIR in the MSDN documentation: 
https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx

-- Johnny

From: hwloc-devel [mailto:hwloc-devel-boun...@open-mpi.org] On Behalf Of Brice 
Goglin
Sent: Tuesday, April 5, 2016 9:51 AM
To: Hardware locality development list 
Subject: Re: [hwloc-devel] Three patches for MSVC/ICL builds on Windows.

More comments about individual changes below.

add-ifndef-guard-around-gnu-source.patch

diff --git a/config/hwloc.m4 b/config/hwloc.m4

index f249713..855244d 100644

--- a/config/hwloc.m4

+++ b/config/hwloc.m4

@@ -486,7 +486,9 @@ EOF])

 # program_invocation_name and __progname may be available but not exported 
in headers

 AC_MSG_CHECKING([for program_invocation_name])

 AC_TRY_LINK([

-#define _GNU_SOURCE

+#ifndef _GNU_SOURCE

+# define _GNU_SOURCE

+#endif

 #include 

 #include 

 extern char *program_invocation_name;

[...]

This one is applied (not pushed yet).


use-ac-check-decl.patch

diff --git a/config/hwloc.m4 b/config/hwloc.m4

index 855244d..49955a6 100644

--- a/config/hwloc.m4

+++ b/config/hwloc.m4

@@ -367,7 +367,7 @@ EOF])

 AC_CHECK_HEADERS([ctype.h])



 AC_CHECK_FUNCS([strncasecmp], [

-  _HWLOC_CHECK_DECL([strncasecmp], [

+  AC_CHECK_DECLS([strncasecmp], [

  AC_DEFINE([HWLOC_HAVE_DECL_STRNCASECMP], [1], [Define to 1 if function 
`strncasecmp' is declared by system headers])

   ])

 ])

[...]

Samuel pushed a better fix (already in master, I'll backport to v1.11.x after 
checking the configure logs on our regression platform)


windows-compatibility-changes.patch

diff --git a/config/hwloc.m4 b/config/hwloc.m4

index 49955a6..12230e1 100644

--- a/config/hwloc.m4

+++ b/config/hwloc.m4

@@ -362,7 +362,7 @@ EOF])

 #



 AC_CHECK_HEADERS([unistd.h])

-AC_CHECK_HEADERS([dirent.h])

+AC_CHECK_HEADERS([dirent.h], [hwloc_have_dirent=yes])

 AC_CHECK_HEADERS([strings.h])

 AC_CHECK_HEADERS([ctype.h])

I am dropping the dirent changes and just disabling hwloc-ps entirely on 
Windows.



+AC_CHECK_LIB([user32], [PostQuitMessage], [hwloc_have_user32="yes"])



The user32 part is applied.




@@ -381,6 +381,21 @@ static __hwloc_inline int hwloc_strncasecmp(const char 
*s1, const char *s2, size

 #endif

 }



+static __hwloc_inline int hwloc_strcasecmp(const char *s1, const char *s2)

+{

+#ifdef HWLOC_HAVE_DECL_STRCASECMP

+  return strcasecmp(s1, s2);

+#else

+  while (1) {

+char c1 = tolower(*s1), c2 = tolower(*s2);

+if (!c1 || !c2 || c1 != c2)

+  return c1-c2;

+s1++; s2++;

+  }

+  return 0;

+#endif

+}

+

 static __hwloc_inline hwloc_obj_type_t hwloc_cache_type_by_depth_type(unsigned 
depth, hwloc_obj_cache_type_t type)

 {

   if (type == HWLOC_OBJ_CACHE_INSTRUCTION) {

@@ -407,4 +422,25 @@ static __hwloc_inline int hwloc_obj_type_is_io 
(hwloc_obj_type_t type)

   return type >= HWLOC_OBJ_BRIDGE && type <= HWLOC_OBJ_OS_DEVICE;

 }



+#ifdef HWLOC_WIN_SYS

+#  ifndef HAVE_SSIZE_T

+typedef SSIZE_T ssize_t;

+#  endif

+#  ifndef HAVE_SNPRINTF

+#define snprintf hwloc_snprintf

+#  endif

+#  if !HAVE_DECL_STRTOULL && !defined(HAVE_STRTOULL)

+#define strtoull _strtoui64

+#  endif

+#  if !HAVE_DECL_S_ISREG

+#define S_ISREG(mode) (mode & _S_IFREG)

+#  endif

+#  if !HAVE_DECL_S_ISDIR

+#define S_ISDIR(mode) (mode & _S_IFDIR)

+#  endif

+#  ifndef HAVE_STRCASECMP

+#define strcasecmp hwloc_strcasecmp

+#  endif

+#endif

+

 #endif /* HWLOC_PRIVATE_MISC_H */

Overall this looks OK.

In the MSVC project under contrib/windows/, we use a hardwired hwloc_config.h 
which says:
typedef SSIZE_T ssize_t;
#define snprintf _snprintf
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strdup _strdup
#define strtoull _strtoui64
#define strtoll _strtoi64
#define S_ISREG(m) ((m)&_S_IFREG)
#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
#define putenv _putenv

strncasecmp and strtoll don't seem needed anymore.

For strdup and putenv, my MSVC fails with "The POSIX name for this item is 
deprecated. Instead use the 

Re: [hwloc-devel] Three patches for MSVC/ICL builds on Windows.

2016-04-05 Thread Brice Goglin
More comments about individual changes below.

> add-ifndef-guard-around-gnu-source.patch
> diff --git a/config/hwloc.m4 b/config/hwloc.m4
> index f249713..855244d 100644
> --- a/config/hwloc.m4
> +++ b/config/hwloc.m4
> @@ -486,7 +486,9 @@ EOF])
>  # program_invocation_name and __progname may be available but not 
> exported in headers
>  AC_MSG_CHECKING([for program_invocation_name])
>  AC_TRY_LINK([
> - #define _GNU_SOURCE
> + #ifndef _GNU_SOURCE
> + # define _GNU_SOURCE
> + #endif
>   #include 
>   #include 
>   extern char *program_invocation_name;
> [...]

This one is applied (not pushed yet).

> use-ac-check-decl.patch
> diff --git a/config/hwloc.m4 b/config/hwloc.m4
> index 855244d..49955a6 100644
> --- a/config/hwloc.m4
> +++ b/config/hwloc.m4
> @@ -367,7 +367,7 @@ EOF])
>  AC_CHECK_HEADERS([ctype.h])
>  
>  AC_CHECK_FUNCS([strncasecmp], [
> -  _HWLOC_CHECK_DECL([strncasecmp], [
> +  AC_CHECK_DECLS([strncasecmp], [
>   AC_DEFINE([HWLOC_HAVE_DECL_STRNCASECMP], [1], [Define to 1 if function 
> `strncasecmp' is declared by system headers])
>])
>  ])
> [...]

Samuel pushed a better fix (already in master, I'll backport to v1.11.x
after checking the configure logs on our regression platform)

> windows-compatibility-changes.patch
> diff --git a/config/hwloc.m4 b/config/hwloc.m4
> index 49955a6..12230e1 100644
> --- a/config/hwloc.m4
> +++ b/config/hwloc.m4
> @@ -362,7 +362,7 @@ EOF])
>  #
>  
>  AC_CHECK_HEADERS([unistd.h])
> -AC_CHECK_HEADERS([dirent.h])
> +AC_CHECK_HEADERS([dirent.h], [hwloc_have_dirent=yes])
>  AC_CHECK_HEADERS([strings.h])
>  AC_CHECK_HEADERS([ctype.h])

I am dropping the dirent changes and just disabling hwloc-ps entirely on
Windows.

> +AC_CHECK_LIB([user32], [PostQuitMessage], [hwloc_have_user32="yes"])
>

The user32 part is applied.


> @@ -381,6 +381,21 @@ static __hwloc_inline int hwloc_strncasecmp(const char 
> *s1, const char *s2, size
>  #endif
>  }
>  
> +static __hwloc_inline int hwloc_strcasecmp(const char *s1, const char *s2)
> +{
> +#ifdef HWLOC_HAVE_DECL_STRCASECMP
> +  return strcasecmp(s1, s2);
> +#else
> +  while (1) {
> +char c1 = tolower(*s1), c2 = tolower(*s2);
> +if (!c1 || !c2 || c1 != c2)
> +  return c1-c2;
> +s1++; s2++;
> +  }
> +  return 0;
> +#endif
> +}
> +
>  static __hwloc_inline hwloc_obj_type_t 
> hwloc_cache_type_by_depth_type(unsigned depth, hwloc_obj_cache_type_t type)
>  {
>if (type == HWLOC_OBJ_CACHE_INSTRUCTION) {
> @@ -407,4 +422,25 @@ static __hwloc_inline int hwloc_obj_type_is_io 
> (hwloc_obj_type_t type)
>return type >= HWLOC_OBJ_BRIDGE && type <= HWLOC_OBJ_OS_DEVICE;
>  }
>  
> +#ifdef HWLOC_WIN_SYS
> +#  ifndef HAVE_SSIZE_T
> +typedef SSIZE_T ssize_t;
> +#  endif
> +#  ifndef HAVE_SNPRINTF
> +#define snprintf hwloc_snprintf
> +#  endif
> +#  if !HAVE_DECL_STRTOULL && !defined(HAVE_STRTOULL)
> +#define strtoull _strtoui64
> +#  endif
> +#  if !HAVE_DECL_S_ISREG
> +#define S_ISREG(mode) (mode & _S_IFREG)
> +#  endif
> +#  if !HAVE_DECL_S_ISDIR
> +#define S_ISDIR(mode) (mode & _S_IFDIR)
> +#  endif
> +#  ifndef HAVE_STRCASECMP
> +#define strcasecmp hwloc_strcasecmp
> +#  endif
> +#endif
> +
>  #endif /* HWLOC_PRIVATE_MISC_H */

Overall this looks OK.

In the MSVC project under contrib/windows/, we use a hardwired
hwloc_config.h which says:
typedef SSIZE_T ssize_t;
#define snprintf _snprintf
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strdup _strdup
#define strtoull _strtoui64
#define strtoll _strtoi64
#define S_ISREG(m) ((m)&_S_IFREG)
#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
#define putenv _putenv

strncasecmp and strtoll don't seem needed anymore.

For strdup and putenv, my MSVC fails with "The POSIX name for this item
is deprecated. Instead use the ISO C++ conformant name: _foo."
I wonder why you didn't have this problem?

Is _stricmp() OK instead of your code for hwloc_strcasecmp() ?

Don't you have S_IFMT and S_IFREG/DIR without _ prefix?

Brice



Re: [hwloc-devel] Three patches for MSVC/ICL builds on Windows.

2016-04-05 Thread Samuel Thibault
Brice Goglin, on Tue 05 Apr 2016 10:39:29 +0200, wrote:
> Le 05/04/2016 10:26, Samuel Thibault a écrit :
> > The bug here is that that HWLOC_CHECK_DECL assumed that availability
> > of the function was tested before, i.e.
> >> conftest.c(96) : fatal error C1083: Cannot open include file: 'sched.h': No
> >> such file or directory
> > was unexpected.
> 
> Adding a check for sched.h availability before CHECK_DECL() might be
> enough for Jonathan's case. I am  not sure I want to change this m4 code
> in v1.11.3 since it has been working fine for years.

Well, we can as well just use AC_CHECK_DECL in v1.11.3, it'll just get
the same result as what the code currently expects, and not the bug.

Samuel


Re: [hwloc-devel] Three patches for MSVC/ICL builds on Windows.

2016-04-05 Thread Brice Goglin
Le 05/04/2016 10:26, Samuel Thibault a écrit :
> The bug here is that that HWLOC_CHECK_DECL assumed that availability
> of the function was tested before, i.e.
>> conftest.c(96) : fatal error C1083: Cannot open include file: 'sched.h': No
>> such file or directory
> was unexpected.
>

Adding a check for sched.h availability before CHECK_DECL() might be
enough for Jonathan's case. I am  not sure I want to change this m4 code
in v1.11.3 since it has been working fine for years.

Brice