Nathalie Furmento, le Tue 08 Mar 2011 10:38:14 +0100, a écrit :
> On 08/03/2011 10:31, Nathalie Furmento wrote:
> >I need to compile some CUDA applications on windows, these 
> >applications include (indirectly) hwloc.h.
> >
> >The nvcc compiler which uses windows visual studio complains it does 
> >not find the file unistd.h
> >
> >.../hwloc-win32-build-1.1.1/include\hwloc/config.h (104): fatal error 
> >C1083: Cannot open include file: 'unistd.h': No such file or directory
> >
> I just tried to comment out the include <unistd.h>, it gives another error:
> 
> .../hwloc-win32-build-1.1.1/include\hwloc.h (25): fatal error C1083: 
> Cannot open include file: 'stdint.h': No such file or directory

Could you try the attached patch?

Samuel
Index: include/hwloc.h
===================================================================
--- include/hwloc.h     (révision 3204)
+++ include/hwloc.h     (copie de travail)
@@ -21,9 +21,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <limits.h>
-#ifdef HWLOC_HAVE_STDINT_H
-#include <stdint.h>
-#endif

 /*
  * Symbol transforms
@@ -241,8 +238,8 @@

 /** \brief Object memory */
 struct hwloc_obj_memory_s {
-  uint64_t total_memory; /**< \brief Total memory (in bytes) in this object 
and its children */
-  uint64_t local_memory; /**< \brief Local memory (in bytes) */
+  hwloc_uint64_t total_memory; /**< \brief Total memory (in bytes) in this 
object and its children */
+  hwloc_uint64_t local_memory; /**< \brief Local memory (in bytes) */

   unsigned page_types_len; /**< \brief Size of array \p page_types */
   /** \brief Array of local memory page types, \c NULL if no local memory and 
\p page_types is 0.
@@ -251,8 +248,8 @@
    * It contains \p page_types_len slots.
    */
   struct hwloc_obj_memory_page_type_s {
-    uint64_t size;     /**< \brief Size of pages */
-    uint64_t count;    /**< \brief Number of pages of this size */
+    hwloc_uint64_t size;       /**< \brief Size of pages */
+    hwloc_uint64_t count;      /**< \brief Number of pages of this size */
   } * page_types;
 };

@@ -398,7 +395,7 @@
 union hwloc_obj_attr_u {
   /** \brief Cache-specific Object Attributes */
   struct hwloc_cache_attr_s {
-    uint64_t size;                       /**< \brief Size of cache in bytes */
+    hwloc_uint64_t size;                         /**< \brief Size of cache in 
bytes */
     unsigned depth;                      /**< \brief Depth of cache */
     unsigned linesize;                   /**< \brief Cache-line size in bytes 
*/
   } cache;
Index: include/hwloc/autogen/config.h.in
===================================================================
--- include/hwloc/autogen/config.h.in   (révision 3204)
+++ include/hwloc/autogen/config.h.in   (copie de travail)
@@ -1,7 +1,7 @@
 /* -*- c -*-
  * Copyright © 2009 CNRS
  * Copyright © 2009-2010 INRIA
- * Copyright © 2009-2010 Université Bordeaux 1
+ * Copyright © 2009-2011 Université Bordeaux 1
  * Copyright © 2009-2011 Cisco Systems, Inc.  All rights reserved.
  * See COPYING in top-level directory.
  */
@@ -97,22 +97,31 @@
 /* Defined to 1 if the CPU_SET macro works */
 #undef HWLOC_HAVE_CPU_SET

-/* Defined to 1 if you have the <stdint.h> header file. */
-#undef HWLOC_HAVE_STDINT_H
-
-#include <unistd.h>
-
 /* Defined to 1 if you have the `windows.h' header. */
 #undef HWLOC_HAVE_WINDOWS_H
 #undef hwloc_pid_t
 #undef hwloc_thread_t

 #ifdef HWLOC_HAVE_WINDOWS_H
+
 #  include <windows.h>
+typedef DWORDLONG hwloc_uint64_t;
+
 #else /* HWLOC_HAVE_WINDOWS_H */
+
 #  ifdef hwloc_thread_t
 #    include <pthread.h>
 #  endif /* hwloc_thread_t */
+
+/* Defined to 1 if you have the <stdint.h> header file. */
+#  undef HWLOC_HAVE_STDINT_H
+
+#  include <unistd.h>
+#  ifdef HWLOC_HAVE_STDINT_H
+#    include <stdint.h>
+#  endif
+typedef uint64_t hwloc_uint64_t;
+
 #endif /* HWLOC_HAVE_WINDOWS_H */

 /* Whether we need to re-define all the hwloc public symbols or not */

Reply via email to