ralna / spral

Sparse Parallel Robust Algorithms Library
https://ralna.github.io/spral/
Other
104 stars 27 forks source link

Review outdated checks in config.h #135

Open jfowkes opened 11 months ago

jfowkes commented 11 months ago

The current autotools based build system generates a config.h with defines based on the dependencies and headers available on a user's system. The thing is, a lot of these are almost always present and it seems pointless to have defines that work around them.

Here is an example generated config.h:

/* config.h.  Generated from config.h.in by configure.  */
/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Define to 1 to enable analyse debugging */
/* #undef ANALDBG */

/* Define to dummy `main' function (if any) required to link to the Fortran
   libraries. */
/* #undef F77_DUMMY_MAIN */

/* Define if F77 and FC dummy `main' functions are identical. */
/* #undef FC_DUMMY_MAIN_EQ_F77 */

/* Define if you have a BLAS library. */
#define HAVE_BLAS 1

/* Define if you have a GTG library. */
/* #undef HAVE_GTG */

/* Define if you have hwloc library */
#define HAVE_HWLOC 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define if you have LAPACK library. */
#define HAVE_LAPACK 1

/* Define if you have a MeTiS library. */
#define HAVE_METIS 1

/* Define to 1 if you have the <metis.h> header file. */
/* #undef HAVE_METIS_H */

/* Define to 1 if you are compiling against NVCC */
/* #undef HAVE_NVCC */

/* Define to 1 if you have sched_getcpu(). */
#define HAVE_SCHED_GETCPU 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Name of package */
#define PACKAGE "spral"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "hsl@stfc.ac.uk"

/* Define to the full name of this package. */
#define PACKAGE_NAME "spral"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "spral 2023.09.07"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "spral"

/* Define to the home page for this package. */
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "2023.09.07"

/* Define to 1 to enable profiling */
/* #undef PROFILE */

/* The size of `idx_t', as computed by sizeof. */
/* #undef SIZEOF_IDX_T */

/* Define to 1 if you have metis.h. */
#define SPRAL_HAVE_METIS_H 0

/* Define to 1 if all of the C90 standard headers exist (not just the ones
   required in a freestanding environment). This macro is provided for
   backward compatibility; new code need not use it. */
#define STDC_HEADERS 1

/* Version number of package */
#define VERSION "2023.09.07"

Ideally we should be able to remove a lot of these from the codebase with no adverse effects.

jfowkes commented 11 months ago

Looking into these defines in more detail we have the following.

These defines are currently used by the SPRAL codebase and are required:

HAVE_HWLOC -- used to detect NUMA regions
SPRAL_HAVE_METIS_H -- used to define METIS5 32bit/64bit index types
SIZEOF_IDX_T -- used to define METIS5 32bit/64bit index types
HAVE_NVCC -- used to build CUDA kernels
HAVE_SCHED_GETCPU -- used to check if sched_getcpu() can be used

These defines are currently used in the SPRAL codebase for profiling/analysis:

ANALDBG -- enables debugging of SSIDS analyse phase
HAVE_GTG -- the GTG library used for profiling
PROFILE -- enables profiling using the GTG library

The remaining defines are automatically generated by autotools but not used by SPRAL.

@amontoison for meson we only really need the first five to be defined.

jfowkes commented 11 months ago

Also after testing the SPRAL_HAVE_METIS_H set by spral_metis.m4 macro only detects metis.h if --with-metis-inc-dir=/path/to/metis.h is passed to configure. In particular this means that 64bit integer support for METIS5 does not currently work unless this option is specified (SPRAL defaults to 32bit). See #136 for details.