diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2a2cfa23dd..2d2600b0cb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -78,13 +78,16 @@ jobs: - name: build run: | - make CMAKE_OPTIONS="-G\"Unix Makefiles\" \ - -DCMAKE_BUILD_TYPE=Release \ + make CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER_LAUNCHER='ccache' \ -DCMAKE_CXX_COMPILER_LAUNCHER='ccache' \ -DCMAKE_Fortran_COMPILER_LAUNCHER='ccache' \ -DBLA_VENDOR=OpenBLAS" + - name: check + run: | + make demos + - name: ccache status continue-on-error: true run: ccache -s @@ -182,13 +185,19 @@ jobs: - name: build run: | - make CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release \ + make CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=\"${MINGW_PREFIX}\" \ + -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER_LAUNCHER='ccache' \ -DCMAKE_CXX_COMPILER_LAUNCHER='ccache' \ -DCMAKE_Fortran_COMPILER_LAUNCHER='ccache' \ - -DENABLE_CUDA=OFF \ -DBLA_VENDOR=OpenBLAS" + - name: check + # Need to install the libraries for the tests + run: | + make install + make demos + - name: ccache status continue-on-error: true run: ccache -s diff --git a/ChangeLog b/ChangeLog index e1d97c7380..71d1e8a352 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Dec 23, 2022: SuiteSparse 6.0.3 + + * GraphBLAS v7.4.0: added non-va_arg get/set methods. + * Mongoose v3.0.3: change in build for test coverage + Dec 9, 2022: SuiteSparse 6.0.2 * minor change to build system for nearly all packages: (except CSparse, diff --git a/GraphBLAS/CMakeLists.txt b/GraphBLAS/CMakeLists.txt index 7631548e01..4f928fc46c 100644 --- a/GraphBLAS/CMakeLists.txt +++ b/GraphBLAS/CMakeLists.txt @@ -14,10 +14,10 @@ cmake_minimum_required ( VERSION 3.19 ) # version of SuiteSparse:GraphBLAS -set ( GraphBLAS_DATE "Dec 9, 2022" ) +set ( GraphBLAS_DATE "Dec 23, 2022" ) set ( GraphBLAS_VERSION_MAJOR 7 ) -set ( GraphBLAS_VERSION_MINOR 3 ) -set ( GraphBLAS_VERSION_SUB 3 ) +set ( GraphBLAS_VERSION_MINOR 4 ) +set ( GraphBLAS_VERSION_SUB 0 ) # GraphBLAS C API Specification version, at graphblas.org set ( GraphBLAS_API_DATE "Nov 15, 2021" ) diff --git a/GraphBLAS/Config/GraphBLAS.h.in b/GraphBLAS/Config/GraphBLAS.h.in index 4b84dd8cb0..917e67df0c 100644 --- a/GraphBLAS/Config/GraphBLAS.h.in +++ b/GraphBLAS/Config/GraphBLAS.h.in @@ -577,6 +577,22 @@ GrB_Info GxB_Desc_set // set a parameter in a descriptor ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Desc_set_INT32 // set a parameter in a descriptor +( + GrB_Descriptor desc, // descriptor to modify + GrB_Desc_Field field, // parameter to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Desc_set_FP64 // set a parameter in a descriptor +( + GrB_Descriptor desc, // descriptor to modify + GrB_Desc_Field field, // parameter to change + double value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Desc_get // get a parameter from a descriptor ( @@ -585,6 +601,22 @@ GrB_Info GxB_Desc_get // get a parameter from a descriptor ... // value of the parameter ) ; +GB_PUBLIC +GrB_Info GxB_Desc_get_INT32 // get a parameter from a descriptor +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + GrB_Desc_Field field, // parameter to query + int32_t *value // return value of the descriptor +) ; + +GB_PUBLIC +GrB_Info GxB_Desc_get_FP64 // get a parameter from a descriptor +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + GrB_Desc_Field field, // parameter to query + double *value // return value of the descriptor +) ; + GB_PUBLIC GrB_Info GrB_Descriptor_free // free a descriptor ( @@ -4530,6 +4562,22 @@ GrB_Info GxB_Matrix_Option_set // set an option in a matrix ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Matrix_Option_set_INT32 // set an option in a matrix +( + GrB_Matrix A, // matrix to modify + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Matrix_Option_set_FP64 // set an option in a matrix +( + GrB_Matrix A, // matrix to modify + GxB_Option_Field field, // option to change + double value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix ( @@ -4538,6 +4586,22 @@ GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix ... // return value of the matrix option ) ; +GB_PUBLIC +GrB_Info GxB_Matrix_Option_get_INT32 // gets the current option of a matrix +( + GrB_Matrix A, // matrix to query + GxB_Option_Field field, // option to query + int32_t *value // return value of the matrix option +) ; + +GB_PUBLIC +GrB_Info GxB_Matrix_Option_get_FP64 // gets the current option of a matrix +( + GrB_Matrix A, // matrix to query + GxB_Option_Field field, // option to query + double *value // return value of the matrix option +) ; + GB_PUBLIC GrB_Info GxB_Vector_Option_set // set an option in a vector ( @@ -4546,6 +4610,22 @@ GrB_Info GxB_Vector_Option_set // set an option in a vector ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Vector_Option_set_INT32 // set an option in a vector +( + GrB_Vector v, // vector to modify + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Vector_Option_set_FP64 // set an option in a vector +( + GrB_Vector v, // vector to modify + GxB_Option_Field field, // option to change + double value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Vector_Option_get // gets the current option of a vector ( @@ -4554,6 +4634,22 @@ GrB_Info GxB_Vector_Option_get // gets the current option of a vector ... // return value of the vector option ) ; +GB_PUBLIC +GrB_Info GxB_Vector_Option_get_INT32 // gets the current option of a vector +( + GrB_Vector v, // vector to query + GxB_Option_Field field, // option to query + int32_t *value // return value of the vector option +) ; + +GB_PUBLIC +GrB_Info GxB_Vector_Option_get_FP64 // gets the current option of a vector +( + GrB_Vector v, // vector to query + GxB_Option_Field field, // option to query + double *value // return value of the vector option +) ; + // GxB_Global_Option_set controls the global defaults used when a new matrix is // created. GrB_init defines the following initial settings: // @@ -4576,6 +4672,41 @@ GrB_Info GxB_Global_Option_set // set a global default option ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Global_Option_set_INT32 // set a global default option +( + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_FP64 // set a global default option +( + GxB_Option_Field field, // option to change + double value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_FP64_ARRAY // set a global default option +( + GxB_Option_Field field, // option to change + double *value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_INT64_ARRAY // set a global default option +( + GxB_Option_Field field, // option to change + int64_t *value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_FUNCTION // set a global default option +( + GxB_Option_Field field, // option to change + void *value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Global_Option_get // gets the current global default option ( @@ -4583,6 +4714,41 @@ GrB_Info GxB_Global_Option_get // gets the current global default option ... // return value of the global option ) ; +GB_PUBLIC +GrB_Info GxB_Global_Option_get_INT32 // gets the current global option +( + GxB_Option_Field field, // option to query + int32_t *value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_FP64 // gets the current global option +( + GxB_Option_Field field, // option to query + double *value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_INT64 // gets the current global option +( + GxB_Option_Field field, // option to query + int64_t *value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_CHAR // gets the current global option +( + GxB_Option_Field field, // option to query + char **value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_FUNCTION // gets the current global option +( + GxB_Option_Field field, // option to query + void **value // return value of the global option +) ; + //------------------------------------------------------------------------------ // GxB_set and GxB_get //------------------------------------------------------------------------------ diff --git a/GraphBLAS/Doc/ChangeLog b/GraphBLAS/Doc/ChangeLog index 1fefe4c7ba..215438147b 100644 --- a/GraphBLAS/Doc/ChangeLog +++ b/GraphBLAS/Doc/ChangeLog @@ -1,3 +1,14 @@ +Version 7.4.0, Dec 23, 2022 + + * added non-va_arg methods: va_arg-based GxB_get/set methods are ANSI C11 + but cause issues for cffi in Python. As a temporary workaround, new + methods have been added that do not use va_arg. The existing + GxB_get/set methods are not changed. The new methods are not in the + user guide, since all of the GxB_get/set methods will be superceded + with GrB_get/set in the v2.1 C API. At that point, all GxB_get/set + methods will become historical (kept, not deprecated, but removed from + the user guide). + Version 7.3.3, Dec 9, 2022 * minor change to build system diff --git a/GraphBLAS/Doc/GraphBLAS_UserGuide.pdf b/GraphBLAS/Doc/GraphBLAS_UserGuide.pdf index 6d30449c8e..003d2ba78f 100644 Binary files a/GraphBLAS/Doc/GraphBLAS_UserGuide.pdf and b/GraphBLAS/Doc/GraphBLAS_UserGuide.pdf differ diff --git a/GraphBLAS/Doc/GraphBLAS_UserGuide.tex b/GraphBLAS/Doc/GraphBLAS_UserGuide.tex index e436eb31dd..94cc74250b 100644 --- a/GraphBLAS/Doc/GraphBLAS_UserGuide.tex +++ b/GraphBLAS/Doc/GraphBLAS_UserGuide.tex @@ -15488,6 +15488,20 @@ \section{Release Notes} \begin{itemize} +\item Version 7.4.0 (Dec 23, 2022) + + \begin{itemize} + \item add non-\verb'va_arg' methods: \verb'va_arg'-based \verb'GxB_get/set' + methods are ANSI C11 but cause issues for cffi in Python. As a + temporary workaround, new methods have been added that do not use + \verb'va_arg'. The existing \verb'GxB_get/set' methods are not + changed. The new methods are not in the user guide, since all of the + \verb'GxB_get/set' methods will be superceded with \verb'GrB_get/set' + in the v2.1 C API. At that point, all \verb'GxB_get/set' methods will + become historical (kept, not deprecated, but removed from the user + guide). + \end{itemize} + \item Version 7.3.3 (Dec 9, 2022) \begin{itemize} diff --git a/GraphBLAS/Doc/GraphBLAS_version.tex b/GraphBLAS/Doc/GraphBLAS_version.tex index 07b6307299..954892b5f7 100644 --- a/GraphBLAS/Doc/GraphBLAS_version.tex +++ b/GraphBLAS/Doc/GraphBLAS_version.tex @@ -1,5 +1,5 @@ % version of SuiteSparse:GraphBLAS \date{VERSION -7.3.3, -Dec 9, 2022} +7.4.0, +Dec 23, 2022} diff --git a/GraphBLAS/GraphBLAS/CMakeLists.txt b/GraphBLAS/GraphBLAS/CMakeLists.txt index ebd3ba6533..10f2b327f4 100644 --- a/GraphBLAS/GraphBLAS/CMakeLists.txt +++ b/GraphBLAS/GraphBLAS/CMakeLists.txt @@ -17,10 +17,10 @@ cmake_minimum_required ( VERSION 3.19 ) # date version must match ../CMakeLists.txt: # version of SuiteSparse:GraphBLAS -set ( GraphBLAS_DATE "Dec 9, 2022" ) +set ( GraphBLAS_DATE "Dec 23, 2022" ) set ( GraphBLAS_VERSION_MAJOR 7 ) -set ( GraphBLAS_VERSION_MINOR 3 ) -set ( GraphBLAS_VERSION_SUB 3 ) +set ( GraphBLAS_VERSION_MINOR 4 ) +set ( GraphBLAS_VERSION_SUB 0 ) message ( STATUS "Building SuiteSparse:GraphBLAS version: v" ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB} diff --git a/GraphBLAS/Include/GraphBLAS.h b/GraphBLAS/Include/GraphBLAS.h index 04263b37b9..8530d2a6fe 100644 --- a/GraphBLAS/Include/GraphBLAS.h +++ b/GraphBLAS/Include/GraphBLAS.h @@ -221,10 +221,10 @@ // The version of this implementation, and the GraphBLAS API version: #define GxB_IMPLEMENTATION_NAME "SuiteSparse:GraphBLAS" -#define GxB_IMPLEMENTATION_DATE "Dec 9, 2022" +#define GxB_IMPLEMENTATION_DATE "Dec 23, 2022" #define GxB_IMPLEMENTATION_MAJOR 7 -#define GxB_IMPLEMENTATION_MINOR 3 -#define GxB_IMPLEMENTATION_SUB 3 +#define GxB_IMPLEMENTATION_MINOR 4 +#define GxB_IMPLEMENTATION_SUB 0 #define GxB_SPEC_DATE "Nov 15, 2021" #define GxB_SPEC_MAJOR 2 #define GxB_SPEC_MINOR 0 @@ -577,6 +577,22 @@ GrB_Info GxB_Desc_set // set a parameter in a descriptor ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Desc_set_INT32 // set a parameter in a descriptor +( + GrB_Descriptor desc, // descriptor to modify + GrB_Desc_Field field, // parameter to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Desc_set_FP64 // set a parameter in a descriptor +( + GrB_Descriptor desc, // descriptor to modify + GrB_Desc_Field field, // parameter to change + double value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Desc_get // get a parameter from a descriptor ( @@ -585,6 +601,22 @@ GrB_Info GxB_Desc_get // get a parameter from a descriptor ... // value of the parameter ) ; +GB_PUBLIC +GrB_Info GxB_Desc_get_INT32 // get a parameter from a descriptor +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + GrB_Desc_Field field, // parameter to query + int32_t *value // return value of the descriptor +) ; + +GB_PUBLIC +GrB_Info GxB_Desc_get_FP64 // get a parameter from a descriptor +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + GrB_Desc_Field field, // parameter to query + double *value // return value of the descriptor +) ; + GB_PUBLIC GrB_Info GrB_Descriptor_free // free a descriptor ( @@ -4530,6 +4562,22 @@ GrB_Info GxB_Matrix_Option_set // set an option in a matrix ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Matrix_Option_set_INT32 // set an option in a matrix +( + GrB_Matrix A, // matrix to modify + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Matrix_Option_set_FP64 // set an option in a matrix +( + GrB_Matrix A, // matrix to modify + GxB_Option_Field field, // option to change + double value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix ( @@ -4538,6 +4586,22 @@ GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix ... // return value of the matrix option ) ; +GB_PUBLIC +GrB_Info GxB_Matrix_Option_get_INT32 // gets the current option of a matrix +( + GrB_Matrix A, // matrix to query + GxB_Option_Field field, // option to query + int32_t *value // return value of the matrix option +) ; + +GB_PUBLIC +GrB_Info GxB_Matrix_Option_get_FP64 // gets the current option of a matrix +( + GrB_Matrix A, // matrix to query + GxB_Option_Field field, // option to query + double *value // return value of the matrix option +) ; + GB_PUBLIC GrB_Info GxB_Vector_Option_set // set an option in a vector ( @@ -4546,6 +4610,22 @@ GrB_Info GxB_Vector_Option_set // set an option in a vector ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Vector_Option_set_INT32 // set an option in a vector +( + GrB_Vector v, // vector to modify + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Vector_Option_set_FP64 // set an option in a vector +( + GrB_Vector v, // vector to modify + GxB_Option_Field field, // option to change + double value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Vector_Option_get // gets the current option of a vector ( @@ -4554,6 +4634,22 @@ GrB_Info GxB_Vector_Option_get // gets the current option of a vector ... // return value of the vector option ) ; +GB_PUBLIC +GrB_Info GxB_Vector_Option_get_INT32 // gets the current option of a vector +( + GrB_Vector v, // vector to query + GxB_Option_Field field, // option to query + int32_t *value // return value of the vector option +) ; + +GB_PUBLIC +GrB_Info GxB_Vector_Option_get_FP64 // gets the current option of a vector +( + GrB_Vector v, // vector to query + GxB_Option_Field field, // option to query + double *value // return value of the vector option +) ; + // GxB_Global_Option_set controls the global defaults used when a new matrix is // created. GrB_init defines the following initial settings: // @@ -4576,6 +4672,41 @@ GrB_Info GxB_Global_Option_set // set a global default option ... // value to change it to ) ; +GB_PUBLIC +GrB_Info GxB_Global_Option_set_INT32 // set a global default option +( + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_FP64 // set a global default option +( + GxB_Option_Field field, // option to change + double value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_FP64_ARRAY // set a global default option +( + GxB_Option_Field field, // option to change + double *value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_INT64_ARRAY // set a global default option +( + GxB_Option_Field field, // option to change + int64_t *value // value to change it to +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_set_FUNCTION // set a global default option +( + GxB_Option_Field field, // option to change + void *value // value to change it to +) ; + GB_PUBLIC GrB_Info GxB_Global_Option_get // gets the current global default option ( @@ -4583,6 +4714,41 @@ GrB_Info GxB_Global_Option_get // gets the current global default option ... // return value of the global option ) ; +GB_PUBLIC +GrB_Info GxB_Global_Option_get_INT32 // gets the current global option +( + GxB_Option_Field field, // option to query + int32_t *value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_FP64 // gets the current global option +( + GxB_Option_Field field, // option to query + double *value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_INT64 // gets the current global option +( + GxB_Option_Field field, // option to query + int64_t *value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_CHAR // gets the current global option +( + GxB_Option_Field field, // option to query + char **value // return value of the global option +) ; + +GB_PUBLIC +GrB_Info GxB_Global_Option_get_FUNCTION // gets the current global option +( + GxB_Option_Field field, // option to query + void **value // return value of the global option +) ; + //------------------------------------------------------------------------------ // GxB_set and GxB_get //------------------------------------------------------------------------------ diff --git a/GraphBLAS/README.md b/GraphBLAS/README.md index 56d003eed6..1746ef7c1d 100644 --- a/GraphBLAS/README.md +++ b/GraphBLAS/README.md @@ -4,7 +4,7 @@ SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. SPDX-License-Identifier: Apache-2.0 -VERSION 7.3.3, Dec 9, 2022 +VERSION 7.4.0, Dec 23, 2022 SuiteSparse:GraphBLAS is a complete implementation of the GraphBLAS standard, which defines a set of sparse matrix operations on an extended algebra of diff --git a/GraphBLAS/Source/GxB_Desc_get.c b/GraphBLAS/Source/GxB_Desc_get.c index db5d29e89f..c762a10f9a 100644 --- a/GraphBLAS/Source/GxB_Desc_get.c +++ b/GraphBLAS/Source/GxB_Desc_get.c @@ -7,8 +7,143 @@ //------------------------------------------------------------------------------ +// GxB_Desc_get is a single va_arg-based method for any descriptor option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Desc_get_INT32 int32_t scalars +// GxB_Desc_get_FP64 double scalars + #include "GB.h" +//------------------------------------------------------------------------------ +// GxB_Desc_get_INT32: get a descriptor option (int32_t) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Desc_get_INT32 // get a parameter from a descriptor +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + GrB_Desc_Field field, // parameter to query + int32_t *value // return value of the descriptor +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Desc_get_INT32 (desc, field, &value)") ; + GB_RETURN_IF_FAULTY (desc) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the parameter + //-------------------------------------------------------------------------- + + switch (field) + { + case GrB_OUTP : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->out) ; + break ; + + case GrB_MASK : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->mask) ; + break ; + + case GrB_INP0 : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->in0) ; + break ; + + case GrB_INP1 : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->in1) ; + break ; + + case GxB_DESCRIPTOR_NTHREADS : // same as GxB_NTHREADS + + (*value) = (int32_t) ((desc == NULL) ? + GxB_DEFAULT : desc->nthreads_max) ; + break ; + + case GxB_AxB_METHOD : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->axb) ; + break ; + + case GxB_SORT : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->do_sort); + break ; + + case GxB_COMPRESSION : + + (*value) = (int32_t) ((desc == NULL) ? + GxB_DEFAULT : desc->compression) ; + break ; + + case GxB_IMPORT : + + (*value) = (int32_t) ((desc == NULL) ? GxB_DEFAULT : desc->import) ; + if ((*value) != GxB_DEFAULT) (*value) = GxB_SECURE_IMPORT ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Desc_get_FP64: get a descriptor option (double) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Desc_get_FP64 // get a parameter from a descriptor +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + GrB_Desc_Field field, // parameter to query + double *value // return value of the descriptor +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Desc_get_FP64 (desc, field, &value)") ; + GB_RETURN_IF_FAULTY (desc) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the parameter + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_DESCRIPTOR_CHUNK : // same as GxB_CHUNK + + (*value) = (double) ((desc == NULL) ? GxB_DEFAULT : desc->chunk) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Desc_get: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Desc_get // get a parameter from a descriptor ( GrB_Descriptor desc, // descriptor to query; NULL is ok @@ -110,7 +245,7 @@ GrB_Info GxB_Desc_get // get a parameter from a descriptor } break ; - case GxB_SORT : + case GxB_SORT : { va_start (ap, field) ; diff --git a/GraphBLAS/Source/GxB_Desc_set.c b/GraphBLAS/Source/GxB_Desc_set.c index 7743cd3817..1267b96007 100644 --- a/GraphBLAS/Source/GxB_Desc_set.c +++ b/GraphBLAS/Source/GxB_Desc_set.c @@ -12,8 +12,189 @@ // in the spec, the type is the same as GrB_Descriptor_set (a scalar of // type GrB_Desc_Value). +// GxB_Desc_set is a single va_arg-based method for any descriptor option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Desc_set_INT32 int32_t scalars +// GxB_Desc_set_FP64 double scalars + #include "GB.h" +//------------------------------------------------------------------------------ +// GxB_Desc_set_INT32: set a descriptor option (int32_t) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Desc_set_INT32 // set a parameter in a descriptor +( + GrB_Descriptor desc, // descriptor to modify + GrB_Desc_Field field, // parameter to change + int32_t value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + if (desc != NULL && desc->header_size == 0) + { + // built-in descriptors may not be modified + return (GrB_INVALID_VALUE) ; + } + + GB_WHERE (desc, "GxB_Desc_set_INT32 (desc, field, value)") ; + GB_RETURN_IF_NULL_OR_FAULTY (desc) ; + ASSERT_DESCRIPTOR_OK (desc, "desc to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the parameter + //-------------------------------------------------------------------------- + + int mask = (int) desc->mask ; + + switch (field) + { + + case GrB_OUTP : + + if (! (value == GxB_DEFAULT || value == GrB_REPLACE)) + { + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor value\n", 0) ; + } + desc->out = (GrB_Desc_Value) value ; + break ; + + case GrB_MASK : + + if (! (value == GxB_DEFAULT || + value == GrB_COMP || + value == GrB_STRUCTURE || + value == (GrB_COMP + GrB_STRUCTURE))) + { + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor value\n", 0) ; + } + int mask = (int) desc->mask ; + switch (value) + { + case GrB_COMP : mask |= GrB_COMP ; break ; + case GrB_STRUCTURE : mask |= GrB_STRUCTURE ; break ; + default : mask = value ; break ; + } + desc->mask = (GrB_Desc_Value) mask ; + break ; + + case GrB_INP0 : + + if (! (value == GxB_DEFAULT || value == GrB_TRAN)) + { + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor value\n", 0) ; + } + desc->in0 = (GrB_Desc_Value) value ; + break ; + + case GrB_INP1 : + + if (! (value == GxB_DEFAULT || value == GrB_TRAN)) + { + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor value\n", 0) ; + } + desc->in1 = (GrB_Desc_Value) value ; + break ; + + case GxB_DESCRIPTOR_NTHREADS : // same as GxB_NTHREADS + + desc->nthreads_max = value ; + break ; + + case GxB_AxB_METHOD : + + if (! (value == GxB_DEFAULT || value == GxB_AxB_GUSTAVSON + || value == GxB_AxB_DOT + || value == GxB_AxB_HASH || value == GxB_AxB_SAXPY)) + { + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor value\n", 0) ; + } + desc->axb = (GrB_Desc_Value) value ; + break ; + + case GxB_SORT : + + desc->do_sort = value ; + break ; + + case GxB_COMPRESSION : + + desc->compression = value ; + break ; + + case GxB_IMPORT : + + // In case the user application does not check the return value + // of this method, an error condition is never returned. + desc->import = + (value == GxB_DEFAULT) ? GxB_FAST_IMPORT : GxB_SECURE_IMPORT ; + break ; + + default : + + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor value\n", 0) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Desc_set_FP64: set a descriptor option (double scalar) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Desc_set_FP64 // set a parameter in a descriptor +( + GrB_Descriptor desc, // descriptor to modify + GrB_Desc_Field field, // parameter to change + double value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + if (desc != NULL && desc->header_size == 0) + { + // built-in descriptors may not be modified + return (GrB_INVALID_VALUE) ; + } + + GB_WHERE (desc, "GxB_Desc_set_FP64 (desc, field, value)") ; + GB_RETURN_IF_NULL_OR_FAULTY (desc) ; + ASSERT_DESCRIPTOR_OK (desc, "desc to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the parameter + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_DESCRIPTOR_CHUNK : // same as GxB_CHUNK + + desc->chunk = value ; + break ; + + default : + + GB_ERROR (GrB_INVALID_VALUE, "invalid descriptor field\n", 0) ; + } + + return (GrB_SUCCESS) ; +} + + +//------------------------------------------------------------------------------ +// GxB_Desc_set: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Desc_set // set a parameter in a descriptor ( GrB_Descriptor desc, // descriptor to modify @@ -167,7 +348,7 @@ GrB_Info GxB_Desc_set // set a parameter in a descriptor } break ; - case GxB_SORT : + case GxB_SORT : { va_start (ap, field) ; diff --git a/GraphBLAS/Source/GxB_Global_Option_get.c b/GraphBLAS/Source/GxB_Global_Option_get.c index 6cf5284974..efb5587e7e 100644 --- a/GraphBLAS/Source/GxB_Global_Option_get.c +++ b/GraphBLAS/Source/GxB_Global_Option_get.c @@ -7,8 +7,349 @@ //------------------------------------------------------------------------------ +// GxB_Global_Option_get is a single va_arg-based method for any global option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Global_Option_get_INT32 int32_t scalars or arrays +// GxB_Global_Option_get_FP64 double scalars or arrays +// GxB_Global_Option_get_INT64 int64_t scalars or arrays +// GxB_Global_Option_get_CHAR strings +// GxB_Global_Option_get_FUNCTION function pointers (as void **) + #include "GB.h" +//------------------------------------------------------------------------------ +// GxB_Global_Option_get_INT32: get global options (int32_t scalars or arrays) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_get_INT32 // gets the current global option +( + GxB_Option_Field field, // option to query + int32_t *value // return value of the global option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_get_INT32 (field, &value)") ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_GLOBAL_NTHREADS : // same as GxB_NTHREADS + + (*value) = (int32_t) GB_Global_nthreads_max_get ( ) ; + break ; + + case GxB_API_VERSION : + + value [0] = GxB_SPEC_MAJOR ; + value [1] = GxB_SPEC_MINOR ; + value [2] = GxB_SPEC_SUB ; + break ; + + case GxB_LIBRARY_VERSION : + + value [0] = GxB_IMPLEMENTATION_MAJOR ; + value [1] = GxB_IMPLEMENTATION_MINOR ; + value [2] = GxB_IMPLEMENTATION_SUB ; + break ; + + case GxB_COMPILER_VERSION : + + value [0] = GB_COMPILER_MAJOR ; + value [1] = GB_COMPILER_MINOR ; + value [2] = GB_COMPILER_SUB ; + break ; + + case GxB_MODE : + + (*value) = (int32_t) GB_Global_mode_get ( ) ; + break ; + + case GxB_FORMAT : + + (*value) = (int32_t) (GB_Global_is_csc_get ( )) ? + GxB_BY_COL : GxB_BY_ROW ; + break ; + + case GxB_GLOBAL_GPU_CONTROL : // same as GxB_GPU_CONTROL + + (*value) = (int32_t) GB_Global_gpu_control_get ( ) ; + break ; + + case GxB_BURBLE : + + (*value) = (int32_t) GB_Global_burble_get ( ) ; + break ; + + case GxB_LIBRARY_OPENMP : + + #ifdef _OPENMP + (*value) = (int32_t) true ; + #else + (*value) = (int32_t) false ; + #endif + break ; + + case GxB_PRINT_1BASED : + + (*value) = (int32_t) GB_Global_print_one_based_get ( ) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_get_FP64: get global options (double scalars or arrays) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_get_FP64 // gets the current global option +( + GxB_Option_Field field, // option to query + double *value // return value of the global option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_get_FP64 (field, &value)") ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_HYPER_SWITCH : + + (*value) = (double) GB_Global_hyper_switch_get ( ) ; + break ; + + case GxB_BITMAP_SWITCH : + + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + value [k] = (double) GB_Global_bitmap_switch_get (k) ; + } + break ; + + case GxB_GLOBAL_CHUNK : // same as GxB_CHUNK + + (*value) = GB_Global_chunk_get ( ) ; + break ; + + case GxB_GLOBAL_GPU_CHUNK : // same as GxB_GPU_CHUNK + + (*value) = GB_Global_gpu_chunk_get ( ) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_get_INT64: get global options (int64_t scalars or arrays) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_get_INT64 // gets the current global option +( + GxB_Option_Field field, // option to query + int64_t *value // return value of the global option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_get_INT64 (field, &value)") ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_MEMORY_POOL : + + for (int k = 0 ; k < 64 ; k++) + { + value [k] = GB_Global_free_pool_limit_get (k) ; + } + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_get_CHAR: get global options (const char strings) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_get_CHAR // gets the current global option +( + GxB_Option_Field field, // option to query + char **value // return value of the global option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_get_CHAR (field, &value)") ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_LIBRARY_NAME : + + (*value) = GxB_IMPLEMENTATION_NAME ; + break ; + + case GxB_LIBRARY_DATE : + + (*value) = GxB_IMPLEMENTATION_DATE ; + break ; + + case GxB_LIBRARY_ABOUT : + + (*value) = GxB_IMPLEMENTATION_ABOUT ; + break ; + + case GxB_LIBRARY_LICENSE : + + (*value) = GxB_IMPLEMENTATION_LICENSE ; + break ; + + case GxB_LIBRARY_COMPILE_DATE : + + (*value) = __DATE__ ; + break ; + + case GxB_LIBRARY_COMPILE_TIME : + + (*value) = __TIME__ ; + break ; + + case GxB_LIBRARY_URL : + + (*value) = "http://faculty.cse.tamu.edu/davis/GraphBLAS" ; + break ; + + case GxB_API_DATE : + + (*value) = GxB_SPEC_DATE ; + break ; + + case GxB_API_ABOUT : + + (*value) = GxB_SPEC_ABOUT ; + break ; + + case GxB_API_URL : + + (*value) = "http://graphblas.org" ; + break ; + + case GxB_COMPILER_NAME : + + (*value) = GB_COMPILER_NAME ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_get_FUNCTION: get global options (function pointers) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_get_FUNCTION // gets the current global option +( + GxB_Option_Field field, // option to query + void **value // return value of the global option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_get_FUNCTION (field, &value)") ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_PRINTF : + + (*value) = (void *) GB_Global_printf_get ( ) ; + break ; + + case GxB_FLUSH : + + (*value) = (void *) GB_Global_flush_get ( ) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_get: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Global_Option_get // gets the current global option ( GxB_Option_Field field, // option to query diff --git a/GraphBLAS/Source/GxB_Global_Option_set.c b/GraphBLAS/Source/GxB_Global_Option_set.c index d2f5a40987..c71c57406d 100644 --- a/GraphBLAS/Source/GxB_Global_Option_set.c +++ b/GraphBLAS/Source/GxB_Global_Option_set.c @@ -7,8 +7,270 @@ //------------------------------------------------------------------------------ +// GxB_Global_Option_set is a single va_arg-based method for any global option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Global_Option_set_INT32 int32_t scalars +// GxB_Global_Option_set_FP64 double scalars +// GxB_Global_Option_set_FP64_ARRAY double arrays +// GxB_Global_Option_set_INT64_ARRAY int64_t arrays +// GxB_Global_Option_set_FUNCTION function pointers (as void *) + #include "GB.h" +//------------------------------------------------------------------------------ +// GxB_Global_Option_set_INT32: set a global option (int32_t) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_set_INT32 // set a global default option +( + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_set_INT32 (field, value)") ; + + //-------------------------------------------------------------------------- + // set the global option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_FORMAT : + + if (! (value == GxB_BY_ROW || value == GxB_BY_COL)) + { + return (GrB_INVALID_VALUE) ; + } + GB_Global_is_csc_set (value != (int) GxB_BY_ROW) ; + break ; + + case GxB_GLOBAL_NTHREADS : // same as GxB_NTHREADS + + // if < 1, then treat it as if nthreads_max = 1 + value = GB_IMAX (1, value) ; + GB_Global_nthreads_max_set (value) ; + break ; + + case GxB_BURBLE : + + GB_Global_burble_set ((bool) value) ; + break ; + + case GxB_PRINT_1BASED : + + GB_Global_print_one_based_set ((bool) value) ; + break ; + + case GxB_GLOBAL_GPU_CONTROL : // same as GxB_GPU_CONTROL + + GB_Global_gpu_control_set ((GrB_Desc_Value) value) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_set_FP64: set a global option (double) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_set_FP64 // set a global default option +( + GxB_Option_Field field, // option to change + double value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_set_FP64 (field, value)") ; + + //-------------------------------------------------------------------------- + // set the global option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_HYPER_SWITCH : + + GB_Global_hyper_switch_set ((float) value) ; + break ; + + case GxB_GLOBAL_CHUNK : // same as GxB_CHUNK + + GB_Global_chunk_set (value) ; + break ; + + case GxB_GLOBAL_GPU_CHUNK : // same as GxB_GPU_CHUNK + + GB_Global_gpu_chunk_set (value) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_set_FP64_ARRAY: set a global option (double array) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_set_FP64_ARRAY // set a global default option +( + GxB_Option_Field field, // option to change + double *value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_set_FP64_ARRAY (field, value)") ; + + //-------------------------------------------------------------------------- + // set the global option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_BITMAP_SWITCH : + + if (value == NULL) + { + // set all switches to their default + GB_Global_bitmap_switch_default ( ) ; + } + else + { + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + GB_Global_bitmap_switch_set (k, (float) (value [k])) ; + } + } + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_set_INT64_ARRAY: set a global option (int64_t array) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_set_INT64_ARRAY // set a global default option +( + GxB_Option_Field field, // option to change + int64_t *value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_set_INT64_ARRAY (field, value)") ; + + //-------------------------------------------------------------------------- + // set the global option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_MEMORY_POOL : + + if (value == NULL) + { + // set all limits to their default + GB_Global_free_pool_init (false) ; + } + else + { + for (int k = 3 ; k < 64 ; k++) + { + GB_Global_free_pool_limit_set (k, value [k]) ; + } + } + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_set_FUNCTION: set a global option (function pointer) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Global_Option_set_FUNCTION // set a global default option +( + GxB_Option_Field field, // option to change + void *value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Global_Option_set_FUNCTION (field, value)") ; + + //-------------------------------------------------------------------------- + // set the global option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_PRINTF : + + GB_Global_printf_set ((GB_printf_function_t) value) ; + break ; + + case GxB_FLUSH : + + GB_Global_flush_set ((GB_flush_function_t) value) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Global_Option_set: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Global_Option_set // set a global default option ( GxB_Option_Field field, // option to change diff --git a/GraphBLAS/Source/GxB_Matrix_Option_get.c b/GraphBLAS/Source/GxB_Matrix_Option_get.c index 44e4ca9736..7f0cd65a85 100644 --- a/GraphBLAS/Source/GxB_Matrix_Option_get.c +++ b/GraphBLAS/Source/GxB_Matrix_Option_get.c @@ -7,8 +7,118 @@ //------------------------------------------------------------------------------ +// GxB_Matrix_Option_get is a single va_arg-based method for any matrix option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Matrix_Option_get_INT32 int32_t scalars +// GxB_Matrix_Option_get_FP64 double scalars + #include "GB.h" +//------------------------------------------------------------------------------ +// GxB_Matrix_Option_get_INT32: get matrix options (int32_t scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Matrix_Option_get_INT32 // gets the current option of a matrix +( + GrB_Matrix A, // matrix to query + GxB_Option_Field field, // option to query + int32_t *value // return value of the matrix option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Matrix_Option_get_INT32 (A, field, &value)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + ASSERT_MATRIX_OK (A, "A to get option", GB0) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_SPARSITY_CONTROL : + + (*value) = A->sparsity_control ; + break ; + + case GxB_SPARSITY_STATUS : + + (*value) = GB_sparsity (A) ; + break ; + + case GxB_FORMAT : + + (*value) = (int32_t) ((A->is_csc) ? GxB_BY_COL : GxB_BY_ROW) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Matrix_Option_get_FP64: get matrix options (double scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Matrix_Option_get_FP64 // gets the current option of a matrix +( + GrB_Matrix A, // matrix to query + GxB_Option_Field field, // option to query + double *value // return value of the matrix option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Matrix_Option_get_FP64 (A, field, &value)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + ASSERT_MATRIX_OK (A, "A to get option", GB0) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_HYPER_SWITCH : + + (*value) = (double) A->hyper_switch ; + break ; + + case GxB_BITMAP_SWITCH : + + (*value) = (double) A->bitmap_switch ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Matrix_Option_get: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix ( GrB_Matrix A, // matrix to query diff --git a/GraphBLAS/Source/GxB_Matrix_Option_set.c b/GraphBLAS/Source/GxB_Matrix_Option_set.c index 2d19f64a87..34cc5671f3 100644 --- a/GraphBLAS/Source/GxB_Matrix_Option_set.c +++ b/GraphBLAS/Source/GxB_Matrix_Option_set.c @@ -11,9 +11,147 @@ #define GB_FREE_ALL ; +//------------------------------------------------------------------------------ + +// GxB_Matrix_Option_set is a single va_arg-based method for any matrix option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Matrix_Option_set_INT32 int32_t scalars +// GxB_Matrix_Option_set_FP64 double scalars + +//------------------------------------------------------------------------------ +// GxB_Matrix_Option_set_INT32: set matrix options (int32_t scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Matrix_Option_set_INT32 // set an option in a matrix +( + GrB_Matrix A, // matrix to modify + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GrB_Info info ; + GB_WHERE (A, "GxB_Matrix_Option_set_INT32 (A, field, value)") ; + GB_BURBLE_START ("GxB_set") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + ASSERT_MATRIX_OK (A, "A to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the matrix option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_SPARSITY_CONTROL : + + A->sparsity_control = GB_sparsity_control (value, (int64_t) (-1)) ; + break ; + + case GxB_FORMAT : + + if (! (value == GxB_BY_ROW || value == GxB_BY_COL)) + { + return (GrB_INVALID_VALUE) ; + } + // the value is normally GxB_BY_ROW (0) or GxB_BY_COL (1), but + // any nonzero value results in GxB_BY_COL. + bool new_csc = (value != GxB_BY_ROW) ; + // conform the matrix to the new by-row/by-col format + if (A->is_csc != new_csc) + { + // A = A', done in-place, and change to the new format. + GB_BURBLE_N (GB_nnz (A), "(transpose) ") ; + GB_OK (GB_transpose_in_place (A, new_csc, Context)) ; + ASSERT (A->is_csc == new_csc) ; + ASSERT (GB_JUMBLED_OK (A)) ; + } + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // conform the matrix to its new desired sparsity structure + //-------------------------------------------------------------------------- + + ASSERT_MATRIX_OK (A, "A set before conform", GB0) ; + GB_OK (GB_conform (A, Context)) ; + GB_BURBLE_END ; + ASSERT_MATRIX_OK (A, "A set after conform", GB0) ; + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Matrix_Option_set_FP64: set matrix options (double scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Matrix_Option_set_FP64 // set an option in a matrix +( + GrB_Matrix A, // matrix to modify + GxB_Option_Field field, // option to change + double value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GrB_Info info ; + GB_WHERE (A, "GxB_Matrix_Option_set_FP64 (A, field, value)") ; + GB_BURBLE_START ("GxB_set") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + ASSERT_MATRIX_OK (A, "A to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the matrix option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_HYPER_SWITCH : + + A->hyper_switch = (float) value ; + break ; + + case GxB_BITMAP_SWITCH : + + A->bitmap_switch = (float) value ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // conform the matrix to its new desired sparsity structure + //-------------------------------------------------------------------------- + + ASSERT_MATRIX_OK (A, "A set before conform", GB0) ; + GB_OK (GB_conform (A, Context)) ; + GB_BURBLE_END ; + ASSERT_MATRIX_OK (A, "A set after conform", GB0) ; + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Matrix_Option_set: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Matrix_Option_set // set an option in a matrix ( - GrB_Matrix A, // descriptor to modify + GrB_Matrix A, // matrix to modify GxB_Option_Field field, // option to change ... // value to change it to ) diff --git a/GraphBLAS/Source/GxB_Vector_Option_get.c b/GraphBLAS/Source/GxB_Vector_Option_get.c index a9b18f95b2..7bebd02407 100644 --- a/GraphBLAS/Source/GxB_Vector_Option_get.c +++ b/GraphBLAS/Source/GxB_Vector_Option_get.c @@ -9,6 +9,116 @@ #include "GB.h" +//------------------------------------------------------------------------------ + +// GxB_Vector_Option_get is a single va_arg-based method for any vector option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Vector_Option_get_INT32 int32_t scalars +// GxB_Vector_Option_get_FP64 double scalars + +//------------------------------------------------------------------------------ +// GxB_Vector_Option_get_INT32: get vector options (int32_t scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Vector_Option_get_INT32 // gets the current option of a vector +( + GrB_Vector v, // vector to query + GxB_Option_Field field, // option to query + int32_t *value // return value of the vector option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Vector_Option_get_INT32 (v, field, &value)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + ASSERT_VECTOR_OK (v, "v to get option", GB0) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_SPARSITY_CONTROL : + + (*value) = v->sparsity_control ; + break ; + + case GxB_SPARSITY_STATUS : + + (*value) = GB_sparsity ((GrB_Matrix) v) ; + break ; + + case GxB_FORMAT : + + // a GrB_Vector is always stored by-column + (*value) = (int32_t) GxB_BY_COL ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Vector_Option_get_FP64: get vector options (double scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Vector_Option_get_FP64 // gets the current option of a vector +( + GrB_Vector v, // vector to query + GxB_Option_Field field, // option to query + double *value // return value of the vector option +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Vector_Option_get_FP64 (v, field, &value)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + ASSERT_VECTOR_OK (v, "v to get option", GB0) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_BITMAP_SWITCH : + + (*value) = (double) v->bitmap_switch ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Vector_Option_get: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Vector_Option_get // gets the current option of a vector ( GrB_Vector v, // vector to query diff --git a/GraphBLAS/Source/GxB_Vector_Option_set.c b/GraphBLAS/Source/GxB_Vector_Option_set.c index e1597e5fcd..55e6d2f8a1 100644 --- a/GraphBLAS/Source/GxB_Vector_Option_set.c +++ b/GraphBLAS/Source/GxB_Vector_Option_set.c @@ -11,9 +11,120 @@ #define GB_FREE_ALL ; +//------------------------------------------------------------------------------ + +// GxB_Vector_Option_set is a single va_arg-based method for any vector option, +// of any type. The following functions are alternative methods that do not +// use va_arg (useful for compilers and interfaces that do not support va_arg): +// +// GxB_Vector_Option_set_INT32 int32_t scalars +// GxB_Vector_Option_set_FP64 double scalars + +//------------------------------------------------------------------------------ +// GxB_Vector_Option_set_INT32: set vector options (int32_t scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Vector_Option_set_INT32 // set an option in a vector +( + GrB_Vector v, // vector to modify + GxB_Option_Field field, // option to change + int32_t value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GrB_Info info = GrB_SUCCESS ; + GB_WHERE (v, "GxB_Vector_Option_set_INT32 (v, field, value)") ; + GB_BURBLE_START ("GxB_set (vector option)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + ASSERT_VECTOR_OK (v, "v to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the vector option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_SPARSITY_CONTROL : + + v->sparsity_control = GB_sparsity_control (value, (int64_t) (-1)) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // conform the vector to its new desired sparsity structure + //-------------------------------------------------------------------------- + + GB_OK (GB_conform ((GrB_Matrix) v, Context)) ; + GB_BURBLE_END ; + ASSERT_VECTOR_OK (v, "v set", GB0) ; + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Vector_Option_set_FP64: set vector options (double scalars) +//------------------------------------------------------------------------------ + +GrB_Info GxB_Vector_Option_set_FP64 // set an option in a vector +( + GrB_Vector v, // vector to modify + GxB_Option_Field field, // option to change + double value // value to change it to +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GrB_Info info = GrB_SUCCESS ; + GB_WHERE (v, "GxB_Vector_Option_set_FP64 (v, field, value)") ; + GB_BURBLE_START ("GxB_set (vector option)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + ASSERT_VECTOR_OK (v, "v to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the vector option + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_BITMAP_SWITCH : + + v->bitmap_switch = (float) value ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // conform the vector to its new desired sparsity structure + //-------------------------------------------------------------------------- + + GB_OK (GB_conform ((GrB_Matrix) v, Context)) ; + GB_BURBLE_END ; + ASSERT_VECTOR_OK (v, "v set", GB0) ; + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Vector_Option_set: based on va_arg +//------------------------------------------------------------------------------ + GrB_Info GxB_Vector_Option_set // set an option in a vector ( - GrB_Vector v, // descriptor to modify + GrB_Vector v, // vector to modify GxB_Option_Field field, // option to change ... // value to change it to ) diff --git a/GraphBLAS/Tcov/log_Dec22.txt b/GraphBLAS/Tcov/log_Dec22.txt new file mode 100644 index 0000000000..67714d4edf --- /dev/null +++ b/GraphBLAS/Tcov/log_Dec22.txt @@ -0,0 +1,142 @@ + +---------------------------------------------- [malloc] [cover] +22-Dec 22:26:26 test247 0.5 sec 217: 20251 of 20468 1.1% 465.45/s +22-Dec 22:26:35 test246 9.0 sec 157: 20094 of 20468 1.8% 17.45/s +22-Dec 22:26:36 test01 1.1 sec 2089: 18005 of 20468 12.0% 1829.57/s +22-Dec 22:26:37 test245 0.2 sec 47: 17958 of 20468 12.3% 284.68/s +22-Dec 22:26:37 test199 0.0 sec 17: 17941 of 20468 12.3% 2063.36/s +22-Dec 22:26:37 test83 0.1 sec 21: 17920 of 20468 12.4% 262.31/s +22-Dec 22:26:37 test210 0.0 sec 7: 17913 of 20468 12.5% 2356.90/s +22-Dec 22:26:37 test165 0.0 sec 12: 17901 of 20468 12.5% 1083.52/s +22-Dec 22:26:37 test219 0.1 sec 11: 17890 of 20468 12.6% 153.52/s +22-Dec 22:26:37 test241 0.3 sec 16: 17874 of 20468 12.7% 53.15/s +22-Dec 22:26:37 test220 0.1 sec 66: 17808 of 20468 13.0% 504.36/s +22-Dec 22:26:37 test211 0.1 sec 26: 17782 of 20468 13.1% 374.59/s +22-Dec 22:26:37 test202 0.1 sec 33: 17749 of 20468 13.3% 232.50/s +22-Dec 22:26:39 test152 1.4 sec 1127: 16622 of 20468 18.8% 815.99/s +22-Dec 22:26:39 test222 0.1 sec 6: 16616 of 20468 18.8% 80.07/s +22-Dec 22:26:39 test240 0.4 sec 42: 16574 of 20468 19.0% 118.42/s +22-Dec 22:26:40 test186 0.5 sec 67: 16507 of 20468 19.4% 132.69/s +22-Dec 22:26:40 test186(0) 0.4 sec 4: 16503 of 20468 19.4% 10.68/s +22-Dec 22:26:41 test186 0.4 sec 3: 16500 of 20468 19.4% 6.87/s +22-Dec 22:26:41 test150 0.2 sec 63: 16437 of 20468 19.7% 345.18/s +22-Dec 22:26:41 test239 0.1 sec 14: 16423 of 20468 19.8% 124.03/s +22-Dec 22:26:41 test235 0.0 sec 12: 16411 of 20468 19.8% 302.89/s +22-Dec 22:26:41 test226 0.0 sec 8: 16403 of 20468 19.9% 631.16/s +22-Dec 22:26:41 test223 0.0 sec 2: 16401 of 20468 19.9% 69.39/s +22-Dec 22:26:41 test204 0.1 sec 21: 16380 of 20468 20.0% 156.34/s +22-Dec 22:26:41 test203 0.1 sec 11: 16369 of 20468 20.0% 98.48/s +22-Dec 22:26:41 test183 0.0 sec 12: 16357 of 20468 20.1% 312.01/s +22-Dec 22:26:41 test179 0.1 sec 26: 16331 of 20468 20.2% 177.89/s +22-Dec 22:26:41 test174 0.1 sec 10: 16321 of 20468 20.3% 173.07/s +22-Dec 22:26:42 test155 0.2 sec 48: 16273 of 20468 20.5% 287.36/s +22-Dec 22:26:42 test156 0.7 sec 258: 16015 of 20468 21.8% 357.34/s +22-Dec 22:26:43 test136 0.2 sec 58: 15957 of 20468 22.0% 309.93/s +22-Dec 22:26:43 test02 0.4 sec 181: 15776 of 20468 22.9% 498.04/s +22-Dec 22:26:43 test109 0.1 sec 12: 15764 of 20468 23.0% 123.37/s +22-Dec 22:26:43 test109 0.0 sec 1: 15763 of 20468 23.0% 312.21/s +22-Dec 22:26:43 test04 0.1 sec 21: 15742 of 20468 23.1% 208.04/s +22-Dec 22:26:43 test207 0.0 sec 1: 15741 of 20468 23.1% 261.10/s +22-Dec 22:26:43 test221 0.0 sec 2: 15739 of 20468 23.1% 259.03/s +22-Dec 22:26:43 test162 0.1 sec 5: 15734 of 20468 23.1% 68.32/s +22-Dec 22:26:45 test159 1.5 sec 135: 15599 of 20468 23.8% 92.25/s +22-Dec 22:26:45 test09 0.0 sec 5: 15594 of 20468 23.8% 493.39/s +22-Dec 22:26:45 test132 0.1 sec 8: 15586 of 20468 23.9% 85.26/s +22-Dec 22:26:50 test141 5.3 sec 543: 15043 of 20468 26.5% 102.54/s +22-Dec 22:26:51 testc2(1,1) 0.4 sec 46: 14997 of 20468 26.7% 115.02/s +22-Dec 22:26:51 test214 0.0 sec 3: 14994 of 20468 26.7% 238.42/s +22-Dec 22:26:51 test213 0.0 sec 4: 14990 of 20468 26.8% 383.99/s +22-Dec 22:26:53 test206 2.7 sec 265: 14725 of 20468 28.1% 99.72/s +22-Dec 22:26:53 test212 0.1 sec 10: 14715 of 20468 28.1% 115.71/s +22-Dec 22:26:54 test128 0.4 sec 53: 14662 of 20468 28.4% 132.25/s +22-Dec 22:26:54 test82 0.1 sec 18: 14644 of 20468 28.5% 169.71/s +22-Dec 22:26:55 test229 1.0 sec 7: 14637 of 20468 28.5% 7.30/s +22-Dec 22:26:55 test144 0.6 sec 2: 14635 of 20468 28.5% 3.32/s +22-Dec 22:27:16 test14 20.7 sec 724: 13911 of 20468 32.0% 35.03/s +22-Dec 22:27:26 test180 9.7 sec 133: 13778 of 20468 32.7% 13.70/s +22-Dec 22:27:30 test236 3.7 sec 73: 13705 of 20468 33.0% 19.47/s +22-Dec 22:27:32 test232 2.8 sec 22: 13683 of 20468 33.1% 7.95/s +22-Dec 22:27:50 test228 17.8 sec 37: 13646 of 20468 33.3% 2.08/s +22-Dec 22:29:52 test154 121.9 sec 1503: 12143 of 20468 40.7% 12.33/s +22-Dec 22:30:07 test238 14.9 sec 70: 12073 of 20468 41.0% 4.70/s +22-Dec 22:30:52 test151b 45.3 sec 144: 11929 of 20468 41.7% 3.18/s +22-Dec 22:30:55 test184 3.1 sec 39: 11890 of 20468 41.9% 12.73/s +22-Dec 22:31:08 test191 13.0 sec 20: 11870 of 20468 42.0% 1.54/s +22-Dec 22:32:00 test188 51.7 sec 194: 11676 of 20468 43.0% 3.75/s +22-Dec 22:32:01 test237 0.7 sec 16: 11660 of 20468 43.0% 21.79/s +22-Dec 22:32:06 test224 5.1 sec 24: 11636 of 20468 43.2% 4.71/s +22-Dec 22:32:08 test196 2.5 sec 11: 11625 of 20468 43.2% 4.40/s +22-Dec 22:32:14 test209 5.7 sec 20: 11605 of 20468 43.3% 3.49/s +22-Dec 22:32:33 test104 18.8 sec 40: 11565 of 20468 43.5% 2.13/s +22-Dec 22:32:41 test189 7.8 sec 1: 11564 of 20468 43.5% 0.13/s +22-Dec 22:33:53 test194 71.9 sec 8: 11556 of 20468 43.5% 0.11/s +22-Dec 22:34:08 test76 15.8 sec 18: 11538 of 20468 43.6% 1.14/s +22-Dec 22:34:47 test244 38.3 sec 17: 11521 of 20468 43.7% 0.44/s +[malloc debugging turned off] +22-Dec 22:34:47 test201 0.0 sec 5: 11516 of 20468 43.7% 712.86/s +22-Dec 22:34:47 test225 0.1 sec 5: 11511 of 20468 43.8% 35.87/s +22-Dec 22:34:47 test170 0.1 sec 1: 11510 of 20468 43.8% 14.12/s +22-Dec 22:34:47 test176 0.1 sec 5: 11505 of 20468 43.8% 60.79/s +22-Dec 22:34:47 test208 0.0 sec 5: 11500 of 20468 43.8% 304.75/s +22-Dec 22:34:47 test216 0.1 sec 3: 11497 of 20468 43.8% 37.77/s +22-Dec 22:34:54 test142 7.2 sec 630: 10867 of 20468 46.9% 87.59/s +22-Dec 22:34:54 test137 0.1 sec 5: 10862 of 20468 46.9% 36.62/s +22-Dec 22:34:55 test139 0.3 sec 2: 10860 of 20468 46.9% 5.89/s +22-Dec 22:34:55 test145 0.2 sec 10: 10850 of 20468 47.0% 64.13/s +22-Dec 22:34:55 test172 0.1 sec 3: 10847 of 20468 47.0% 32.79/s +22-Dec 22:34:55 test148 0.4 sec 6: 10841 of 20468 47.0% 14.83/s +22-Dec 22:34:56 test157 0.7 sec 13: 10828 of 20468 47.1% 19.28/s +22-Dec 22:34:57 test182 1.0 sec 9: 10819 of 20468 47.1% 9.18/s +22-Dec 22:34:58 test108 0.4 sec 1: 10818 of 20468 47.1% 2.47/s +22-Dec 22:34:59 test130 1.0 sec 26: 10792 of 20468 47.3% 26.60/s +22-Dec 22:34:59 test124 0.2 sec 3: 10789 of 20468 47.3% 16.55/s +22-Dec 22:34:59 test138 0.1 sec 1: 10788 of 20468 47.3% 19.65/s +22-Dec 22:35:04 test227 5.0 sec 27: 10761 of 20468 47.4% 5.44/s +22-Dec 22:35:35 test125 31.3 sec 627: 10134 of 20468 50.5% 20.04/s +22-Dec 22:36:51 test234 75.5 sec 69: 10065 of 20468 50.8% 0.91/s +22-Dec 22:37:42 test242 51.6 sec 77: 9988 of 20468 51.2% 1.49/s +22-Dec 22:37:43 test173 1.3 sec 11: 9977 of 20468 51.3% 8.68/s +22-Dec 22:37:47 test200 3.3 sec 10: 9967 of 20468 51.3% 2.99/s +22-Dec 22:37:47 test197 0.1 sec 1: 9966 of 20468 51.3% 7.55/s +22-Dec 22:37:48 test84 1.4 sec 18: 9948 of 20468 51.4% 13.03/s +22-Dec 22:38:02 test19b 13.3 sec 57: 9891 of 20468 51.7% 4.29/s +22-Dec 22:38:10 test19b 8.8 sec 5: 9886 of 20468 51.7% 0.57/s +22-Dec 22:38:11 test133 0.4 sec 2: 9884 of 20468 51.7% 5.29/s +22-Dec 22:38:15 test80 3.9 sec 12: 9872 of 20468 51.8% 3.08/s +22-Dec 22:38:35 test151 20.3 sec 73: 9799 of 20468 52.1% 3.59/s +22-Dec 22:38:53 test23 18.1 sec 88: 9711 of 20468 52.6% 4.86/s +22-Dec 22:38:55 test135 1.9 sec 7: 9704 of 20468 52.6% 3.66/s +22-Dec 22:39:25 test160 30.3 sec 24: 9680 of 20468 52.7% 0.79/s +22-Dec 22:39:31 test54 5.7 sec 20: 9660 of 20468 52.8% 3.51/s +22-Dec 22:39:32 test129 1.2 sec 7: 9653 of 20468 52.8% 5.67/s +22-Dec 22:39:34 test69 2.1 sec 3: 9650 of 20468 52.9% 1.44/s +22-Dec 22:41:09 test230 94.6 sec 104: 9546 of 20468 53.4% 1.10/s +22-Dec 22:51:44 test74 635.4 sec 5796: 3750 of 20468 81.7% 9.12/s +22-Dec 22:55:50 test127 245.7 sec 1606: 2144 of 20468 89.5% 6.54/s +22-Dec 22:55:53 test19 3.4 sec 12: 2132 of 20468 89.6% 3.51/s +22-Dec 22:55:57 test11 3.6 sec 3: 2129 of 20468 89.6% 0.83/s +22-Dec 22:56:27 test160 30.2 sec 4: 2125 of 20468 89.6% 0.13/s +22-Dec 22:56:30 test215 2.9 sec 1: 2124 of 20468 89.6% 0.34/s +22-Dec 22:56:48 test193 17.8 sec 5: 2119 of 20468 89.6% 0.28/s +22-Dec 22:58:09 test195 80.7 sec 36: 2083 of 20468 89.8% 0.45/s +22-Dec 22:58:16 test233 7.8 sec 1: 2082 of 20468 89.8% 0.13/s +22-Dec 22:58:43 test243 26.2 sec 7: 2075 of 20468 89.9% 0.27/s +22-Dec 22:58:51 test29 8.7 sec 2: 2073 of 20468 89.9% 0.23/s +22-Dec 22:58:53 testc2(0,0) 1.2 sec 9: 2064 of 20468 89.9% 7.26/s +22-Dec 22:58:53 testc4(0) 0.6 sec 4: 2060 of 20468 89.9% 6.98/s +22-Dec 22:59:11 testc7(0) 17.7 sec 3: 2057 of 20468 90.0% 0.17/s +22-Dec 22:59:17 testcc(1) 5.8 sec 1: 2056 of 20468 90.0% 0.17/s +22-Dec 22:59:25 test187 8.5 sec 3: 2053 of 20468 90.0% 0.35/s +22-Dec 22:59:31 test192 5.8 sec 1: 2052 of 20468 90.0% 0.17/s +22-Dec 22:59:51 test181 19.9 sec 13: 2039 of 20468 90.0% 0.65/s +22-Dec 23:01:27 test185 95.7 sec 11: 2028 of 20468 90.1% 0.11/s +22-Dec 23:01:42 test53 15.5 sec 4: 2024 of 20468 90.1% 0.26/s +22-Dec 23:02:33 test17 51.1 sec 28: 1996 of 20468 90.2% 0.55/s +22-Dec 23:10:08 test231 455.2 sec 295: 1701 of 20468 91.7% 0.65/s +22-Dec 23:23:01 test10 772.3 sec 793: 908 of 20468 95.6% 1.03/s +22-Dec 23:33:01 test75b 600.7 sec 860: 48 of 20468 99.8% 1.43/s +22-Dec 23:34:33 test21b 92.0 sec 26: 22 of 20468 99.9% 0.28/s +22-Dec 23:35:41 testca(1) 67.7 sec 5: 17 of 20468 99.9% 0.07/s +22-Dec 23:37:36 test81 115.1 sec 1: 16 of 20468 99.9% 0.01/s +22-Dec 23:44:42 test18 425.5 sec 16: all 20468 full 100% 0.04/s +[malloc debugging turned back on] diff --git a/GraphBLAS/Test/GB_mex_about.c b/GraphBLAS/Test/GB_mex_about.c index b7124beeeb..f13efdfd64 100644 --- a/GraphBLAS/Test/GB_mex_about.c +++ b/GraphBLAS/Test/GB_mex_about.c @@ -207,6 +207,7 @@ void mexFunction GrB_Descriptor Duh ; GrB_Desc_Value val ; + int v2 ; GrB_Descriptor_new (&Duh) ; GB_Descriptor_check (Duh, "\n---------------------------------- Duh:", @@ -221,6 +222,12 @@ void mexFunction GxB_COMPLETE, stdout) ; GxB_Desc_get (Duh, GxB_SORT, &val) ; printf ("got sort %d\n", val) ; CHECK (val == true) ; + GxB_Desc_set (Duh, GxB_SORT, false) ; + GxB_Desc_set_INT32 (Duh, GxB_SORT, true) ; + GB_Descriptor_check (Duh, "\n------------------------------- Duh set sort:", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GxB_SORT, &v2) ; printf ("got sort %d\n", v2) ; CHECK (v2 == true) ; + GxB_Desc_set (Duh, GrB_INP0, GrB_TRAN) ; GB_Descriptor_check (Duh, "\n------------------------------- Duh set:", GxB_COMPLETE, stdout) ; @@ -229,6 +236,15 @@ void mexFunction GxB_Desc_get (Duh, GrB_INP0, &val) ; printf ("got inp0 %d\n", val) ; CHECK (val == GrB_TRAN) ; GxB_Desc_get (Duh, GrB_INP1, &val) ; printf ("got inp1 %d\n", val) ; CHECK (val == GxB_DEFAULT) ; + GxB_Desc_set (Duh, GrB_INP0, GxB_DEFAULT) ; + GxB_Desc_set_INT32 (Duh, GrB_INP0, GrB_TRAN) ; + GB_Descriptor_check (Duh, "\n------------------------------- Duh set:", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GrB_OUTP, &v2) ; printf ("got outp %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_get_INT32 (Duh, GrB_MASK, &v2) ; printf ("got mask %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_get_INT32 (Duh, GrB_INP0, &v2) ; printf ("got inp0 %d\n", v2) ; CHECK (v2 == GrB_TRAN) ; + GxB_Desc_get_INT32 (Duh, GrB_INP1, &v2) ; printf ("got inp1 %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_set (Duh, GrB_MASK, GrB_COMP) ; GB_Descriptor_check (Duh, "\n-----Duh set mask", GxB_COMPLETE, stdout) ; @@ -237,6 +253,15 @@ void mexFunction GxB_Desc_get (Duh, GrB_INP0, &val) ; printf ("got inp0 %d\n", val) ; CHECK (val == GrB_TRAN) ; GxB_Desc_get (Duh, GrB_INP1, &val) ; printf ("got inp1 %d\n", val) ; CHECK (val == GxB_DEFAULT) ; + GxB_Desc_set (Duh, GrB_MASK, GxB_DEFAULT) ; + GxB_Desc_set_INT32 (Duh, GrB_MASK, GrB_COMP) ; + GB_Descriptor_check (Duh, "\n-----Duh set mask", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GrB_OUTP, &v2) ; printf ("got outp %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_get_INT32 (Duh, GrB_MASK, &v2) ; printf ("got mask %d\n", v2) ; CHECK (v2 == GrB_COMP) ; + GxB_Desc_get_INT32 (Duh, GrB_INP0, &v2) ; printf ("got inp0 %d\n", v2) ; CHECK (v2 == GrB_TRAN) ; + GxB_Desc_get_INT32 (Duh, GrB_INP1, &v2) ; printf ("got inp1 %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_set (Duh, GrB_OUTP, GrB_REPLACE) ; GB_Descriptor_check (Duh, "\n-----Duh set out", GxB_COMPLETE, stdout) ; @@ -245,6 +270,15 @@ void mexFunction GxB_Desc_get (Duh, GrB_INP0, &val) ; printf ("got inp0 %d\n", val) ; CHECK (val == GrB_TRAN) ; GxB_Desc_get (Duh, GrB_INP1, &val) ; printf ("got inp1 %d\n", val) ; CHECK (val == GxB_DEFAULT) ; + GxB_Desc_set (Duh, GrB_OUTP, GxB_DEFAULT) ; + GxB_Desc_set_INT32 (Duh, GrB_OUTP, GrB_REPLACE) ; + GB_Descriptor_check (Duh, "\n-----Duh set out", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GrB_OUTP, &v2) ; printf ("got outp %d\n", v2) ; CHECK (v2 == GrB_REPLACE) ; + GxB_Desc_get_INT32 (Duh, GrB_MASK, &v2) ; printf ("got mask %d\n", v2) ; CHECK (v2 == GrB_COMP) ; + GxB_Desc_get_INT32 (Duh, GrB_INP0, &v2) ; printf ("got inp0 %d\n", v2) ; CHECK (v2 == GrB_TRAN) ; + GxB_Desc_get_INT32 (Duh, GrB_INP1, &v2) ; printf ("got inp1 %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GrB_Descriptor_set (Duh, GrB_MASK, GrB_STRUCTURE) ; GB_Descriptor_check (Duh, "\n-----Duh set mask structural", GxB_COMPLETE, stdout) ; @@ -253,6 +287,16 @@ void mexFunction GxB_Desc_get (Duh, GrB_INP0, &val) ; printf ("got inp0 %d\n", val) ; CHECK (val == GrB_TRAN) ; GxB_Desc_get (Duh, GrB_INP1, &val) ; printf ("got inp1 %d\n", val) ; CHECK (val == GxB_DEFAULT) ; + GrB_Descriptor_set (Duh, GrB_MASK, GxB_DEFAULT) ; + GxB_Desc_set_INT32 (Duh, GrB_MASK, GrB_STRUCTURE) ; + GxB_Desc_set_INT32 (Duh, GrB_MASK, GrB_COMP) ; + GB_Descriptor_check (Duh, "\n-----Duh set mask structural", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GrB_OUTP, &v2) ; printf ("got outp %d\n", v2) ; CHECK (v2 == GrB_REPLACE) ; + GxB_Desc_get_INT32 (Duh, GrB_MASK, &v2) ; printf ("got mask %d\n", v2) ; CHECK (v2 == GrB_COMP + GrB_STRUCTURE) ; + GxB_Desc_get_INT32 (Duh, GrB_INP0, &v2) ; printf ("got inp0 %d\n", v2) ; CHECK (v2 == GrB_TRAN) ; + GxB_Desc_get_INT32 (Duh, GrB_INP1, &v2) ; printf ("got inp1 %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GrB_Descriptor_set (Duh, GrB_MASK, GxB_DEFAULT) ; GB_Descriptor_check (Duh, "\n-----Duh set mask back", GxB_COMPLETE, stdout) ; @@ -261,6 +305,15 @@ void mexFunction GxB_Desc_get (Duh, GrB_INP0, &val) ; printf ("got inp0 %d\n", val) ; CHECK (val == GrB_TRAN) ; GxB_Desc_get (Duh, GrB_INP1, &val) ; printf ("got inp1 %d\n", val) ; CHECK (val == GxB_DEFAULT) ; + GrB_Descriptor_set (Duh, GrB_MASK, GrB_STRUCTURE) ; + GxB_Desc_set_INT32 (Duh, GrB_MASK, GxB_DEFAULT) ; + GB_Descriptor_check (Duh, "\n-----Duh set mask back", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GrB_OUTP, &v2) ; printf ("got outp %d\n", v2) ; CHECK (v2 == GrB_REPLACE) ; + GxB_Desc_get_INT32 (Duh, GrB_MASK, &v2) ; printf ("got mask %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_get_INT32 (Duh, GrB_INP0, &v2) ; printf ("got inp0 %d\n", v2) ; CHECK (v2 == GrB_TRAN) ; + GxB_Desc_get_INT32 (Duh, GrB_INP1, &v2) ; printf ("got inp1 %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + info = GxB_Desc_set (Duh, GrB_INP1, GrB_REPLACE) ; OK (GrB_Descriptor_wait_(Duh, GrB_MATERIALIZE)) ; GrB_Descriptor_error_(&err, Duh) ; @@ -272,6 +325,18 @@ void mexFunction GxB_Desc_get (Duh, GrB_INP0, &val) ; printf ("got inp0 %d\n", val) ; CHECK (val == GrB_TRAN) ; GxB_Desc_get (Duh, GrB_INP1, &val) ; printf ("got inp1 %d\n", val) ; CHECK (val == GxB_DEFAULT) ; + info = GxB_Desc_set (Duh, GrB_INP1, GxB_DEFAULT) ; + info = GxB_Desc_set_INT32 (Duh, GrB_INP1, GrB_REPLACE) ; + OK (GrB_Descriptor_wait_(Duh, GrB_MATERIALIZE)) ; + GrB_Descriptor_error_(&err, Duh) ; + printf ("%s\n", err) ; + GB_Descriptor_check (Duh, "\n-----Duh set in1", + GxB_COMPLETE, stdout) ; + GxB_Desc_get_INT32 (Duh, GrB_OUTP, &v2) ; printf ("got outp %d\n", v2) ; CHECK (v2 == GrB_REPLACE) ; + GxB_Desc_get_INT32 (Duh, GrB_MASK, &v2) ; printf ("got mask %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GxB_Desc_get_INT32 (Duh, GrB_INP0, &v2) ; printf ("got inp0 %d\n", v2) ; CHECK (v2 == GrB_TRAN) ; + GxB_Desc_get_INT32 (Duh, GrB_INP1, &v2) ; printf ("got inp1 %d\n", v2) ; CHECK (v2 == GxB_DEFAULT) ; + GrB_Descriptor_free_(&Duh) ; //-------------------------------------------------------------------------- @@ -312,13 +377,23 @@ void mexFunction CHECK (strcmp (about, GxB_SPEC_ABOUT) == 0) ; printf ("About the spec:\n%s\n", about) ; + char *str ; + OK (GxB_Global_Option_get_CHAR (GxB_API_ABOUT, &str)) ; + CHECK (strcmp (str, GxB_SPEC_ABOUT) == 0) ; + OK (GxB_Global_Option_get_(GxB_API_DATE, &date)) ; CHECK (strcmp (date, GxB_SPEC_DATE) == 0) ; printf ("date: %s\n", date) ; + OK (GxB_Global_Option_get_CHAR (GxB_API_DATE, &str)) ; + CHECK (strcmp (str, GxB_SPEC_DATE) == 0) ; + OK (GxB_Global_Option_get_(GxB_API_URL, &url)) ; printf ("URL: %s\n", url) ; + OK (GxB_Global_Option_get_CHAR (GxB_API_URL, &str)) ; + CHECK (strcmp (str, url) == 0) ; + OK (GxB_Global_Option_get_(GxB_API_VERSION, all_version)) ; CHECK (all_version [0] == GxB_SPEC_MAJOR) ; CHECK (all_version [1] == GxB_SPEC_MINOR) ; @@ -326,6 +401,12 @@ void mexFunction printf ("Spec Version (%d.%d.%d)\n", all_version [0], all_version [1], all_version [2]) ; + int32_t all_version2 [3] = { -1, -1, -2 } ; + OK (GxB_Global_Option_get_INT32 (GxB_API_VERSION, all_version2)) ; + CHECK (all_version2 [0] == GxB_SPEC_MAJOR) ; + CHECK (all_version2 [1] == GxB_SPEC_MINOR) ; + CHECK (all_version2 [2] == GxB_SPEC_SUB) ; + //-------------------------------------------------------------------------- // about the library //-------------------------------------------------------------------------- @@ -337,18 +418,30 @@ void mexFunction CHECK (strcmp (name, GxB_IMPLEMENTATION_NAME) == 0) ; printf ("name: %s\n", name) ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_NAME, &str)) ; + CHECK (strcmp (str, GxB_IMPLEMENTATION_NAME) == 0) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_DATE, &date)) ; if (date != NULL) printf ("date: %s\n", date) ; CHECK (strcmp (date, GxB_IMPLEMENTATION_DATE) == 0) ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_DATE, &str)) ; + CHECK (strcmp (str, GxB_IMPLEMENTATION_DATE) == 0) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_ABOUT, &about)) ; CHECK (strcmp (about, GxB_IMPLEMENTATION_ABOUT) == 0) ; printf ("about:\n%s\n", about) ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_ABOUT, &str)) ; + CHECK (strcmp (str, GxB_IMPLEMENTATION_ABOUT) == 0) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_LICENSE, &license)) ; CHECK (strcmp (license, GxB_IMPLEMENTATION_LICENSE) == 0) ; printf ("license:\n%s\n", license) ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_LICENSE, &str)) ; + CHECK (strcmp (str, GxB_IMPLEMENTATION_LICENSE) == 0) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_VERSION, all_version)) ; CHECK (all_version [0] == GxB_IMPLEMENTATION_MAJOR) ; CHECK (all_version [1] == GxB_IMPLEMENTATION_MINOR) ; @@ -357,19 +450,37 @@ void mexFunction all_version [0], all_version [1], all_version [2]) ; printf ("Implementation: ("GBu")\n", GxB_IMPLEMENTATION) ; + OK (GxB_Global_Option_get_INT32 (GxB_LIBRARY_VERSION, all_version2)) ; + CHECK (all_version2 [0] == GxB_IMPLEMENTATION_MAJOR) ; + CHECK (all_version2 [1] == GxB_IMPLEMENTATION_MINOR) ; + CHECK (all_version2 [2] == GxB_IMPLEMENTATION_SUB) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_COMPILE_DATE, &compile_date)) ; printf ("compile date: %s\n", compile_date) ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_COMPILE_DATE, &str)) ; + CHECK (strcmp (str, compile_date) == 0) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_COMPILE_TIME, &compile_time)) ; printf ("compile time: %s\n", compile_time) ; - bool have_openmp ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_COMPILE_TIME, &str)) ; + CHECK (strcmp (str, compile_time) == 0) ; + + bool have_openmp = false ; OK (GxB_Global_Option_get_(GxB_LIBRARY_OPENMP, &have_openmp)) ; printf ("with OpenMP: %d\n", have_openmp) ; + int32_t have_openmp2 = 33 ; + OK (GxB_Global_Option_get_INT32 (GxB_LIBRARY_OPENMP, &have_openmp2)) ; + CHECK ((have_openmp ? 1 : 0) == have_openmp2) ; + OK (GxB_Global_Option_get_(GxB_LIBRARY_URL, &url)) ; printf ("URL: %s\n", url) ; + OK (GxB_Global_Option_get_CHAR (GxB_LIBRARY_URL, &str)) ; + CHECK (strcmp (str, url) == 0) ; + #if GxB_SPEC_VERSION >= GxB_VERSION(1,0,0) printf ("The spec is >= version 1.0.0\n") ; #else @@ -401,14 +512,30 @@ void mexFunction OK (GxB_Global_Option_get_(GxB_GLOBAL_GPU_CONTROL, &gpu_control)) ; printf ("gpu control: %d\n", gpu_control) ; + int32_t gpu_control2 = -88 ; + OK (GxB_Global_Option_get_INT32 (GxB_GLOBAL_GPU_CONTROL, &gpu_control2)) ; + CHECK ((int) gpu_control == gpu_control2) ; + + GB_Global_gpu_control_set (12) ; OK (GxB_Global_Option_set_(GxB_GLOBAL_GPU_CONTROL, GxB_GPU_NEVER)) ; OK (GxB_Global_Option_get_(GxB_GLOBAL_GPU_CONTROL, &gpu_control)) ; CHECK (gpu_control == GxB_GPU_NEVER) ; + GB_Global_gpu_control_set (13) ; + OK (GxB_Global_Option_set_INT32 (GxB_GLOBAL_GPU_CONTROL, GxB_GPU_NEVER)) ; + OK (GxB_Global_Option_get_INT32 (GxB_GLOBAL_GPU_CONTROL, &gpu_control2)) ; + CHECK (gpu_control2 == (int32_t) GxB_GPU_NEVER) ; + + OK (GxB_Global_Option_get_INT32 (GxB_GLOBAL_GPU_CONTROL, &gpu_control2)) ; + CHECK (gpu_control2 == (int) GxB_GPU_NEVER) ; + OK (GxB_Global_Option_set_(GxB_GLOBAL_GPU_CONTROL, GxB_GPU_ALWAYS)) ; OK (GxB_Global_Option_get_(GxB_GLOBAL_GPU_CONTROL, &gpu_control)) ; CHECK (gpu_control == (gpu_count > 0) ? GxB_GPU_ALWAYS : GxB_GPU_NEVER) ; + OK (GxB_Global_Option_get_INT32 (GxB_GLOBAL_GPU_CONTROL, &gpu_control2)) ; + CHECK (gpu_control2 == (gpu_count > 0) ? GxB_GPU_ALWAYS : GxB_GPU_NEVER) ; + OK (GxB_Global_Option_set_(GxB_GLOBAL_GPU_CONTROL, GxB_DEFAULT)) ; OK (GxB_Global_Option_get_(GxB_GLOBAL_GPU_CONTROL, &gpu_control)) ; CHECK (gpu_control == (gpu_count > 0) ? GxB_DEFAULT : GxB_GPU_NEVER) ; @@ -417,11 +544,23 @@ void mexFunction OK (GxB_Global_Option_get_(GxB_GLOBAL_GPU_CHUNK, &gpu_chunk)) ; printf ("gpu chunk: %g\n", gpu_chunk) ; + double gpu_chunk2 = -1 ; + OK (GxB_Global_Option_get_FP64 (GxB_GLOBAL_GPU_CHUNK, &gpu_chunk2)) ; + CHECK (gpu_chunk == gpu_chunk2) ; + double gpu_chunk_42 = 42e6 ; OK (GxB_Global_Option_set_(GxB_GLOBAL_GPU_CHUNK, gpu_chunk_42)) ; OK (GxB_Global_Option_get_(GxB_GLOBAL_GPU_CHUNK, &gpu_chunk)) ; CHECK (gpu_chunk == 42e6) ; + OK (GxB_Global_Option_get_FP64 (GxB_GLOBAL_GPU_CHUNK, &gpu_chunk2)) ; + CHECK (gpu_chunk2 == 42e6) ; + + double gpu_chunk_43 = 43e6 ; + OK (GxB_Global_Option_set_FP64 (GxB_GLOBAL_GPU_CHUNK, gpu_chunk_43)) ; + OK (GxB_Global_Option_get_FP64 (GxB_GLOBAL_GPU_CHUNK, &gpu_chunk)) ; + CHECK (gpu_chunk == 43e6) ; + //-------------------------------------------------------------------------- // types //-------------------------------------------------------------------------- @@ -494,28 +633,45 @@ void mexFunction // global get/set //-------------------------------------------------------------------------- - double h, bswitch [GxB_NBITMAP_SWITCH] ; + double h = 1, h2 = 3, bswitch [GxB_NBITMAP_SWITCH] ; + double bswitch2 [GxB_NBITMAP_SWITCH] ; GxB_Format_Value ff ; + int32_t ff2 ; GxB_Global_Option_get_(GxB_HYPER_SWITCH, &h) ; + GxB_Global_Option_get_FP64 (GxB_HYPER_SWITCH, &h2) ; + CHECK (h == h2) ; + GxB_Global_Option_get_(GxB_BITMAP_SWITCH, bswitch) ; + GxB_Global_Option_get_FP64 (GxB_BITMAP_SWITCH, bswitch2) ; GxB_Global_Option_get_(GxB_FORMAT, &ff) ; + GxB_Global_Option_get_INT32 (GxB_FORMAT, &ff2) ; printf ("hyper_switch %g csc %d\n", h, (ff == GxB_BY_COL)) ; + CHECK ((int32_t) ff == ff2) ; for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) { printf ("bitmap_switch [%d]: %g\n", k, bswitch [k]) ; + CHECK (bswitch [k] == bswitch2 [k]) ; } - GrB_Mode mode ; + GrB_Mode mode = GrB_BLOCKING ; GxB_Global_Option_get_(GxB_MODE, &mode) ; printf ("mode: %d\n", mode) ; - int nthreads ; + int32_t mode2 = 55 ; + GxB_Global_Option_get_INT32 (GxB_MODE, &mode2) ; + CHECK ((int32_t) mode == mode2) ; + + int nthreads = 1, nthreads2 = 2 ; GxB_Global_Option_get_(GxB_NTHREADS, &nthreads) ; + GxB_Global_Option_get_INT32 (GxB_NTHREADS, &nthreads2) ; printf ("# threads: %d\n", nthreads) ; + CHECK (nthreads == nthreads2) ; - double chunk ; + double chunk = 45, chunk2 = 99 ; GxB_Global_Option_get_(GxB_CHUNK, &chunk) ; + GxB_Global_Option_get_FP64 (GxB_CHUNK, &chunk2) ; printf ("chunk: %g\n", chunk) ; + CHECK (chunk == chunk2) ; //-------------------------------------------------------------------------- // check A and B aliased @@ -553,6 +709,12 @@ void mexFunction OK (GxB_Descriptor_fprint_(desc, GxB_COMPLETE, NULL)) ; CHECK (chunk == 12345) ; CHECK (nthreads == 42) ; + + chunk = -1 ; + nthreads = 0 ; + OK (GxB_Desc_get_FP64 (desc, GxB_CHUNK, &chunk)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_NTHREADS, &nthreads)) ; + GrB_Descriptor_free_(&desc) ; //-------------------------------------------------------------------------- @@ -792,31 +954,60 @@ void mexFunction // GxB_get //-------------------------------------------------------------------------- - int sparsity ; + int sparsity = 88 ; OK (GxB_Matrix_Option_get_(A, GxB_SPARSITY_CONTROL, &sparsity)) ; CHECK (sparsity == GxB_AUTO_SPARSITY) ; + + sparsity = 88 ; + OK (GxB_Matrix_Option_get_INT32 (A, GxB_SPARSITY_CONTROL, &sparsity)) ; + CHECK (sparsity == GxB_AUTO_SPARSITY) ; + + sparsity = 88 ; OK (GxB_Vector_Option_get_(victor, GxB_SPARSITY_CONTROL, &sparsity)) ; CHECK (sparsity == GxB_AUTO_SPARSITY) ; + + sparsity = 88 ; + OK (GxB_Vector_Option_get_INT32 (victor, GxB_SPARSITY_CONTROL, &sparsity)) ; + CHECK (sparsity == GxB_AUTO_SPARSITY) ; + + sparsity = 88 ; OK (GxB_Vector_Option_get_(victor, GxB_SPARSITY_STATUS, &sparsity)) ; CHECK (sparsity == GxB_SPARSE) ; + + sparsity = 88 ; + OK (GxB_Vector_Option_get_INT32 (victor, GxB_SPARSITY_STATUS, &sparsity)) ; + CHECK (sparsity == GxB_SPARSE) ; + GxB_Format_Value fmt ; OK (GxB_Vector_Option_get_(victor, GxB_FORMAT, &fmt)) ; CHECK (fmt == GxB_BY_COL) ; + + int f2 = 44 ; + OK (GxB_Vector_Option_get_INT32 (victor, GxB_FORMAT, &f2)) ; + CHECK (f2 == GxB_BY_COL) ; + bool is_hyper ; OK (GxB_Vector_Option_get_(victor, GxB_IS_HYPER, &is_hyper)) ; CHECK (!is_hyper) ; + expected = GrB_INVALID_VALUE ; ERR (GxB_Vector_Option_get_(victor, -999, &is_hyper)) ; + ERR (GxB_Vector_Option_get_INT32 (victor, -999, &f2)) ; //-------------------------------------------------------------------------- // GxB_set //-------------------------------------------------------------------------- ERR (GxB_Vector_Option_set_(victor, -999, &is_hyper)) ; + OK (GxB_Vector_Option_set_(victor, GxB_SPARSITY_CONTROL, 9999)) ; OK (GxB_Vector_Option_get_(victor, GxB_SPARSITY_CONTROL, &sparsity)) ; CHECK (sparsity == GxB_AUTO_SPARSITY) ; + OK (GxB_Vector_Option_set_INT32 (victor, GxB_SPARSITY_CONTROL, 9999)) ; + OK (GxB_Vector_Option_get_INT32 (victor, GxB_SPARSITY_CONTROL, &sparsity)) ; + CHECK (sparsity == GxB_AUTO_SPARSITY) ; + //-------------------------------------------------------------------------- // removeElement errors //-------------------------------------------------------------------------- @@ -888,10 +1079,26 @@ void mexFunction OK (GxB_Global_Option_set (GxB_PRINT_1BASED, true)) ; OK (GxB_Global_Option_get (GxB_PRINT_1BASED, &onebased)) ; CHECK (onebased) ; + + int32_t onebased2 ; + OK (GxB_Global_Option_get_INT32 (GxB_PRINT_1BASED, &onebased2)) ; + CHECK (onebased2) ; + + OK (GxB_Global_Option_set_INT32 (GxB_PRINT_1BASED, false)) ; + OK (GxB_Global_Option_get_INT32 (GxB_PRINT_1BASED, &onebased2)) ; + CHECK (!onebased2) ; + OK (GxB_Matrix_fprint_(C, GxB_COMPLETE_VERBOSE, NULL)) ; - OK (GxB_Global_Option_set (GxB_PRINT_1BASED, false)) ; + OK (GxB_Global_Option_set (GxB_PRINT_1BASED, true)) ; OK (GxB_Global_Option_get (GxB_PRINT_1BASED, &onebased)) ; - CHECK (!onebased) ; + CHECK (onebased) ; + + OK (GxB_Global_Option_get_INT32 (GxB_PRINT_1BASED, &onebased2)) ; + CHECK (onebased2) ; + + OK (GxB_Global_Option_set_INT32 (GxB_PRINT_1BASED, true)) ; + OK (GxB_Global_Option_get_INT32 (GxB_PRINT_1BASED, &onebased2)) ; + CHECK (onebased2) ; expected = GrB_NULL_POINTER ; ERR1 (C, GxB_Matrix_select_(C, NULL, NULL, selectop, A, NULL, NULL)) ; @@ -1072,6 +1279,10 @@ void mexFunction OK (GxB_Global_Option_get_(GxB_BURBLE, &burble)) ; printf ("burble: %d\n", burble) ; + int32_t burble2 = 33 ; + OK (GxB_Global_Option_get_INT32 (GxB_BURBLE, &burble2)) ; + CHECK ((int32_t) burble == burble2) ; + //-------------------------------------------------------------------------- // select ops //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_about10.c b/GraphBLAS/Test/GB_mex_about10.c new file mode 100644 index 0000000000..b5d8d1df1f --- /dev/null +++ b/GraphBLAS/Test/GB_mex_about10.c @@ -0,0 +1,116 @@ +//------------------------------------------------------------------------------ +// GB_mex_about9: still more basic tests +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_about10" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + GrB_Info info, expected ; + GrB_Matrix A = NULL ; + GrB_Vector v = NULL ; + int64_t pool1 [64], pool2 [64] ; + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Descriptor desc = NULL ; + bool malloc_debug = GB_mx_get_global (true) ; + + //-------------------------------------------------------------------------- + // get/set tests + //-------------------------------------------------------------------------- + + double chunk = 0 ; + expected = GrB_INVALID_VALUE ; + ERR (GxB_Desc_set_INT32 (GrB_DESC_ST0, GrB_OUTP, GrB_REPLACE)) ; + ERR (GxB_Desc_set_FP64 (GrB_DESC_ST0, GxB_DESCRIPTOR_CHUNK, 1e6)) ; + ERR (GxB_Global_Option_set_FP64 (-1, 0)) ; + ERR (GxB_Global_Option_set_FP64_ARRAY (-1, NULL)) ; + ERR (GxB_Global_Option_set_INT64_ARRAY (-1, NULL)) ; + ERR (GxB_Global_Option_set_FUNCTION (-1, NULL)) ; + ERR (GxB_Desc_get_FP64 (NULL, -1, &chunk)) ; + + int value = -1 ; + OK (GrB_Descriptor_new (&desc)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_IMPORT, &value)) ; + CHECK (value == GxB_DEFAULT) ; + OK (GxB_Desc_set_INT32 (desc, GxB_IMPORT, GxB_SECURE_IMPORT)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_IMPORT, &value)) ; + CHECK (value == GxB_SECURE_IMPORT) ; + + OK (GxB_Desc_set_FP64 (desc, GxB_DESCRIPTOR_CHUNK, 1e6)) ; + OK (GxB_Desc_get_FP64 (desc, GxB_DESCRIPTOR_CHUNK, &chunk)) ; + CHECK (chunk = 1e6) ; + + OK (GxB_Global_Option_set_FP64 (GxB_GLOBAL_CHUNK, 2e6)) ; + OK (GxB_Global_Option_get_FP64 (GxB_GLOBAL_CHUNK, &chunk)) ; + CHECK (chunk = 2e6) ; + + int32_t ver [3] ; + char *compiler ; + OK (GxB_Global_Option_get_INT32 (GxB_COMPILER_VERSION, ver)) ; + OK (GxB_Global_Option_get_CHAR (GxB_COMPILER_NAME, &compiler)) ; + printf ("compiler: %s %d.%d.%d\n", compiler, ver [0], ver [1], ver [2]) ; + + OK (GxB_Global_Option_set_INT32 (GxB_BURBLE, 1)) ; + OK (GrB_Matrix_new (&A, GrB_FP64, 10, 10)) ; + OK (GrB_transpose (A, NULL, NULL, A, desc)) ; + OK (GxB_Global_Option_set_INT32 (GxB_BURBLE, 0)) ; + OK (GrB_transpose (A, NULL, NULL, A, desc)) ; + + OK (GxB_Matrix_Option_get_INT32 (A, GxB_SPARSITY_STATUS, &value)) ; + CHECK (value == GxB_HYPERSPARSE) ; + + double bswitch1 = 0.5, bswitch2 = 1.0 ; + OK (GxB_Matrix_Option_set (A, GxB_BITMAP_SWITCH, bswitch1)) ; + OK (GxB_Matrix_Option_get (A, GxB_BITMAP_SWITCH, &bswitch2)) ; + CHECK (bswitch1 == bswitch2) ; + + for (int k = 0 ; k < 64 ; k++) + { + pool1 [k] = (k < 3) ? 0 : k ; + } + OK (GxB_Global_Option_set_INT64_ARRAY (GxB_MEMORY_POOL, pool1)) ; + OK (GxB_Global_Option_get_INT64 (GxB_MEMORY_POOL, pool2)) ; + for (int k = 0 ; k < 64 ; k++) + { + CHECK (pool1 [k] == pool2 [k]) ; + } + + ERR (GxB_Matrix_Option_set_FP64 (A, -1, 0)) ; + + OK (GrB_Vector_new (&v, GrB_FP64, 10)) ; + ERR (GxB_Vector_Option_set_FP64 (v, -1, 0)) ; + ERR (GxB_Vector_Option_set_FP64 (v, -1, 0)) ; + ERR (GxB_Vector_Option_get_FP64 (v, -1, &chunk)) ; + ERR (GxB_Vector_Option_set_INT32 (v, -1, 0)) ; + + OK (GrB_Descriptor_free (&desc)) ; + OK (GrB_Matrix_free (&A)) ; + OK (GrB_Vector_free (&v)) ; + + //-------------------------------------------------------------------------- + // wrapup + //-------------------------------------------------------------------------- + + GB_mx_put_global (true) ; + printf ("\nGB_mex_about10: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_about2.c b/GraphBLAS/Test/GB_mex_about2.c index a795061109..b92ab29c51 100644 --- a/GraphBLAS/Test/GB_mex_about2.c +++ b/GraphBLAS/Test/GB_mex_about2.c @@ -114,7 +114,7 @@ void mexFunction int n = 10 ; OK (GrB_Matrix_new (&A, GxB_FC32, n, n)) ; - OK (GxB_Matrix_Option_set_(A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; OK (GrB_Matrix_new (&C, GxB_FC32, n, n)) ; OK (GrB_Scalar_new (&scalar, GxB_FC32)) ; @@ -148,9 +148,12 @@ void mexFunction double bswitch = 1 ; OK (GrB_Matrix_new (&A, GrB_INT32, n, n)) ; - OK (GxB_Matrix_Option_set_(A, GxB_BITMAP_SWITCH, 0.125)) ; + OK (GxB_Matrix_Option_set_FP64 (A, GxB_BITMAP_SWITCH, 0.125)) ; OK (GxB_Matrix_Option_get_(A, GxB_BITMAP_SWITCH, &bswitch)) ; CHECK (fabs (bswitch - 0.125) < 1e-5) ; + bswitch = 1 ; + OK (GxB_Matrix_Option_get_FP64 (A, GxB_BITMAP_SWITCH, &bswitch)) ; + CHECK (fabs (bswitch - 0.125) < 1e-5) ; OK (GxB_Matrix_Option_set_(A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; OK (GrB_Matrix_assign_INT32 (A, NULL, NULL, 3, GrB_ALL, n, GrB_ALL, n, @@ -296,11 +299,19 @@ void mexFunction OK (GxB_Desc_get (NULL, GxB_AxB_METHOD, &method)) ; CHECK (method == GxB_DEFAULT) ; + method = -1 ; + OK (GxB_Desc_get_INT32 (NULL, GxB_AxB_METHOD, &method)) ; + CHECK (method == GxB_DEFAULT) ; OK (GxB_Desc_set (desc, GxB_AxB_METHOD, GxB_AxB_GUSTAVSON)) ; OK (GxB_Descriptor_fprint (desc, "descriptor", GxB_COMPLETE, NULL)) ; OK (GxB_Desc_get (desc, GxB_AxB_METHOD, &method)) ; CHECK (method == GxB_AxB_GUSTAVSON) ; + OK (GxB_Desc_set_INT32 (desc, GxB_AxB_METHOD, GxB_AxB_SAXPY)) ; + OK (GxB_Descriptor_fprint (desc, "descriptor", GxB_COMPLETE, NULL)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_AxB_METHOD, &method)) ; + CHECK (method == GxB_AxB_SAXPY) ; + desc->mask = GrB_REPLACE ; expected = GrB_INVALID_OBJECT ; ERR (GxB_Descriptor_fprint (desc, "invalid", GxB_COMPLETE, NULL)) ; @@ -332,6 +343,10 @@ void mexFunction OK (GxB_Vector_Option_get_(victor, GxB_BITMAP_SWITCH, &bswitch)) ; printf ("vector bitmap switch: %g\n\n", bswitch) ; + double b2 = 0 ; + OK (GxB_Vector_Option_get_FP64 (victor, GxB_BITMAP_SWITCH, &b2)) ; + CHECK (bswitch == b2) ; + expected = GrB_NOT_IMPLEMENTED ; ERR (GrB_Matrix_reduce_BinaryOp (victor, NULL, NULL, GxB_FIRSTI_INT32, A, NULL)) ; @@ -431,6 +446,12 @@ void mexFunction double bitmap_switch = 8 ; OK (GxB_Vector_Option_get (victor, GxB_BITMAP_SWITCH, &bitmap_switch)) ; CHECK (bitmap_switch == 4.5) ; + + OK (GxB_Vector_Option_set_FP64 (victor, GxB_BITMAP_SWITCH, (double) 5.25)) ; + bitmap_switch = 8 ; + OK (GxB_Vector_Option_get_FP64 (victor, GxB_BITMAP_SWITCH, &bitmap_switch)) ; + CHECK (bitmap_switch == 5.25) ; + GrB_Vector_free (&victor) ; //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_about3.c b/GraphBLAS/Test/GB_mex_about3.c index 6fb43a44f9..02ebd7d06c 100644 --- a/GraphBLAS/Test/GB_mex_about3.c +++ b/GraphBLAS/Test/GB_mex_about3.c @@ -86,13 +86,17 @@ void mexFunction OK (GxB_Global_Option_set (GxB_PRINTF, myprintf)) ; OK (GxB_Global_Option_set (GxB_FLUSH, myflush)) ; - printf_func_t mypr ; + printf_func_t mypr, mypr2 ; OK (GxB_Global_Option_get (GxB_PRINTF, &mypr)) ; + OK (GxB_Global_Option_get_FUNCTION (GxB_PRINTF, (void **) &mypr2)) ; CHECK (mypr == myprintf) ; + CHECK (mypr2 == myprintf) ; - flush_func_t myfl ; + flush_func_t myfl, myfl2 ; OK (GxB_Global_Option_get (GxB_FLUSH, &myfl)) ; + OK (GxB_Global_Option_get_FUNCTION (GxB_FLUSH, (void **) &myfl2)) ; CHECK (myfl == myflush) ; + CHECK (myfl2 == myflush) ; printf ("\nBurble with myprintf/myflush:\n") ; OK (GrB_Matrix_nvals (&nvals, C)) ; @@ -102,44 +106,79 @@ void mexFunction OK (GxB_Global_Option_set (GxB_PRINTF, printf)) ; OK (GxB_Global_Option_set (GxB_FLUSH, NULL)) ; + OK (GxB_Global_Option_set_FUNCTION (GxB_PRINTF, myprintf)) ; + OK (GxB_Global_Option_set_FUNCTION (GxB_FLUSH, myflush)) ; + + OK (GxB_Global_Option_get_FUNCTION (GxB_PRINTF, (void **) &mypr2)) ; + OK (GxB_Global_Option_get_FUNCTION (GxB_FLUSH, (void **) &myfl2)) ; + CHECK (mypr2 == myprintf) ; + CHECK (myfl2 == myflush) ; + + OK (GxB_Global_Option_set (GxB_PRINTF, printf)) ; + OK (GxB_Global_Option_set (GxB_FLUSH, NULL)) ; + //-------------------------------------------------------------------------- // test GxB_set/get for free_pool_limit //-------------------------------------------------------------------------- - int64_t free_pool_limit [64] ; + int64_t free_pool_limit [64], free_pool_limit2 [64] ; + int64_t free_pool_defaults [64] ; + for (int k = 0 ; k < 64 ; k++) + { + free_pool_limit [k] = k+1 ; + free_pool_limit2 [k] = 3*k + 4 ; + } + OK (GxB_Global_Option_set (GxB_MEMORY_POOL, NULL)) ; - OK (GxB_Global_Option_get (GxB_MEMORY_POOL, free_pool_limit)) ; + OK (GxB_Global_Option_get (GxB_MEMORY_POOL, free_pool_defaults)) ; + OK (GxB_Global_Option_get_INT64 (GxB_MEMORY_POOL, free_pool_limit2)) ; printf ("\ndefault memory pool limits:\n") ; for (int k = 0 ; k < 64 ; k++) { - if (free_pool_limit [k] > 0) + if (free_pool_defaults [k] > 0) { - printf ("pool %2d: limit %ld\n", k, free_pool_limit [k]) ; + printf ("pool %2d: limit %ld\n", k, free_pool_defaults [k]) ; } + CHECK (free_pool_defaults [k] == free_pool_limit2 [k]) ; } + for (int k = 0 ; k < 64 ; k++) { free_pool_limit [k] = k ; } OK (GxB_Global_Option_set (GxB_MEMORY_POOL, free_pool_limit)) ; OK (GxB_Global_Option_get (GxB_MEMORY_POOL, free_pool_limit)) ; + OK (GxB_Global_Option_get_INT64 (GxB_MEMORY_POOL, free_pool_limit2)) ; for (int k = 0 ; k < 3 ; k++) { CHECK (free_pool_limit [k] == 0) ; + CHECK (free_pool_limit2 [k] == 0) ; } for (int k = 3 ; k < 64 ; k++) { CHECK (free_pool_limit [k] == k) ; + CHECK (free_pool_limit2 [k] == k) ; } for (int k = 0 ; k < 64 ; k++) { free_pool_limit [k] = 0 ; + free_pool_limit2 [k] = 0 ; } + OK (GxB_Global_Option_set (GxB_MEMORY_POOL, free_pool_limit)) ; OK (GxB_Global_Option_get (GxB_MEMORY_POOL, free_pool_limit)) ; + OK (GxB_Global_Option_get_INT64 (GxB_MEMORY_POOL, free_pool_limit2)) ; for (int k = 0 ; k < 64 ; k++) { CHECK (free_pool_limit [k] == 0) ; + CHECK (free_pool_limit2 [k] == 0) ; + } + + OK (GxB_Global_Option_set_INT64_ARRAY (GxB_MEMORY_POOL, NULL)) ; + OK (GxB_Global_Option_get_INT64 (GxB_MEMORY_POOL, free_pool_limit2)) ; + for (int k = 0 ; k < 64 ; k++) + { + CHECK (free_pool_defaults [k] == free_pool_limit2 [k]) ; } //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_about5.c b/GraphBLAS/Test/GB_mex_about5.c index fdb17ae642..944a7fcf70 100644 --- a/GraphBLAS/Test/GB_mex_about5.c +++ b/GraphBLAS/Test/GB_mex_about5.c @@ -925,6 +925,10 @@ void mexFunction OK (GxB_Desc_set (desc, GxB_IMPORT, GxB_SECURE_IMPORT)) ; OK (GxB_Descriptor_fprint (desc, "desc with secure import", 3, NULL)) ; + OK (GxB_Desc_set_INT32 (desc, GxB_IMPORT, GxB_DEFAULT)) ; + OK (GxB_Desc_set_INT32 (desc, GxB_IMPORT, GxB_SECURE_IMPORT)) ; + OK (GxB_Descriptor_fprint (desc, "desc with secure import", 3, NULL)) ; + int method = -999 ; OK (GxB_Desc_get (desc, GxB_IMPORT, &method)) ; CHECK (method == GxB_SECURE_IMPORT) ; @@ -933,6 +937,10 @@ void mexFunction OK (GxB_Desc_get (desc, GxB_COMPRESSION, &method)) ; CHECK (method == GxB_COMPRESSION_LZ4HC + 4) + OK (GxB_Desc_set_INT32 (desc, GxB_COMPRESSION, GxB_COMPRESSION_LZ4HC + 5)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_COMPRESSION, &method)) ; + CHECK (method == GxB_COMPRESSION_LZ4HC + 5) + OK (GxB_Descriptor_fprint (desc, "desc with secure & lz4hc+4", 3, NULL)) ; OK (GrB_Descriptor_free_ (&desc)) ; #endif @@ -953,31 +961,69 @@ void mexFunction OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_COO_FORMAT) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_CSR_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_COO_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_CSR_FORMAT) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_BITMAP)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_CSR_FORMAT) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_FULL)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_CSR_FORMAT) ; -// CHECK (fmt == GrB_DENSE_ROW_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_BITMAP)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_CSR_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_FULL)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_CSR_FORMAT) ; OK (GxB_Matrix_Option_set (A, GxB_FORMAT, GxB_BY_COL)) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_COO_FORMAT) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_CSC_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_COO_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_CSC_FORMAT) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_BITMAP)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_CSC_FORMAT) ; + OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_FULL)) ; OK (GrB_Matrix_exportHint (&fmt, A)) ; CHECK (fmt == GrB_CSC_FORMAT) ; + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_BITMAP)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_CSC_FORMAT) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_FULL)) ; + OK (GrB_Matrix_exportHint (&fmt, A)) ; + CHECK (fmt == GrB_CSC_FORMAT) ; + expected = GrB_NULL_POINTER ; ERR (GrB_Matrix_exportHint (NULL, A)) ; ERR (GrB_Matrix_exportHint (&fmt, NULL)) ; diff --git a/GraphBLAS/Test/GB_mex_errors.c b/GraphBLAS/Test/GB_mex_errors.c index 15708d17c1..c4ddff24d7 100644 --- a/GraphBLAS/Test/GB_mex_errors.c +++ b/GraphBLAS/Test/GB_mex_errors.c @@ -1794,6 +1794,12 @@ void mexFunction ERRD (dnull, GxB_Desc_set (dnull, 0, 0)) ; ERR (GxB_Desc_get (dnull, 0, NULL)) ; + ERRD (dnull, GxB_Desc_set_INT32 (dnull, 0, 0)) ; + ERR (GxB_Desc_get_INT32 (dnull, 0, NULL)) ; + + ERRD (dnull, GxB_Desc_set_FP64 (dnull, 0, 0)) ; + ERR (GxB_Desc_get_FP64 (dnull, 0, NULL)) ; + ERRD (dnull, GrB_Descriptor_set (dnull, 0, 0)) ; ERR (GxB_Descriptor_get (NULL, dnull, 0)) ; @@ -1802,12 +1808,23 @@ void mexFunction ERRD (dcrud, GxB_Desc_set (dcrud, 0, 0)) ; ERR (GxB_Desc_get (dcrud, 0, &dval)) ; + int32_t dval2 ; + ERRD (dcrud, GxB_Desc_set_INT32 (dcrud, 0, 0)) ; + ERR (GxB_Desc_get_INT32 (dcrud, 0, &dval2)) ; + + double dval3 ; + ERRD (dcrud, GxB_Desc_set_FP64 (dcrud, 0, 0)) ; + ERR (GxB_Desc_get_FP64 (dcrud, 0, &dval3)) ; + ERRD (dcrud, GrB_Descriptor_set (dcrud, 0, 0)) ; ERR (GxB_Descriptor_get (&dval, dcrud, 0)) ; OK (GxB_Desc_get (dnull, 0, &dval)) ; CHECK (dval == GxB_DEFAULT) ; + OK (GxB_Desc_get_INT32 (dnull, 0, &dval2)) ; + CHECK (dval2 == GxB_DEFAULT) ; + OK (GxB_Descriptor_get (&dval, dnull, 0)) ; CHECK (dval == GxB_DEFAULT) ; @@ -1816,7 +1833,10 @@ void mexFunction expected = GrB_INVALID_VALUE ; ERR (GxB_Desc_get (desc, -1, &dval)) ; + ERR (GxB_Desc_get_INT32 (desc, -1, &dval2)) ; ERRD (desc, GxB_Desc_set (desc, -1, 0)) ; + ERRD (desc, GxB_Desc_set_INT32 (desc, -1, 0)) ; + ERRD (desc, GxB_Desc_set_FP64 (desc, -1, 0)) ; ERR (GxB_Descriptor_get (&dval, desc, -1)) ; ERRD (desc, GrB_Descriptor_set (desc, -1, 0)) ; @@ -1837,6 +1857,24 @@ void mexFunction GrB_Descriptor_error_(&err, desc) ; CHECK (err != NULL) ; printf ("%s\n", err) ; + + ERRD (desc, GxB_Desc_set_INT32 (desc, GrB_OUTP, -1)) ; + GrB_Descriptor_error_(&err, desc) ; + CHECK (err != NULL) ; + printf ("%s\n", err) ; + ERRD (desc, GxB_Desc_set_INT32 (desc, GrB_MASK, -1)) ; + GrB_Descriptor_error_(&err, desc) ; + CHECK (err != NULL) ; + printf ("%s\n", err) ; + ERRD (desc, GxB_Desc_set_INT32 (desc, GrB_INP0, -1)) ; + GrB_Descriptor_error_(&err, desc) ; + CHECK (err != NULL) ; + printf ("%s\n", err) ; + ERRD (desc, GxB_Desc_set_INT32 (desc, GrB_INP1, -1)) ; + GrB_Descriptor_error_(&err, desc) ; + CHECK (err != NULL) ; + printf ("%s\n", err) ; + ERRD (desc, GrB_Descriptor_set (desc, GxB_AxB_METHOD, -1)) ; GrB_Descriptor_error_(&err, desc) ; CHECK (err != NULL) ; @@ -1863,15 +1901,32 @@ void mexFunction CHECK (err != NULL) ; printf ("%s\n", err) ; + dval = -1 ; OK (GxB_Desc_get (desc, GrB_OUTP, &dval)) ; CHECK (dval == GxB_DEFAULT) ; + dval = -1 ; OK (GxB_Desc_get (desc, GrB_MASK, &dval)) ; CHECK (dval == GxB_DEFAULT) ; + dval = -1 ; OK (GxB_Desc_get (desc, GrB_INP0, &dval)) ; CHECK (dval == GxB_DEFAULT) ; + dval = -1 ; OK (GxB_Desc_get (desc, GrB_INP1, &dval)) ; CHECK (dval == GxB_DEFAULT) ; + dval2 = -1 ; + OK (GxB_Desc_get_INT32 (desc, GrB_OUTP, &dval2)) ; + CHECK (dval2 == GxB_DEFAULT) ; + dval2 = -1 ; + OK (GxB_Desc_get_INT32 (desc, GrB_MASK, &dval2)) ; + CHECK (dval2 == GxB_DEFAULT) ; + dval2 = -1 ; + OK (GxB_Desc_get_INT32 (desc, GrB_INP0, &dval2)) ; + CHECK (dval2 == GxB_DEFAULT) ; + dval2 = -1 ; + OK (GxB_Desc_get_INT32 (desc, GrB_INP1, &dval2)) ; + CHECK (dval2 == GxB_DEFAULT) ; + OK (GxB_Descriptor_get (&dval, desc, GrB_OUTP)) ; CHECK (dval == GxB_DEFAULT) ; OK (GxB_Descriptor_get (&dval, desc, GrB_MASK)) ; @@ -1916,6 +1971,25 @@ void mexFunction OK (GB_Descriptor_check (d7, "new descriptor (still Gustavson)", G3, NULL)); OK (GxB_Descriptor_fprint (d7, "d7", G3, ff)) ; + OK (GxB_Desc_set_INT32 (d7, GxB_AxB_METHOD, GxB_DEFAULT)) ; + OK (GB_Descriptor_check (d7, "new descriptor (default)", G3, NULL)) ; + OK (GxB_Descriptor_fprint (d7, "d7", G3, ff)) ; + + OK (GxB_Desc_set_INT32 (d7, GxB_AxB_METHOD, GxB_AxB_DOT)) ; + OK (GB_Descriptor_check (d7, "new descriptor (dot)", G3, NULL)) ; + OK (GxB_Descriptor_fprint (d7, "d7", G3, ff)) ; + OK (GxB_Descriptor_get (&dval, d7, GxB_AxB_METHOD)) ; + CHECK (dval == GxB_AxB_DOT) ; + + OK (GxB_Desc_set_INT32 (d7, GxB_AxB_METHOD, GxB_AxB_GUSTAVSON)) ; + OK (GB_Descriptor_check (d7, "new descriptor (Gustavson)", G3, NULL)) ; + OK (GxB_Descriptor_fprint (d7, "d7", G3, ff)) ; + + expected = GrB_INVALID_VALUE ; + ERRD (d7, GxB_Desc_set_INT32 (d7, GxB_AxB_METHOD, 911911)) ; + OK (GB_Descriptor_check (d7, "new descriptor (still Gustavson)", G3, NULL)); + OK (GxB_Descriptor_fprint (d7, "d7", G3, ff)) ; + expected = GrB_INVALID_OBJECT ; d7->axb = 99 ; @@ -4402,12 +4476,26 @@ void mexFunction OK (GB_Matrix_check (A, "A now hyper", G3, NULL)) ; CHECK (A->h != NULL) ; + CHECK (GB_IS_HYPERSPARSE (A)) ; + OK (GxB_Matrix_Option_set_INT32 (A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; + CHECK (GB_IS_SPARSE (A)) ; + OK (GB_Matrix_check (A, "A now sparse", G3, NULL)) ; + CHECK (A->h == NULL) ; + + CHECK (GB_IS_SPARSE (A)) ; + OK (GxB_Matrix_Option_set_(A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; + CHECK (GB_IS_HYPERSPARSE (A)) ; + OK (GB_Matrix_check (A, "A now hyper", G3, NULL)) ; + CHECK (A->h != NULL) ; + OK (GxB_Matrix_Option_set_(A, GxB_HYPER_SWITCH, GxB_NEVER_HYPER)) ; OK (GxB_Matrix_Option_set_(A, GxB_SPARSITY_CONTROL, GxB_SPARSE)) ; CHECK (A->h == NULL) ; bool A_is_hyper ; OK (GxB_Matrix_Option_get_(A, GxB_IS_HYPER, &A_is_hyper)) ; // historical CHECK (!A_is_hyper) ; + int32_t A_is_hyperw ; + OK (GxB_Matrix_Option_get_(A, GxB_IS_HYPER, &A_is_hyper)) ; // historical OK (GxB_Matrix_Option_set_(A, GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER)) ; OK (GxB_Matrix_Option_set_(A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; @@ -4441,6 +4529,14 @@ void mexFunction OK (GxB_Matrix_Option_get_(A, GxB_HYPER_SWITCH, &hratio2)) ; CHECK (hratio == hratio2) ; + hratio = 0.75 ; + OK (GxB_Matrix_Option_set_FP64 (A, GxB_HYPER_SWITCH, hratio)) ; + + hratio2 = 0 ; + OK (GxB_Matrix_Option_get_FP64 (A, GxB_HYPER_SWITCH, &hratio2)) ; + printf ("hratio: %g %g %g\n", hratio, hratio2, hratio-hratio2) ; + CHECK (hratio == hratio2) ; + double bswitch [GxB_NBITMAP_SWITCH] ; for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) { @@ -4455,6 +4551,21 @@ void mexFunction CHECK (fabs (bswitch [k] - bswitch2 [k]) < 1e-5) ; } + OK (GxB_Global_Option_set_FP64_ARRAY (GxB_BITMAP_SWITCH, NULL)) ; + OK (GxB_Global_Option_set_FP64_ARRAY (GxB_BITMAP_SWITCH, bswitch)) ; + OK (GxB_Global_Option_get_(GxB_BITMAP_SWITCH, bswitch2)) ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + CHECK (fabs (bswitch [k] - bswitch2 [k]) < 1e-5) ; + } + + double bswitch3 [GxB_NBITMAP_SWITCH] ; + OK (GxB_Global_Option_get_FP64 (GxB_BITMAP_SWITCH, bswitch3)) ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + CHECK (bswitch2 [k] == bswitch3 [k]) ; + } + OK (GxB_Global_Option_set_(GxB_BITMAP_SWITCH, NULL)) ; OK (GxB_Global_Option_get_(GxB_BITMAP_SWITCH, bswitch)) ; for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) @@ -4462,6 +4573,22 @@ void mexFunction printf ("default bswitch [%d] = %g\n", k, bswitch [k]) ; } + OK (GxB_Global_Option_set_FP64_ARRAY (GxB_BITMAP_SWITCH, NULL)) ; + OK (GxB_Global_Option_get_ (GxB_BITMAP_SWITCH, bswitch2)) ; + OK (GxB_Global_Option_get_FP64 (GxB_BITMAP_SWITCH, bswitch3)) ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + CHECK (bswitch2 [k] == bswitch3 [k]) ; + } + + OK (GxB_Matrix_Option_set_(A, GxB_FORMAT, GxB_BY_COL)) ; + CHECK (GB_IS_HYPERSPARSE (A)) ; + CHECK (A->is_csc) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_FORMAT, GxB_BY_ROW)) ; + CHECK (GB_IS_HYPERSPARSE (A)) ; + CHECK (!A->is_csc) ; + OK (GxB_Matrix_Option_set_(A, GxB_FORMAT, GxB_BY_COL)) ; CHECK (GB_IS_HYPERSPARSE (A)) ; CHECK (A->is_csc) ; @@ -4470,78 +4597,184 @@ void mexFunction OK (GxB_Matrix_Option_get_(A, GxB_FORMAT, &format)) ; CHECK (format == GxB_BY_COL) ; + int f2 = 99 ; + OK (GxB_Matrix_Option_get_INT32 (A, GxB_FORMAT, &f2)) ; + CHECK (f2 == GxB_BY_COL) ; + OK (GxB_Matrix_Option_set_(A, GxB_FORMAT, GxB_BY_ROW)) ; CHECK (!A->is_csc) ; + OK (GxB_Matrix_Option_set_INT32 (A, GxB_FORMAT, GxB_BY_COL)) ; + CHECK (A->is_csc) ; + + OK (GxB_Matrix_Option_set_INT32 (A, GxB_FORMAT, GxB_BY_ROW)) ; + CHECK (!A->is_csc) ; + OK (GxB_Matrix_Option_get_(A, GxB_FORMAT, &format)) ; CHECK (format == GxB_BY_ROW) ; + OK (GxB_Matrix_Option_get_INT32 (A, GxB_FORMAT, &f2)) ; + CHECK (f2 == GxB_BY_ROW) ; + OK (GxB_Matrix_Option_set_(A, GxB_FORMAT, GxB_BY_COL)) ; CHECK (A->is_csc) ; + OK (GxB_Matrix_Option_set_INT32(A, GxB_FORMAT, GxB_BY_ROW)) ; + CHECK (!A->is_csc) ; + + OK (GxB_Matrix_Option_set_INT32(A, GxB_FORMAT, GxB_BY_COL)) ; + CHECK (A->is_csc) ; + OK (GxB_Global_Option_set_(GxB_FORMAT, GxB_BY_ROW)) ; format = 99 ; OK (GxB_Global_Option_get_(GxB_FORMAT, &format)) ; CHECK (format == 0) ; + int32_t format2 = 999 ; + OK (GxB_Global_Option_get_INT32 (GxB_FORMAT, &format2)) ; + CHECK (format2 == 0) ; + + OK (GxB_Global_Option_set_INT32 (GxB_FORMAT, GxB_BY_COL)) ; + OK (GxB_Global_Option_get_INT32 (GxB_FORMAT, &format2)) ; + CHECK (format2 == 1) ; + + OK (GxB_Global_Option_set_INT32 (GxB_FORMAT, GxB_BY_ROW)) ; + OK (GxB_Global_Option_get_INT32 (GxB_FORMAT, &format2)) ; + CHECK (format2 == 0) ; OK (GxB_Global_Option_set_(GxB_HYPER_SWITCH, 77.33f)) ; OK (GxB_Global_Option_get_(GxB_HYPER_SWITCH, &hratio)) ; printf ("%g\n", hratio) ; CHECK (hratio == 77.33f) ; + hratio2 = 88 ; + OK (GxB_Global_Option_get_FP64 (GxB_HYPER_SWITCH, &hratio2)) ; + CHECK (hratio == hratio2) ; + + OK (GxB_Global_Option_set_FP64 (GxB_HYPER_SWITCH, 88.22f)) ; + OK (GxB_Global_Option_get_FP64 (GxB_HYPER_SWITCH, &hratio)) ; + CHECK (hratio == 88.22f) ; OK (GxB_Global_Option_set_(GxB_HYPER_SWITCH, GxB_HYPER_DEFAULT)) ; OK (GxB_Global_Option_get_(GxB_HYPER_SWITCH, &hratio)) ; CHECK (hratio == GxB_HYPER_DEFAULT) ; + OK (GxB_Global_Option_set_(GxB_HYPER_SWITCH, 12.34f)) ; + OK (GxB_Global_Option_set_FP64 (GxB_HYPER_SWITCH, GxB_HYPER_DEFAULT)) ; + OK (GxB_Global_Option_get_FP64 (GxB_HYPER_SWITCH, &hratio)) ; + CHECK (hratio == GxB_HYPER_DEFAULT) ; + + hratio2 = 22 ; + OK (GxB_Global_Option_get_FP64 (GxB_HYPER_SWITCH, &hratio2)) ; + CHECK (hratio == hratio2) ; + expected = GrB_NULL_POINTER ; GrB_Matrix O_NULL = NULL ; ERR1 (O_NULL, GxB_Matrix_Option_set_(O_NULL, GxB_FORMAT, GxB_BY_COL)) ; + ERR1 (O_NULL, GxB_Matrix_Option_set_INT32 (O_NULL, GxB_FORMAT, GxB_BY_COL)) ; expected = GrB_NULL_POINTER ; ERR (GxB_Global_Option_get_(GxB_FORMAT, NULL)) ; + ERR (GxB_Global_Option_get_INT32 (GxB_FORMAT, NULL)) ; expected = GrB_NULL_POINTER ; ERR (GxB_Matrix_Option_get_(A, GxB_FORMAT, NULL)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected (A format null):%s\n", err) ; + ERR (GxB_Matrix_Option_get_INT32 (A, GxB_FORMAT, NULL)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected (A format null):%s\n", err) ; + expected = GrB_NULL_POINTER ; ERR (GxB_Matrix_Option_get_(A, GxB_HYPER_SWITCH, NULL)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected:%s\n", err) ; + ERR (GxB_Matrix_Option_get_FP64 (A, GxB_HYPER_SWITCH, NULL)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected:%s\n", err) ; + ERR (GxB_Matrix_Option_get_(A, GxB_BITMAP_SWITCH, NULL)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected:%s\n", err) ; + ERR (GxB_Matrix_Option_get_FP64 (A, GxB_BITMAP_SWITCH, NULL)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected:%s\n", err) ; + expected = GrB_NULL_POINTER ; ERR (GxB_Global_Option_get_(GxB_HYPER_SWITCH, NULL)) ; ERR (GxB_Global_Option_get_(GxB_BITMAP_SWITCH, NULL)) ; + ERR (GxB_Global_Option_get_FP64 (GxB_HYPER_SWITCH, NULL)) ; + ERR (GxB_Global_Option_get_FP64 (GxB_BITMAP_SWITCH, NULL)) ; expected = GrB_INVALID_VALUE ; ERR (GxB_Global_Option_get_(-1, NULL)) ; + int32_t ignore2 = 999 ; + ERR (GxB_Global_Option_get_INT32 (-1, &ignore2)) ; + CHECK (ignore2 == 999) ; + + int64_t ignore3 = 999 ; + ERR (GxB_Global_Option_get_INT64 (-1, &ignore3)) ; + CHECK (ignore3 == 999) ; + + double ignore4 = 999 ; + ERR (GxB_Global_Option_get_FP64 (-1, &ignore4)) ; + CHECK (ignore4 == 999) ; + + void *ignore5 = NULL ; + ERR (GxB_Global_Option_get_FUNCTION (-1, &ignore5)) ; + CHECK (ignore5 == NULL) ; + + char *ignore6 = NULL ; + ERR (GxB_Global_Option_get_CHAR (-1, &ignore6)) ; + CHECK (ignore6 == NULL) ; + ERR (GxB_Matrix_Option_get_(A, 999, NULL)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected (bad field):%s\n", err) ; + int ii ; + ERR (GxB_Matrix_Option_get_INT32 (A, 999, &ii)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected (bad field):%s\n", err) ; + + double xx ; + ERR (GxB_Matrix_Option_get_FP64 (A, 999, &xx)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected (bad field):%s\n", err) ; + ERR1 (A, GxB_Matrix_Option_set_(A, 999, GxB_BY_ROW)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected:%s\n", err) ; + ERR1 (A, GxB_Matrix_Option_set_INT32 (A, 999, GxB_BY_ROW)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected:%s\n", err) ; + ERR (GxB_Global_Option_set_(999, GxB_BY_ROW)) ; + ERR (GxB_Global_Option_set_INT32 (999, GxB_BY_ROW)) ; expected = GrB_INVALID_VALUE ; ERR (GxB_Global_Option_set_(GxB_FORMAT, 9999)) ; + ERR (GxB_Global_Option_set_INT32 (GxB_FORMAT, 9999)) ; ERR1 (A, GxB_Matrix_Option_set_(A, 999, GxB_BY_ROW)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected:%s\n", err) ; + ERR1 (A, GxB_Matrix_Option_set_INT32 (A, 999, GxB_BY_ROW)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected:%s\n", err) ; + ERR1 (A, GxB_Matrix_Option_set_(A, GxB_FORMAT, 909090)) ; GrB_Matrix_error_(&err, A) ; printf ("error expected:%s\n", err) ; + ERR1 (A, GxB_Matrix_Option_set_INT32 (A, GxB_FORMAT, 909090)) ; + GrB_Matrix_error_(&err, A) ; + printf ("error expected:%s\n", err) ; + CHECK (A != NULL) ; CHECK (A->is_csc) ; @@ -5189,6 +5422,14 @@ void mexFunction OK (GxB_Global_Option_get_(GxB_NTHREADS, &nthreads)) ; CHECK (nthreads == 42) ; + OK (GxB_Global_Option_set_INT32 (GxB_NTHREADS, 44)) ; + OK (GxB_Global_Option_get_INT32 (GxB_NTHREADS, &nthreads)) ; + CHECK (nthreads == 44) ; + + int32_t nthreads2 = 11 ; + OK (GxB_Global_Option_get_(GxB_NTHREADS, &nthreads2)) ; + CHECK (nthreads == nthreads2) ; + OK (GxB_Desc_set (desc, GxB_NTHREADS, 43)) ; OK (GxB_Desc_get (desc, GxB_NTHREADS, &nthreads)) ; CHECK (nthreads == 43) ; @@ -5197,6 +5438,14 @@ void mexFunction OK (GxB_Desc_get (desc, GxB_DESCRIPTOR_NTHREADS, &nthreads)) ; CHECK (nthreads == 44) ; + OK (GxB_Desc_set_INT32 (desc, GxB_NTHREADS, 40)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_NTHREADS, &nthreads)) ; + CHECK (nthreads == 40) ; + + OK (GxB_Desc_set_INT32 (desc, GxB_DESCRIPTOR_NTHREADS, 41)) ; + OK (GxB_Desc_get_INT32 (desc, GxB_DESCRIPTOR_NTHREADS, &nthreads)) ; + CHECK (nthreads == 41) ; + //-------------------------------------------------------------------------- // import/export //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_select_idxunop.c b/GraphBLAS/Test/GB_mex_select_idxunop.c index 744cde3042..db162d70ed 100644 --- a/GraphBLAS/Test/GB_mex_select_idxunop.c +++ b/GraphBLAS/Test/GB_mex_select_idxunop.c @@ -271,6 +271,15 @@ void mexFunction FREE_ALL ; mexErrMsgTxt ("scalar failed") ; } + + int f2 = 99 ; + GxB_Matrix_Option_get_INT32 (S, GxB_FORMAT, &f2) ; + if (fmt != GxB_BY_COL) + { + FREE_ALL ; + mexErrMsgTxt ("scalar failed") ; + } + scalar = (GrB_Scalar) S ; GrB_Info info = GxB_Scalar_fprint (scalar, "scalar", GxB_SILENT, NULL) ; if (info != GrB_SUCCESS) diff --git a/GraphBLAS/Test/test01.m b/GraphBLAS/Test/test01.m index 819107ddfb..9a5f1254b7 100644 --- a/GraphBLAS/Test/test01.m +++ b/GraphBLAS/Test/test01.m @@ -13,6 +13,7 @@ GB_mex_about6 ; GB_mex_about7 ; GB_mex_about8 ; +GB_mex_about10 ; if (~ispc) GB_mex_about9 ; end diff --git a/GraphBLAS/alternative/Makefile b/GraphBLAS/alternative/Makefile index d1d5285fbd..6438e8fdfe 100644 --- a/GraphBLAS/alternative/Makefile +++ b/GraphBLAS/alternative/Makefile @@ -20,8 +20,8 @@ default: library # This version info must match ../CMakeLists.txt VER1 = 7 -VER2 = 3 -VER3 = 3 +VER2 = 4 +VER3 = 0 # pick your compiler: CC = gcc diff --git a/Mongoose/CMakeLists.txt b/Mongoose/CMakeLists.txt index 34e6e8430e..dedbf27778 100644 --- a/Mongoose/CMakeLists.txt +++ b/Mongoose/CMakeLists.txt @@ -46,11 +46,11 @@ include ( SuiteSparsePolicy ) #------------------------------------------------------------------------------- -set(Mongoose_DATE "Dec 9, 2022") +set(Mongoose_DATE "Dec 23, 2022") set(Mongoose_NUMERIC_DATE "2022-12-09") set(Mongoose_VERSION_MAJOR 3) set(Mongoose_VERSION_MINOR 0) -set(Mongoose_VERSION_PATCH 2) +set(Mongoose_VERSION_PATCH 3) project(Mongoose VERSION "${Mongoose_VERSION_MAJOR}.${Mongoose_VERSION_MINOR}.${Mongoose_VERSION_PATCH}" @@ -213,7 +213,7 @@ endif () #------------------------------------------------------------------------------- -# Build the Mongoose library and all tests with coverage flags +# Build the Mongoose debug/test library add_library(mongoose_lib_dbg ${MONGOOSE_LIB_FILES}) set_target_properties(mongoose_lib_dbg PROPERTIES OUTPUT_NAME mongoose_dbg) @@ -305,14 +305,28 @@ target_link_libraries(mongoose_unit_test_edgesep mongoose_lib_dbg) set_target_properties(mongoose_unit_test_edgesep PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH}) add_test(Unit_Test_EdgeSep ./tests/mongoose_unit_test_edgesep) +if ( $ENV{MONGOOSE_COVERAGE} ) + set ( COV on ) +else ( ) + set ( COV off ) +endif ( ) + +option ( MONGOOSE_COVERAGE "OFF: do not compile debug library with test coverage. ON: debug with test coverage" ${COV} ) +message ( STATUS "test coverage for debug library: ${MONGOOSE_COVERAGE}" ) + message(STATUS "CMAKE_CXX_COMPILER: " ${BoldBlue} ${CMAKE_CXX_COMPILER_ID} ${ColourReset}) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # using Clang SET(CMAKE_CXX_FLAGS "-O3 -fwrapv") # Debug flags for Clang - SET(CMAKE_CXX_FLAGS_DEBUG "--coverage -g -fwrapv") - SET(CMAKE_C_FLAGS_DEBUG "--coverage -g") - SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "--coverage -g") + SET(CMAKE_CXX_FLAGS_DEBUG "-g -fwrapv") + SET(CMAKE_C_FLAGS_DEBUG "-g") + SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g") + if ( MONGOOSE_COVERAGE ) + SET ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage" ) + SET ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} --coverage" ) + SET ( CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage" ) + endif ( ) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # using GCC SET(CMAKE_CXX_FLAGS "-O3 -fwrapv") @@ -322,9 +336,14 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") message(WARNING "${BoldRed} WARNING:${ColourReset} Your compiler does not support the C++11 ISO standard. Future versions of Mongoose will require a compiler with C++11 support. We recommend you upgrade to at least GCC 4.6.") endif () - SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -fwrapv -W -Wshadow -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") - SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -fwrapv -W -fprofile-arcs -ftest-coverage") - SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage") + SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -fwrapv -W -Wshadow -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings ") + SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -fwrapv -W ") + SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "") + if ( MONGOOSE_COVERAGE ) + SET ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage" ) + SET ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage" ) + SET ( CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage" ) + endif ( ) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # using Intel C++ SET(CMAKE_CXX_FLAGS "-O3 -no-prec-div -xHOST -ipo -fwrapv") diff --git a/Mongoose/Doc/ChangeLog b/Mongoose/Doc/ChangeLog index aa2e641173..e8f86651e5 100644 --- a/Mongoose/Doc/ChangeLog +++ b/Mongoose/Doc/ChangeLog @@ -1,3 +1,7 @@ +Dec 23, 2022: version 3.0.3 + + * minor change to the build system: test coverage + Dec 9, 2022: version 3.0.2 * minor change to the build system diff --git a/Mongoose/Doc/Mongoose_UserGuide.pdf b/Mongoose/Doc/Mongoose_UserGuide.pdf index 9e76bf0ae8..ce3d3a04eb 100644 Binary files a/Mongoose/Doc/Mongoose_UserGuide.pdf and b/Mongoose/Doc/Mongoose_UserGuide.pdf differ diff --git a/Mongoose/Doc/title-info.tex b/Mongoose/Doc/title-info.tex index 06aaaceb67..64753a91bb 100644 --- a/Mongoose/Doc/title-info.tex +++ b/Mongoose/Doc/title-info.tex @@ -1,3 +1,3 @@ -\title{Mongoose User Guide, Version 3.0.2} +\title{Mongoose User Guide, Version 3.0.3} \author{Scott Kolodziej, Nuri Yeralan, Tim Davis, William W. Hager} -\date{Dec 9, 2022} +\date{Dec 23, 2022} diff --git a/Mongoose/Include/Mongoose_Version.hpp b/Mongoose/Include/Mongoose_Version.hpp index 832001eacf..40f72ec527 100644 --- a/Mongoose/Include/Mongoose_Version.hpp +++ b/Mongoose/Include/Mongoose_Version.hpp @@ -17,8 +17,8 @@ // Configuration information from CMake #define Mongoose_VERSION_MAJOR 3 #define Mongoose_VERSION_MINOR 0 -#define Mongoose_VERSION_PATCH 2 -#define Mongoose_DATE "Dec 9, 2022" +#define Mongoose_VERSION_PATCH 3 +#define Mongoose_DATE "Dec 23, 2022" namespace Mongoose { diff --git a/Mongoose/codemeta.json b/Mongoose/codemeta.json index 2e55893b51..7b362ec1e7 100644 --- a/Mongoose/codemeta.json +++ b/Mongoose/codemeta.json @@ -7,8 +7,8 @@ "codeRepository": "https://github.com/ScottKolo/Mongoose", "issueTracker": "https://github.com/ScottKolo/Mongoose/issues", "license": "https://spdx.org/licenses/GPL-3.0-only.html", - "version": "3.0.2", - "softwareVersion": "3.0.2", + "version": "3.0.3", + "softwareVersion": "3.0.3", "author": [ { "@type": "Person", @@ -47,7 +47,7 @@ }, "contIntegration": "https://travis-ci.com/ScottKolo/Mongoose", "developmentStatus": "active", - "downloadUrl": "https://github.com/ScottKolo/Mongoose/archive/v3.0.2.zip", + "downloadUrl": "https://github.com/ScottKolo/Mongoose/archive/v3.0.3.zip", "funding":"Office of Naval Research grant N00014-11-1-0068", "funding":"Office of Naval Research grant N00014-15-1-2048", "funding":"Office of Naval Research grant N00014-18-1-2100", diff --git a/README.md b/README.md index 43cdce36c2..f2588b999f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ SuiteSparse: A Suite of Sparse matrix packages at http://suitesparse.com ----------------------------------------------------------------------------- -Nov 12, 2022. SuiteSparse VERSION 6.0.1 +Dec 23, 2022. SuiteSparse VERSION 6.0.3 SuiteSparse is a set of sparse-matrix-related packages written or co-authored by Tim Davis, available at https://github.com/DrTimothyAldenDavis/SuiteSparse . diff --git a/SuiteSparse_config/CMakeLists.txt b/SuiteSparse_config/CMakeLists.txt index 19d1089ed6..0632a190e6 100644 --- a/SuiteSparse_config/CMakeLists.txt +++ b/SuiteSparse_config/CMakeLists.txt @@ -14,10 +14,10 @@ cmake_minimum_required ( VERSION 3.22 ) # version of both SuiteSparse and SuiteSparse_config -set ( SUITESPARSE_DATE "Dec 9, 2022" ) +set ( SUITESPARSE_DATE "Dec 23, 2022" ) set ( SUITESPARSE_VERSION_MAJOR 6 ) set ( SUITESPARSE_VERSION_MINOR 0 ) -set ( SUITESPARSE_VERSION_SUB 2 ) +set ( SUITESPARSE_VERSION_SUB 3 ) message ( STATUS "Building SuiteSparse_config version: v" ${SUITESPARSE_VERSION_MAJOR}. diff --git a/SuiteSparse_config/SuiteSparse_config.h b/SuiteSparse_config/SuiteSparse_config.h index 640a9e5690..fdba3c29bf 100644 --- a/SuiteSparse_config/SuiteSparse_config.h +++ b/SuiteSparse_config/SuiteSparse_config.h @@ -485,10 +485,10 @@ int SuiteSparse_version // returns SUITESPARSE_VERSION #define SUITESPARSE_HAS_VERSION_FUNCTION -#define SUITESPARSE_DATE "Dec 9, 2022" +#define SUITESPARSE_DATE "Dec 23, 2022" #define SUITESPARSE_MAIN_VERSION 6 #define SUITESPARSE_SUB_VERSION 0 -#define SUITESPARSE_SUBSUB_VERSION 2 +#define SUITESPARSE_SUBSUB_VERSION 3 #define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub)) #define SUITESPARSE_VERSION \