diff --git a/ChangeLog b/ChangeLog index f68fa9fa62..ddd2ee7c19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Jan 1, 2024: version 7.5.0 + + * GraphBLAS 9.0.0: supporting the v2.1 C API; + see https://github.com/GraphBLAS/graphblas-api-c + Dec 30, 2023: version 7.4.0 * major change to build system: by Markus Mützel. Includes a diff --git a/Example/CMakeLists.txt b/Example/CMakeLists.txt index a3b6e70c27..ee300dd6ef 100644 --- a/Example/CMakeLists.txt +++ b/Example/CMakeLists.txt @@ -95,7 +95,7 @@ find_package ( CCOLAMD 3.3.0 REQUIRED ) find_package ( CHOLMOD 5.1.0 REQUIRED ) find_package ( COLAMD 3.3.0 REQUIRED ) find_package ( CXSparse 4.3.0 REQUIRED ) -find_package ( GraphBLAS 8.3.1 ) +find_package ( GraphBLAS 9.0.0 ) find_package ( KLU 2.3.0 REQUIRED ) find_package ( KLU_CHOLMOD 2.3.0 REQUIRED ) find_package ( LDL 3.3.0 REQUIRED ) diff --git a/GraphBLAS/CUDA/CMakeLists.txt b/GraphBLAS/CUDA/CMakeLists.txt index 198053a0c5..2b477a36bf 100644 --- a/GraphBLAS/CUDA/CMakeLists.txt +++ b/GraphBLAS/CUDA/CMakeLists.txt @@ -74,6 +74,10 @@ set_target_properties ( GraphBLAS_CUDA PROPERTIES CUDA_ARCHITECTURES "52;75;80" target_link_libraries ( GraphBLAS_CUDA PRIVATE CUDA::nvrtc CUDA::cudart_static CUDA::cuda_driver ) +if ( TARGET CUDA::nvToolsExt ) + target_link_libraries ( GraphBLAS_CUDA PRIVATE CUDA::nvToolsExt ) +endif ( ) + if ( TARGET CUDA::nvtx3 ) target_link_libraries ( GraphBLAS_CUDA PRIVATE CUDA::nvtx3 ) target_compile_definitions ( GraphBLAS_CUDA PRIVATE GBNVTX ) diff --git a/GraphBLAS/CUDA/Config/GB_cuda_common_jitFactory.hpp.in b/GraphBLAS/CUDA/Config/GB_cuda_common_jitFactory.hpp.in index a4576e7583..5d7ad01e6f 100644 --- a/GraphBLAS/CUDA/Config/GB_cuda_common_jitFactory.hpp.in +++ b/GraphBLAS/CUDA/Config/GB_cuda_common_jitFactory.hpp.in @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_cuda_common_jitFactory.hpp: common defines for all jitFactory classes +// GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp: for all jitFactory classes //------------------------------------------------------------------------------ -// (c) Nvidia Corp. 2020 All rights reserved +// (c) Nvidia Corp. 2023 All rights reserved // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -16,26 +16,24 @@ // configured by cmake from the following file: // GraphBLAS/CUDA/Config/GB_cuda_common_jitFactory.hpp.in -#ifndef GB_COMMON_JITFACTORY_H -#define GB_COMMON_JITFACTORY_H +#ifndef GB_CUDA_COMMON_JITFACTORY_HPP +#define GB_CUDA_COMMON_JITFACTORY_HPP #pragma once +#include "GraphBLAS_cuda.h" + extern "C" { #include "GB.h" - #include "GraphBLAS.h" - #undef I #include "GB_stringify.h" } #include #include -#include "GB_jit_cache.h" -#include "GB_jit_launcher.h" +#include "GB_cuda_jitify_cache.h" +#include "GB_cuda_jitify_launcher.h" #include "GB_cuda_mxm_factory.hpp" -#include "GB_cuda_buckets.h" -#include "GB_cuda_type_wrap.hpp" #include "GB_cuda_error.h" #include "../rmm_wrap/rmm_wrap.h" #include "GB_iceil.h" @@ -43,27 +41,38 @@ extern "C" // amount of shared memory to use in CUDA kernel launches constexpr unsigned int SMEM = 0 ; -static const std::vector GB_jit_cuda_compiler_flags{ +#if 0 + +static const std::vector GB_jit_cuda_compiler_flags{ // OLD "-std=c++17", //"-G", "-remove-unused-globals", "-w", "-D__CUDACC_RTC__", -// "-I.", -// "-I..", -// "-I../templates", -// "-I../CUDA", -// "-I../Source/Shared", - - // Add includes relative to GRAPHBLAS_SOURCE_PATH variable - "-I" + jit::get_user_graphblas_source_path() + "/CUDA", - "-I" + jit::get_user_graphblas_source_path() + "/Source/Shared", - "-I" + jit::get_user_graphblas_source_path() + "/CUDA/templates", +// "-I" + jit::get_user_home_cache_dir(), // FIXME: add +/cu/00 +// "-I" + jit::get_user_home_cache_dir() + "/src", "-I/usr/local/cuda/include", - // FIXME: add SUITESPARSE_CUDA_ARCHITECTURES here, via config }; +#endif + +inline std::vector GB_cuda_jit_compiler_flags ( ) +{ + return ( + std::vector ( + {"-std=c++17", + //"-G", + "-remove-unused-globals", + "-w", + "-D__CUDACC_RTC__", + "-I" + jit::get_user_home_cache_dir(), // FIXME: add +/cu/00 + "-I" + jit::get_user_home_cache_dir() + "/src", + "-I/usr/local/cuda/include" + // FIXME: add SUITESPARSE_CUDA_ARCHITECTURES here, via config + })) ; +} ; + // FIXME: rename GB_jit_cuda_header_names or something static const std::vector header_names ={}; diff --git a/GraphBLAS/CUDA/GB_cuda.h b/GraphBLAS/CUDA/GB_cuda.h index df57f0003c..3dac3a7c5e 100644 --- a/GraphBLAS/CUDA/GB_cuda.h +++ b/GraphBLAS/CUDA/GB_cuda.h @@ -1,14 +1,12 @@ //------------------------------------------------------------------------------ -// GB_cuda.h: definitions for using CUDA in GraphBLAS +// GraphBLAS/CUDA/GB_cuda.h //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS/CUDA, (c) NVIDIA Corp. 2017-2019, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ -// This file is #include'd only in the GraphBLAS/CUDA/GB_cuda*.cu source files. - #ifndef GB_CUDA_H #define GB_CUDA_H @@ -20,9 +18,7 @@ extern "C" #include "GB_warnings.h" } -#define GB_LIBRARY -#include "GraphBLAS.h" -#undef I +#include "GraphBLAS_cuda.h" extern "C" { diff --git a/GraphBLAS/CUDA/GB_AxB_dot3_cuda_branch.cpp b/GraphBLAS/CUDA/GB_cuda_AxB_dot3_branch.cpp similarity index 91% rename from GraphBLAS/CUDA/GB_AxB_dot3_cuda_branch.cpp rename to GraphBLAS/CUDA/GB_cuda_AxB_dot3_branch.cpp index bdbbddd6b1..c69dc2132f 100644 --- a/GraphBLAS/CUDA/GB_AxB_dot3_cuda_branch.cpp +++ b/GraphBLAS/CUDA/GB_cuda_AxB_dot3_branch.cpp @@ -1,16 +1,16 @@ //------------------------------------------------------------------------------ -// GB_AxB_dot3_cuda_branch: decide if GPU should be used for dot3 mxm +// GraphBLAS/CUDA/GB_cuda_AxB_dot3_branch: decide to use GPU for dot3 //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ // Decide branch direction for GPU use for the dot-product MxM -#include "GraphBLAS.h" -#undef I +#include "GraphBLAS_cuda.h" + extern "C" { #include "GB_mxm.h" @@ -18,7 +18,7 @@ extern "C" #include "GB_cuda.h" #include -bool GB_AxB_dot3_cuda_branch +bool GB_cuda_AxB_dot3_branch ( const GrB_Matrix M, // mask matrix const bool Mask_struct, // if true, use the only structure of M diff --git a/GraphBLAS/CUDA/GB_AxB_dot3_cuda.cpp b/GraphBLAS/CUDA/GB_cuda_AxB_dot3_jit.cpp similarity index 97% rename from GraphBLAS/CUDA/GB_AxB_dot3_cuda.cpp rename to GraphBLAS/CUDA/GB_cuda_AxB_dot3_jit.cpp index 7d30afb0a3..5933403dd9 100644 --- a/GraphBLAS/CUDA/GB_AxB_dot3_cuda.cpp +++ b/GraphBLAS/CUDA/GB_cuda_AxB_dot3_jit.cpp @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_AxB_dot3_cuda: compute C = A'*B in parallel, on the GPU(s) +// GraphBLAS/CUDA/GB_cuda_AxB_dot3_jit: compute C = A'*B on GPU(s) //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -18,11 +18,10 @@ extern "C" #include "GB_mxm.h" } -#include "GB_jit_cache.h" +#include "GB_cuda_jitify_cache.h" #include "GB_cuda_common_jitFactory.hpp" #include "GB_cuda_reduce_jitFactory.hpp" #include "GB_cuda_mxm_dot3_jitFactory.hpp" -#include "GB_cuda_type_wrap.hpp" #include "test/GpuTimer.h" /* @@ -60,7 +59,7 @@ void print_array(void *arr, I size, const char *name) { // GB_AxB_dot3_cuda //------------------------------------------------------------------------------ -GrB_Info GB_AxB_dot3_cuda // C = A'*B using dot product method +GrB_Info GB_cuda_AxB_dot3_jit // C = A'*B using dot product method ( GrB_Matrix C, // output matrix const GrB_Matrix M, // mask matrix @@ -291,7 +290,7 @@ GrB_Info GB_AxB_dot3_cuda // C = A'*B using dot product method dense_phase1launchFactory dp1lf(my_mxm_spec); - GBURBLE ("(GPU phase1 start nblk = %d) ", + GBURBLE ("(GPU dense phase1 start nblk = %d) ", dp1lf.get_number_of_blocks(M)) ; kernel_timer.Start(); dp1lf.jitGridBlockLaunch(C, M, A, B, stream); @@ -381,7 +380,8 @@ GrB_Info GB_AxB_dot3_cuda // C = A'*B using dot product method // phase1: assign each C(i,j) to a bucket, and count them //---------------------------------------------------------------------- - GBURBLE ("(GPU phase1 start nblk = %d) ", p1lf.get_number_of_blocks(M)); + GBURBLE ("(GPU sparse phase1 start nblk = %d) ", + p1lf.get_number_of_blocks(M)); kernel_timer.Start(); p1lf.jitGridBlockLaunch(Nanobuckets, Blockbucket, C, M, A, B, stream); CU_OK (cudaStreamSynchronize(stream)); diff --git a/GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp b/GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp index a4576e7583..5d7ad01e6f 100644 --- a/GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp +++ b/GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_cuda_common_jitFactory.hpp: common defines for all jitFactory classes +// GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp: for all jitFactory classes //------------------------------------------------------------------------------ -// (c) Nvidia Corp. 2020 All rights reserved +// (c) Nvidia Corp. 2023 All rights reserved // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -16,26 +16,24 @@ // configured by cmake from the following file: // GraphBLAS/CUDA/Config/GB_cuda_common_jitFactory.hpp.in -#ifndef GB_COMMON_JITFACTORY_H -#define GB_COMMON_JITFACTORY_H +#ifndef GB_CUDA_COMMON_JITFACTORY_HPP +#define GB_CUDA_COMMON_JITFACTORY_HPP #pragma once +#include "GraphBLAS_cuda.h" + extern "C" { #include "GB.h" - #include "GraphBLAS.h" - #undef I #include "GB_stringify.h" } #include #include -#include "GB_jit_cache.h" -#include "GB_jit_launcher.h" +#include "GB_cuda_jitify_cache.h" +#include "GB_cuda_jitify_launcher.h" #include "GB_cuda_mxm_factory.hpp" -#include "GB_cuda_buckets.h" -#include "GB_cuda_type_wrap.hpp" #include "GB_cuda_error.h" #include "../rmm_wrap/rmm_wrap.h" #include "GB_iceil.h" @@ -43,27 +41,38 @@ extern "C" // amount of shared memory to use in CUDA kernel launches constexpr unsigned int SMEM = 0 ; -static const std::vector GB_jit_cuda_compiler_flags{ +#if 0 + +static const std::vector GB_jit_cuda_compiler_flags{ // OLD "-std=c++17", //"-G", "-remove-unused-globals", "-w", "-D__CUDACC_RTC__", -// "-I.", -// "-I..", -// "-I../templates", -// "-I../CUDA", -// "-I../Source/Shared", - - // Add includes relative to GRAPHBLAS_SOURCE_PATH variable - "-I" + jit::get_user_graphblas_source_path() + "/CUDA", - "-I" + jit::get_user_graphblas_source_path() + "/Source/Shared", - "-I" + jit::get_user_graphblas_source_path() + "/CUDA/templates", +// "-I" + jit::get_user_home_cache_dir(), // FIXME: add +/cu/00 +// "-I" + jit::get_user_home_cache_dir() + "/src", "-I/usr/local/cuda/include", - // FIXME: add SUITESPARSE_CUDA_ARCHITECTURES here, via config }; +#endif + +inline std::vector GB_cuda_jit_compiler_flags ( ) +{ + return ( + std::vector ( + {"-std=c++17", + //"-G", + "-remove-unused-globals", + "-w", + "-D__CUDACC_RTC__", + "-I" + jit::get_user_home_cache_dir(), // FIXME: add +/cu/00 + "-I" + jit::get_user_home_cache_dir() + "/src", + "-I/usr/local/cuda/include" + // FIXME: add SUITESPARSE_CUDA_ARCHITECTURES here, via config + })) ; +} ; + // FIXME: rename GB_jit_cuda_header_names or something static const std::vector header_names ={}; diff --git a/GraphBLAS/CUDA/GB_cuda_cumsum.cu b/GraphBLAS/CUDA/GB_cuda_cumsum.cu index c784180c31..da6b32f504 100644 --- a/GraphBLAS/CUDA/GB_cuda_cumsum.cu +++ b/GraphBLAS/CUDA/GB_cuda_cumsum.cu @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_cuda_cumsum: cumlative sum of an array using GPU acceleration +// GraphBLAS/CUDA/GB_cuda_cumsum: cumlative sum of an array on the GPU(s) //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GB_cuda_error.h b/GraphBLAS/CUDA/GB_cuda_error.h index 719c519cde..d9aec9b3ff 100644 --- a/GraphBLAS/CUDA/GB_cuda_error.h +++ b/GraphBLAS/CUDA/GB_cuda_error.h @@ -1,5 +1,13 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GB_cuda_error.h +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + /* - * Copyright (c) 2022 NVIDIA CORPORATION. + * Copyright (c) 2023 NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,4 +79,4 @@ inline void __printLastCudaError(const char *errorMessage, const char *file, } #define CHECK_CUDA(call) checkCudaErrors( call ) -#endif \ No newline at end of file +#endif diff --git a/GraphBLAS/CUDA/GB_cuda_get_device_count.cu b/GraphBLAS/CUDA/GB_cuda_get_device_count.cu index cf7ed54962..7cad833fa1 100644 --- a/GraphBLAS/CUDA/GB_cuda_get_device_count.cu +++ b/GraphBLAS/CUDA/GB_cuda_get_device_count.cu @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ -// GB_cuda_get_device_count.cu: find out how many GPUs exist +// GraphBLAS/CUDA/GB_cuda_get_device_count.cu: find out how many GPUs exist //------------------------------------------------------------------------------ +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2019, All Rights Reserved. -// http://suitesparse.com See GraphBLAS/Doc/License.txt for license. //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GB_cuda_get_device_properties.cu b/GraphBLAS/CUDA/GB_cuda_get_device_properties.cu index a1fe58a468..7bb7e1407f 100644 --- a/GraphBLAS/CUDA/GB_cuda_get_device_properties.cu +++ b/GraphBLAS/CUDA/GB_cuda_get_device_properties.cu @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ -// GB_cuda_get_device_properties.cu: get the properties of a GPU +// GraphBLAS/CUDA/GB_cuda_get_device_properties: get the properties of a GPU //------------------------------------------------------------------------------ +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2019, All Rights Reserved. -// http://suitesparse.com See GraphBLAS/Doc/License.txt for license. //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GB_jit_cache.cu b/GraphBLAS/CUDA/GB_cuda_jitify_cache.cu similarity index 66% rename from GraphBLAS/CUDA/GB_jit_cache.cu rename to GraphBLAS/CUDA/GB_cuda_jitify_cache.cu index 426c202873..3e66d735b5 100644 --- a/GraphBLAS/CUDA/GB_jit_cache.cu +++ b/GraphBLAS/CUDA/GB_cuda_jitify_cache.cu @@ -1,5 +1,13 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GB_cuda_jitify_cache.cu +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + /* - * Copyright (c) 2019,2020 NVIDIA CORPORATION. + * Copyright (c) 2019,2023 NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +22,8 @@ * limitations under the License. */ +//------------------------------------------------------------------------------ + #include #include #include @@ -23,94 +33,35 @@ #include #include -#include "GB_jit_cache.h" -#include "GraphBLAS.h" -#undef I -// from GraphBLAS.h (for example): -// #define GxB_IMPLEMENTATION_MAJOR 6 -// #define GxB_IMPLEMENTATION_MINOR 0 -// #define GxB_IMPLEMENTATION_SUB 3 +#include "GB_cuda_jitify_cache.h" +#include "GraphBLAS_cuda.h" + +extern "C" +{ + #include "GB.h" + #include "GB_jitifyer.h" +} namespace jit { // Get the directory in home to use for storing the cache std::string get_user_home_cache_dir() { - auto home_dir = std::getenv("HOME"); - if (home_dir != nullptr) { - std::string Major_ver = GB_XSTR (GxB_IMPLEMENTATION_MAJOR) ; - std::string Minor_ver = GB_XSTR (GxB_IMPLEMENTATION_MINOR) ; - std::string Imple_sub = GB_XSTR (GxB_IMPLEMENTATION_SUB) ; - return std::string(home_dir) + "/.SuiteSparse/GrB" - + Major_ver+"."+Minor_ver+"."+Imple_sub; - } else { - return std::string(); + const char *path = GB_jitifyer_get_cache_path ( ) ; + if (path == NULL) + { + return std::string ("") ; + } + else + { + return std::string (path) ; } } -// Get the directory in home to use for storing the cache - std::string get_user_graphblas_source_path() { - auto gb_home = std::getenv("GRAPHBLAS_SOURCE_PATH"); - if (gb_home != nullptr) return std::string(gb_home); - else return std::string(); - } - - -// Default `GRAPHBLAS_CACHE_PATH` to `$HOME/.GraphBLAS`. -// This definition can be overridden at compile time by specifying a -// `-DGRAPHBLAS_CACHE_PATH=/kernel/cache/path` CMake argument. -// This path is used in the `getCacheDir()` function below. -#if !defined(GRAPHBLAS_CACHE_PATH) -#define GRAPHBLAS_CACHE_PATH get_user_home_cache_dir() -#endif - -/** - * @brief Get the string path to the JITIFY kernel cache directory. - * - * This path can be overridden at runtime by defining an environment variable - * named `GRAPHBLAS_CACHE_PATH`. The value of this variable must be a path - * under which the process' user has read/write priveleges. - * - * This function returns a path to the cache directory, creating it if it - * doesn't exist. - * - * The default cache directory is `$HOME/.GraphBLAS`. If no overrides - * are used and if $HOME is not defined, returns an empty path and file - * caching is not used. - **/ -std::string getCacheDir() { - // The environment variable always overrides the - // default/compile-time value of `GRAPHBLAS_CACHE_PATH` - // FIXME: use GB_jitifyer_get_cache_path ( ) here. - //std::cout<<"Cache-dir runtime=>"<< get_user_home_cache_dir() << std::endl; - auto kernel_cache_path_env = std::getenv("GRAPHBLAS_CACHE_PATH"); - //auto kernel_cache_path_env = get_user_home_cache_dir(); - auto kernel_cache_path = (kernel_cache_path_env != nullptr ? kernel_cache_path_env - : GRAPHBLAS_CACHE_PATH); - - struct stat st; - //if ( (stat( kernel_cache_path.c_str(), &st) != 0) ) { - if ( (stat( kernel_cache_path.c_str(), &st) != 0) ) { - // `mkdir -p` the kernel cache path if it doesn't exist -// printf("cache is going to path %s\n", kernel_cache_path.c_str()); - int status; - //status = std::filesystem::create_directories(kernel_cache_path.c_str()); - status = std::filesystem::create_directories(kernel_cache_path); -// if (status != 0 ) return std::string(); - //boost::filesystem::create_directories(kernel_cache_path); - } - return std::string(kernel_cache_path); -} - GBJitCache::GBJitCache() { } GBJitCache::~GBJitCache() { } -//void GBJitCache::macrofy() { -// printf("GOT HERE and shouldn't have!\n"); -//} - - std::mutex GBJitCache::_kernel_cache_mutex; std::mutex GBJitCache::_program_cache_mutex; diff --git a/GraphBLAS/CUDA/GB_jit_cache.h b/GraphBLAS/CUDA/GB_cuda_jitify_cache.h similarity index 96% rename from GraphBLAS/CUDA/GB_jit_cache.h rename to GraphBLAS/CUDA/GB_cuda_jitify_cache.h index 8f7f762262..36124da469 100644 --- a/GraphBLAS/CUDA/GB_jit_cache.h +++ b/GraphBLAS/CUDA/GB_cuda_jitify_cache.h @@ -1,3 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GB_cuda_jitify_cache.h +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + /* * Copyright (c) 2019,2020 NVIDIA CORPORATION. * @@ -31,8 +39,6 @@ namespace jit { std::string get_user_home_cache_dir(); -std::string get_user_graphblas_source_path(); -std::string getCacheDir(void); template using named_prog = std::pair>; @@ -217,7 +223,7 @@ class GBJitCache else { // Find file cached T object bool successful_read = false; std::string serialized; - std::string cache_dir = getCacheDir(); + std::string cache_dir = get_user_home_cache_dir(); std::string file_name = cache_dir + "/" + name; if (not cache_dir.empty() ) { // TODO: Use OS-agnostic path separator here @@ -277,7 +283,7 @@ class GBJitCache bool successful_read = false; std::string serialized; #if defined(JITIFY_USE_CACHE) - std::string cache_dir = getCacheDir(); + std::string cache_dir = get_user_home_cache_dir() ; if (not cache_dir.empty() ) { // TODO: Use OS-agnostic path separator std::string file_name = cache_dir + "/" + name; diff --git a/GraphBLAS/CUDA/GB_jit_launcher.cu b/GraphBLAS/CUDA/GB_cuda_jitify_launcher.cu similarity index 81% rename from GraphBLAS/CUDA/GB_jit_launcher.cu rename to GraphBLAS/CUDA/GB_cuda_jitify_launcher.cu index 8875a3a1a0..207ce5120b 100644 --- a/GraphBLAS/CUDA/GB_jit_launcher.cu +++ b/GraphBLAS/CUDA/GB_cuda_jitify_launcher.cu @@ -1,3 +1,10 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GB_cuda_jitify_launcher.cu +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ /* * Copyright (c) 2019,2020 NVIDIA CORPORATION. @@ -18,7 +25,7 @@ * limitations under the License. */ -#include +#include "GB_cuda_jitify_launcher.h" #include namespace jit { diff --git a/GraphBLAS/CUDA/GB_jit_launcher.h b/GraphBLAS/CUDA/GB_cuda_jitify_launcher.h similarity index 87% rename from GraphBLAS/CUDA/GB_jit_launcher.h rename to GraphBLAS/CUDA/GB_cuda_jitify_launcher.h index 1ef0736264..088a2bd77a 100644 --- a/GraphBLAS/CUDA/GB_jit_launcher.h +++ b/GraphBLAS/CUDA/GB_cuda_jitify_launcher.h @@ -1,5 +1,13 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GB_cuda_jitify_launcher.h +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + /* - * Copyright (c) 2019,2020 NVIDIA CORPORATION. + * Copyright (c) 2019,2023 NVIDIA CORPORATION. * * Copyright 2018-2019 BlazingDB, Inc. * Copyright 2018 Christian Noboa Mardini @@ -17,10 +25,15 @@ * limitations under the License. */ -#ifndef GB_JIT_LAUNCHER_H -#define GB_JIT_LAUNCHER_H +//------------------------------------------------------------------------------ + +// FIXME: rename .hpp? + +#ifndef GB_CUDA_JITIFY_LAUNCHER_H +#define GB_CUDA_JITIFY_LAUNCHER_H + +#include "GB_cuda_jitify_cache.h" -#include #include #include #include @@ -43,26 +56,6 @@ namespace jit { -#if 0 -const std::vector GB_jit_cuda_compiler_flags{ - "-std=c++17", - "--use_fast_math", - "-remove-unused-globals", - "-w", - "-lcudart", - "-D__CUDACC_RTC__", - "-I.", - "-I..", - "-I../../Include", - "-I../../Source", - "-I../../Source/Template", -// "-Ilocal_cub/block", - "-Itemplates", - "-I/usr/local/cuda/include" // FIXME: remove this? -}; -#endif - - /** * @brief Class used to handle compilation and execution of JIT kernels * diff --git a/GraphBLAS/CUDA/GB_cuda_matrix_prefetch.cpp b/GraphBLAS/CUDA/GB_cuda_matrix_prefetch.cpp index 2b6bfadd6b..c71dc0cd6c 100644 --- a/GraphBLAS/CUDA/GB_cuda_matrix_prefetch.cpp +++ b/GraphBLAS/CUDA/GB_cuda_matrix_prefetch.cpp @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ -// GB_cuda_matrix_prefetch: prefetch a matrix to a GPU or the CPU +// GraphBLAS/CUDA/GB_cuda_matrix_prefetch: prefetch a matrix to a GPU or the CPU //------------------------------------------------------------------------------ +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2019, All Rights Reserved. -// http://suitesparse.com See GraphBLAS/Doc/License.txt for license. //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GB_cuda_mxm_dot3_jitFactory.hpp b/GraphBLAS/CUDA/GB_cuda_mxm_dot3_jitFactory.hpp index e517f2439b..3fce511b40 100644 --- a/GraphBLAS/CUDA/GB_cuda_mxm_dot3_jitFactory.hpp +++ b/GraphBLAS/CUDA/GB_cuda_mxm_dot3_jitFactory.hpp @@ -1,8 +1,11 @@ //------------------------------------------------------------------------------ -// GB_cuda_mxm_dot3_factory +// GraphBLAS/CUDA/GB_cuda_mxm_dot3_jitFactory.hpp //------------------------------------------------------------------------------ // SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + /* * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. * @@ -31,21 +34,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -//------------------------------------------------------------------------------ - #ifndef GB_MXM_DOT3_JITFACTORY_H #define GB_MXM_DOT3_JITFACTORY_H #pragma once /** - * This file is responsible for picking all the parameters and what kernel variaiton we will use for a given instance + * This file is responsible for picking all the parameters and what kernel + * variaiton we will use for a given instance * - data types * - semiring types * - binary ops * - monoids * - * Kernel factory says "Here's the actual instance I want you to build with the given parameters" + * Kernel factory says "Here's the actual instance I want you to build with the + * given parameters" */ @@ -69,7 +72,7 @@ class dense_phase1launchFactory { // FIXME: this is the full name. Why? See below for partial name. // Need to be consistent in naming schemes. - std::string kernel_name = "GB_jit_AxB_dot3_dense_phase1"; + std::string kernel_name = "GB_cuda_jit_AxB_dot3_dense_phase1"; GB_cuda_mxm_factory &mxm_factory_; @@ -114,21 +117,21 @@ class dense_phase1launchFactory std::stringstream string_to_be_jitted ; - // FIXME: why does "templates/" appear here but not elsewhere? string_to_be_jitted << kernel_name << std::endl << R"(#include "GB_cuda_kernel.h")" << std::endl << - R"(#include ")" << jit::get_user_home_cache_dir() << "/" << mxm_factory_.filename << R"(")" << std::endl << - R"(#include "templates/)" << kernel_name << R"(.cuh")" << std::endl; + R"(#include ")" << mxm_factory_.filename << R"(")" << std::endl << + R"(#include ")" << kernel_name << R"(.cuh")" << std::endl; bool result = false; dim3 grid(get_number_of_blocks(M)); dim3 block(get_threads_per_block()); + std::cout << "HERE I AM 7" << std::endl ; jit::launcher( kernel_name + "_" + sr_code_str + ".jtfy", string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback /* FIXME: make NULL */) .set_kernel_inst( kernel_name, template_types) .configure(grid, block, SMEM, stream) @@ -151,7 +154,7 @@ class dense_phase1launchFactory template class phase1launchFactory { - std::string kernel_name = "GB_jit_AxB_dot3_phase1"; + std::string kernel_name = "GB_cuda_jit_AxB_dot3_phase1"; GB_cuda_mxm_factory &mxm_factory_; @@ -197,25 +200,39 @@ class phase1launchFactory std::stringstream string_to_be_jitted ; - // FIXME: why does "templates/" appear here but not elsewhere? string_to_be_jitted << kernel_name << std::endl << R"(#include "GB_cuda_kernel.h")" << std::endl << - R"(#include ")" << jit::get_user_home_cache_dir() << "/" << mxm_factory_.filename << R"(")" << std::endl << - R"(#include "templates/)" << kernel_name << R"(.cuh")" << std::endl; + R"(#include ")" << mxm_factory_.filename << R"(")" << std::endl << + R"(#include ")" << kernel_name << R"(.cuh")" << std::endl; + + std::cout << "header names:" << std::endl ; +// std::cout << header_names << std::endl ; + for (std::string s : header_names) + { + std::cout << " " << s << std::endl ; + } +// std::cout << "string_to_be_jitted :" << std::endl ; +// std::cout << string_to_be_jitted << std::endl ; + std::cout << "GB_cuda_jit_compiler_flags ( ):" << std::endl ; + for (std::string s : GB_cuda_jit_compiler_flags ( )) + { + std::cout << " " << s << std::endl ; + } + std::cout << "kernel_name + sr_code_str .jtfy:" << std::endl ; + std::cout << kernel_name + "_" + sr_code_str + ".jtfy" << std::endl ; + std::cout << "jit::get_user_home_cache_dir ( ):" << std::endl ; + std::cout << jit::get_user_home_cache_dir ( ) << std::endl ; bool result = false; - - // std::cout<< "GB_jit_cuda_compiler_flags "; - // for ( std::string s : GB_jit_cuda_compiler_flags) - // std::cout<< s<< std::endl; dim3 grid(get_number_of_blocks(M)); dim3 block(get_threads_per_block()); + std::cout << "HERE I AM 1" << std::endl ; jit::launcher( kernel_name + "_" + sr_code_str + ".jtfy", string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) .set_kernel_inst( kernel_name, template_types) .configure(grid, block, SMEM, stream) @@ -235,7 +252,7 @@ template class phase2launchFactory { - std::string base_name = "GB_jit"; + std::string base_name = "GB_cuda_jit"; // FIXME: this is the partial name. Why? See above. std::string kernel_name = "AxB_phase2"; @@ -274,10 +291,11 @@ class phase2launchFactory R"(#include ")" << hashable_name << R"(.cuh")" << std::endl; const int64_t mnz = GB_nnz (M) ; + std::cout << "HERE I AM 2" << std::endl ; jit::launcher( hashable_name, string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) .set_kernel_inst( kernel_name, {}) .configure(grid, block, SMEM, stream) @@ -299,7 +317,7 @@ template< int threads_per_block = 32, int chunk_size = 128> class phase2endlaunchFactory { - std::string base_name = "GB_jit"; + std::string base_name = "GB_cuda_jit"; std::string kernel_name = "AxB_phase2end"; public: @@ -332,10 +350,11 @@ class phase2endlaunchFactory string_to_be_jitted << hashable_name << std::endl << R"(#include ")" << hashable_name << R"(.cuh")" << std::endl; + std::cout << "HERE I AM 3" << std::endl ; jit::launcher( hashable_name, string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) .set_kernel_inst( kernel_name , {}) .configure(grid, block, SMEM, stream) @@ -355,7 +374,7 @@ class phase2endlaunchFactory class mxm_dense_launchFactory { - std::string base_name = "GB_jit"; + std::string base_name = "GB_cuda_jit"; std::string kernel_name = "AxB_dot3_phase3_dndn"; GB_cuda_mxm_factory &mxm_factory_; @@ -409,17 +428,18 @@ class mxm_dense_launchFactory string_to_be_jitted << hashable_name << std::endl << R"(#include "GB_cuda_kernel.h")" << std::endl << - R"(#include ")" << jit::get_user_home_cache_dir() << "/" << mxm_factory_.filename << R"(")" << std::endl << + R"(#include ")" << mxm_factory_.filename << R"(")" << std::endl << R"(#include ")" << hashable_name << R"(.cuh")" << std::endl; dim3 grid(gridsz); dim3 block(blocksz); GBURBLE ("(GPU dot3 mxm dense launch nblocks,blocksize= %d,%d )\n", gridsz,blocksz) ; + std::cout << "HERE I AM 4" << std::endl ; jit::launcher( hashable_name + "_" + sr_code, string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) .set_kernel_inst(final_kernel_name_ss.str(), template_types ) // { C->type->name, @@ -466,7 +486,7 @@ class mxm_dense_launchFactory class mxm_sparse_dense_launchFactory { - std::string base_name = "GB_jit"; + std::string base_name = "GB_cuda_jit"; std::string kernel_name = "AxB_dot3"; GB_cuda_mxm_factory &mxm_factory_; @@ -520,17 +540,18 @@ class mxm_sparse_dense_launchFactory string_to_be_jitted << hashable_name << std::endl << R"(#include "GB_cuda_kernel.h")" << std::endl << - R"(#include ")" << jit::get_user_home_cache_dir() << "/" << mxm_factory_.filename << R"(")" << std::endl << + R"(#include ")" << mxm_factory_.filename << R"(")" << std::endl << R"(#include ")" << hashable_name << R"(.cuh")" << std::endl; dim3 grid(gridsz); dim3 block(blocksz); GBURBLE ("(GPU dot3 mxm sparse_dense launch nblocks,blocksize= %d,%d )\n", gridsz,blocksz) ; + std::cout << "HERE I AM 5" << std::endl ; jit::launcher( hashable_name + "_" + sr_code, string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) .set_kernel_inst(final_kernel_name_ss.str(), template_types ) // { C->type->name, @@ -577,7 +598,7 @@ class mxm_sparse_dense_launchFactory class phase3launchFactory { - std::string base_name = "GB_jit"; + std::string base_name = "GB_cuda_jit"; std::string kernel_name = "AxB_dot3"; GB_cuda_mxm_factory &mxm_factory_; @@ -638,7 +659,7 @@ class phase3launchFactory // FIXME: why is "hashable_name" used sometimes, and sometimes "kernel_name"? string_to_be_jitted << hashable_name << std::endl << R"(#include "GB_cuda_kernel.h")" << std::endl << - R"(#include ")" << jit::get_user_home_cache_dir() << "/" << mxm_factory_.filename << R"(")" << std::endl << + R"(#include ")" << mxm_factory_.filename << R"(")" << std::endl << R"(#include ")" << hashable_name << R"(.cuh")" << std::endl; dim3 grid(gridsz); @@ -646,10 +667,11 @@ class phase3launchFactory GBURBLE ("(GPU phase3 launch %s st,end=%ld,%ld nblocks,blocksize= %d,%d )\n", this->Opname.c_str(), start,end,gridsz,blocksz) ; + std::cout << "HERE I AM 6" << std::endl ; jit::launcher( hashable_name + "_" + sr_code, string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) .set_kernel_inst(final_kernel_name_ss.str(), template_types ) // { C->type->name, diff --git a/GraphBLAS/CUDA/GB_cuda_mxm_factory.hpp b/GraphBLAS/CUDA/GB_cuda_mxm_factory.hpp index b4916b1f59..227b776f65 100644 --- a/GraphBLAS/CUDA/GB_cuda_mxm_factory.hpp +++ b/GraphBLAS/CUDA/GB_cuda_mxm_factory.hpp @@ -1,20 +1,22 @@ //------------------------------------------------------------------------------ -// GB_cuda_mxm_factory: construct code and header file for GrB_mxm jit kernel +// GraphBLAS/CUDA/GB_cuda_mxm_factory.hpp +//------------------------------------------------------------------------------ + +// (c) Nvidia Corp. 2023 All rights reserved +// SPDX-License-Identifier: Apache-2.0 + //------------------------------------------------------------------------------ // Class to manage both stringify functions from mxm, ops and monoids to a // header file. -// (c) Nvidia Corp. 2020 All rights reserved -// SPDX-License-Identifier: Apache-2.0 - // Implementations of string callbacks #pragma once // FIXME do we need the iostrean any more? #include #include -#include "GB_jit_cache.h" +#include "GB_cuda_jitify_cache.h" extern "C" { diff --git a/GraphBLAS/CUDA/GB_cuda_reduce_factory.hpp b/GraphBLAS/CUDA/GB_cuda_reduce_factory.hpp index 4cef44adf8..e0f7aae75b 100644 --- a/GraphBLAS/CUDA/GB_cuda_reduce_factory.hpp +++ b/GraphBLAS/CUDA/GB_cuda_reduce_factory.hpp @@ -1,5 +1,10 @@ //------------------------------------------------------------------------------ -// GraphBLAS/CUDA/GB_cuda_reduce_factory +// GraphBLAS/CUDA/GB_cuda_reduce_factory.hpp +//------------------------------------------------------------------------------ + +// (c) Nvidia Corp. 2023 All rights reserved +// SPDX-License-Identifier: Apache-2.0 + //------------------------------------------------------------------------------ // Class to manage both stringify functions from mxm, ops and monoids to a @@ -9,18 +14,13 @@ // Also provides a iostream callback to deliver the buffer to jitify as // if read from a file -// (c) Nvidia Corp. 2020 All rights reserved -// SPDX-License-Identifier: Apache-2.0 - -//------------------------------------------------------------------------------ - // Implementations of string callbacks #pragma once // FIXME: do we use iostream? #include #include -#include "GB_jit_cache.h" +#include "GB_cuda_jitify_cache.h" extern "C" { diff --git a/GraphBLAS/CUDA/GB_cuda_reduce_jitFactory.hpp b/GraphBLAS/CUDA/GB_cuda_reduce_jitFactory.hpp index 4e1008a920..fd618bddf0 100644 --- a/GraphBLAS/CUDA/GB_cuda_reduce_jitFactory.hpp +++ b/GraphBLAS/CUDA/GB_cuda_reduce_jitFactory.hpp @@ -3,8 +3,9 @@ //------------------------------------------------------------------------------ // SPDX-License-Identifier: Apache-2.0 + /* - * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -68,7 +69,7 @@ class reduceFactory // class properties //-------------------------------------------------------------------------- - std::string base_name = "GB_jit"; + std::string base_name = "GB_cuda_jit"; std::string kernel_name = "reduce"; int threads_per_block = 320 ; @@ -144,11 +145,9 @@ class reduceFactory std::string hashable_name = base_name + "_" + kernel_name; std::stringstream string_to_be_jitted ; - string_to_be_jitted << - hashable_name << std::endl << + string_to_be_jitted << hashable_name << std::endl << R"(#include "GB_cuda_kernel.h")" << std::endl << - R"(#include ")" << jit::get_user_home_cache_dir() << "/" - << reduce_factory_.filename << R"(")" << std::endl << + R"(#include ")" << reduce_factory_.filename << R"(")" << std::endl << R"(#include ")" << hashable_name << R"(.cuh")" << std::endl; int64_t anvals = GB_nnz_held (A) ; @@ -198,7 +197,7 @@ class reduceFactory jit::launcher(hashable_name + "_" + rcode, string_to_be_jitted.str(), header_names, - GB_jit_cuda_compiler_flags, + GB_cuda_jit_compiler_flags ( ), file_callback) // FIXME: where is file_callback defined? .set_kernel_inst( hashable_name , { A->type->name, monoid->op->ztype->name }) diff --git a/GraphBLAS/CUDA/GB_reduce_to_scalar_cuda_branch.cpp b/GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_branch.cpp similarity index 87% rename from GraphBLAS/CUDA/GB_reduce_to_scalar_cuda_branch.cpp rename to GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_branch.cpp index 455dd0ab19..f336ce8002 100644 --- a/GraphBLAS/CUDA/GB_reduce_to_scalar_cuda_branch.cpp +++ b/GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_branch.cpp @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_reduce_to_scalar_cuda_branch: when to use GPU for scalar reduction +// GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_branch: decide to use GPU for reduce //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -11,7 +11,7 @@ #include "GB_cuda.h" -bool GB_reduce_to_scalar_cuda_branch // return true to use the GPU +bool GB_cuda_reduce_to_scalar_branch // return true to use the GPU ( const GrB_Monoid monoid, // monoid to do the reduction const GrB_Matrix A // input matrix diff --git a/GraphBLAS/CUDA/GB_reduce_to_scalar_cuda.cpp b/GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_jit.cpp similarity index 88% rename from GraphBLAS/CUDA/GB_reduce_to_scalar_cuda.cpp rename to GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_jit.cpp index 2f3443217e..0d7c6578b0 100644 --- a/GraphBLAS/CUDA/GB_reduce_to_scalar_cuda.cpp +++ b/GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_jit.cpp @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_reduce_to_scalar_cuda.cpp: reduce on the GPU with semiring +// GraphBLAS/CUDA/GB_cuda_reduce_to_scalar_jit: reduce on the GPU with semiring //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -14,20 +14,19 @@ // threadblock. Then GB_reduce_to_scalar on the CPU sees this V as the result, // and calls itself recursively to continue the reduction. -#include "GraphBLAS.h" -#undef I +#include "GraphBLAS_cuda.h" + extern "C" { #include "GB_reduce.h" } #include "GB_cuda.h" -#include "GB_jit_cache.h" +#include "GB_cuda_jitify_cache.h" #include "GB_cuda_common_jitFactory.hpp" #include "GB_cuda_reduce_jitFactory.hpp" -#include "GB_cuda_type_wrap.hpp" -GrB_Info GB_reduce_to_scalar_cuda +GrB_Info GB_cuda_reduce_to_scalar_jit ( // output: GB_void *s, // note: statically allocated on CPU stack; if diff --git a/GraphBLAS/CUDA/GB_cuda_type_bits.c b/GraphBLAS/CUDA/GB_cuda_type_bits.c index 52b446a4ea..17de151f3f 100644 --- a/GraphBLAS/CUDA/GB_cuda_type_bits.c +++ b/GraphBLAS/CUDA/GB_cuda_type_bits.c @@ -1,6 +1,13 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GB_cuda_type_bits +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -#if 0 +//------------------------------------------------------------------------------ + +#undef GBCUDA_CPLUSPLUS #include "GB.h" size_t GB_cuda_type_bits (GB_Type_code); @@ -26,4 +33,3 @@ size_t GB_cuda_type_bits (GB_Type_code type_code) } } -#endif diff --git a/GraphBLAS/CUDA/GB_cuda_type_branch.cpp b/GraphBLAS/CUDA/GB_cuda_type_branch.cpp index 19e666f6ad..ba268b2a33 100644 --- a/GraphBLAS/CUDA/GB_cuda_type_branch.cpp +++ b/GraphBLAS/CUDA/GB_cuda_type_branch.cpp @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_cuda_type_branch: decide if GPU can be used on the given type +// GraphBLAS/CUDA/GB_cuda_type_branch: decide if GPU can be used on a type //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -14,12 +14,6 @@ // All built-in types pass this rule. -#include "GraphBLAS.h" -#undef I -extern "C" -{ - #include "GB.h" -} #include "GB_cuda.h" bool GB_cuda_type_branch // return true if the type is OK on GPU diff --git a/GraphBLAS/CUDA/GB_cuda_upscale_identity.cpp b/GraphBLAS/CUDA/GB_cuda_upscale_identity.cpp index 1a8c9c7a50..d7d5ec8a9e 100644 --- a/GraphBLAS/CUDA/GB_cuda_upscale_identity.cpp +++ b/GraphBLAS/CUDA/GB_cuda_upscale_identity.cpp @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_cuda_upscale_identity: return the identity, at least 16 bits in size +// GraphBLAS/CUDA/GB_cuda_upscale_identity: return identity, >= 16 bits in size //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GB_cuda_warmup.cu b/GraphBLAS/CUDA/GB_cuda_warmup.cu index ab82374238..4b8016e59c 100644 --- a/GraphBLAS/CUDA/GB_cuda_warmup.cu +++ b/GraphBLAS/CUDA/GB_cuda_warmup.cu @@ -1,8 +1,8 @@ //------------------------------------------------------------------------------ -// GB_cuda_warmup.cu: warmup the GPU +// GraphBLAS/CUDA/GB_cuda_warmup.cu: warmup the GPU //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GraphBLAS_cuda.h b/GraphBLAS/CUDA/GraphBLAS_cuda.h new file mode 100644 index 0000000000..4bb6872dc4 --- /dev/null +++ b/GraphBLAS/CUDA/GraphBLAS_cuda.h @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/GraphBLAS_cuda.h +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#ifndef GXB_COMPLEX_H +#define GXB_COMPLEX_H + + // C++ complex types for CUDA + #include + #include + typedef std::complex GxB_FC32_t ; + typedef std::complex GxB_FC64_t ; + #define GxB_CMPLXF(r,i) GxB_FC32_t(r,i) + #define GxB_CMPLX(r,i) GxB_FC64_t(r,i) + #define GB_HAS_CMPLX_MACROS 1 + +#endif + +#define GB_LIBRARY +#include "GraphBLAS.h" +#undef I + diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_dense_phase1.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_dense_phase1.cuh similarity index 96% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_dense_phase1.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_dense_phase1.cuh index 6c322ec078..2d971a5ecc 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_dense_phase1.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_dense_phase1.cuh @@ -1,7 +1,12 @@ //------------------------------------------------------------------------------ -// GB_jit_AxB_dot3_dense_phase1: phase1 for dot3, A and B are bitmap/full +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_dense_phase1.cuh //------------------------------------------------------------------------------ +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +// phase1 for dot3, A and B are bitmap/full // dense phase1: symbolic load balancing and data partition // to assign work to different 'buckets' for later compute diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase1.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase1.cuh similarity index 91% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase1.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase1.cuh index c2654ca296..23b6b272aa 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase1.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase1.cuh @@ -1,7 +1,13 @@ //------------------------------------------------------------------------------ -// template/GB_jit_AxB_dot3_phase1.cuh: build nanobuckets, hunt for pre-zombies +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase1.cuh //------------------------------------------------------------------------------ +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +// build nanobuckets, hunt for pre-zombies + // dot3, phase1: symbolic load balancing and data partition // to assign work to different 'buckets' for later compute @@ -80,14 +86,12 @@ __global__ void GB_jit_AxB_dot3_phase1 const bool M_is_hyper = M->h != NULL ; ASSERT (GB_M_IS_SPARSE || GB_M_IS_HYPER) ; - const int64_t *__restrict__ Ah = A->h ; const int64_t *__restrict__ Ap = A->p ; const int64_t *__restrict__ Ai = A->i ; const int64_t avlen = A->vlen ; // const int64_t anz = GB_nnz(A) ; const GB_A_NVALS (anz) ; - const int64_t *__restrict__ Bh = B->h ; const int64_t *__restrict__ Bp = B->p ; const int64_t *__restrict__ Bi = B->i ; const int64_t bvlen = B->vlen ; @@ -95,17 +99,23 @@ __global__ void GB_jit_AxB_dot3_phase1 const GB_B_NVALS (bnz) ; #if GB_A_IS_HYPER - const int64_t *__restrict__ A_Yp = A->Y->p ; - const int64_t *__restrict__ A_Yi = A->Y->i ; - const int64_t *__restrict__ A_Yx = (int64_t *) A->Y->x ; - const int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t anvec = A->nvec ; + const int64_t *__restrict__ Ah = A->h ; + const int64_t *__restrict__ A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *__restrict__ A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *__restrict__ A_Yx = (int64_t *) + ((A->Y == NULL) ? NULL : A->Y->x) ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #endif #if GB_B_IS_HYPER - const int64_t *__restrict__ B_Yp = B->Y->p ; - const int64_t *__restrict__ B_Yi = B->Y->i ; - const int64_t *__restrict__ B_Yx = (int64_t *) B->Y->x ; - const int64_t B_hash_bits = B->Y->vdim - 1 ; + const int64_t bnvec = B->nvec ; + const int64_t *__restrict__ Bh = B->h ; + const int64_t *__restrict__ B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *__restrict__ B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *__restrict__ B_Yx = (int64_t *) + ((B->Y == NULL) ? NULL : B->Y->x) ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; #endif // int64_t *restrict Cp = C->p ; // copy of Mp @@ -220,8 +230,8 @@ __global__ void GB_jit_AxB_dot3_phase1 int64_t pB, pB_end ; #if GB_B_IS_HYPER - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, - j, &pB, &pB_end) ; + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, + B_hash_bits, j, &pB, &pB_end) ; #elif GB_B_IS_SPARSE pB = Bp[j] ; pB_end = Bp[j+1] ; @@ -241,8 +251,8 @@ __global__ void GB_jit_AxB_dot3_phase1 int64_t pA, pA_end ; #if GB_A_IS_HYPER - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, - i, &pA, &pA_end) ; + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, + A_hash_bits, i, &pA, &pA_end) ; #elif GB_A_IS_SPARSE pA = Ap[i] ; pA_end = Ap[i+1] ; diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_dndn.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_dndn.cuh similarity index 97% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_dndn.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_dndn.cuh index 1a94693f23..80a4e2020b 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_dndn.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_dndn.cuh @@ -1,5 +1,9 @@ //------------------------------------------------------------------------------ -// GB_jit_AxB_dot3_phase3_dndn.cuh: +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_dndn.cuh +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + //------------------------------------------------------------------------------ // This CUDA kernel produces the semiring product of two diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_mp.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_mp.cuh similarity index 92% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_mp.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_mp.cuh index 267b41b419..838b7e4ccf 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_mp.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_mp.cuh @@ -1,5 +1,10 @@ //------------------------------------------------------------------------------ -// AxB_dot3_phase3_mp.cu +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_mp.cuh +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + //------------------------------------------------------------------------------ // This CUDA kernel produces the semi-ring product of two @@ -78,7 +83,7 @@ template< typename T_C, typename T_A, typename T_B, typename T_Z, typename T_X, typename T_Y, uint64_t srcode> -__global__ void AxB_dot3_phase3_mp +__global__ void AxB_dot3_phase3_mp // FIXME rename ( int64_t start, int64_t end, @@ -114,17 +119,23 @@ __global__ void AxB_dot3_phase3_mp ASSERT (GB_B_IS_HYPER || GB_B_IS_SPARSE) ; #if GB_A_IS_HYPER - const int64_t *__restrict__ A_Yp = A->Y->p ; - const int64_t *__restrict__ A_Yi = A->Y->i ; - const int64_t *__restrict__ A_Yx = (int64_t *) A->Y->x ; - const int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t anvec = A->nvec ; + const int64_t *__restrict__ Ah = A->h ; + const int64_t *__restrict__ A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *__restrict__ A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *__restrict__ A_Yx = (int64_t *) + ((A->Y == NULL) ? NULL : A->Y->x) ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #endif #if GB_B_IS_HYPER - const int64_t *__restrict__ B_Yp = B->Y->p ; - const int64_t *__restrict__ B_Yi = B->Y->i ; - const int64_t *__restrict__ B_Yx = (int64_t *) B->Y->x ; - const int64_t B_hash_bits = B->Y->vdim - 1 ; + const int64_t bnvec = B->nvec ; + const int64_t *__restrict__ Bh = B->h ; + const int64_t *__restrict__ B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *__restrict__ B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *__restrict__ B_Yx = (int64_t *) + ((B->Y == NULL) ? NULL : B->Y->x) ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; #endif // zombie count @@ -162,7 +173,7 @@ __global__ void AxB_dot3_phase3_mp // find A(:,i) int64_t pA_start, pA_end ; #if GB_A_IS_HYPER - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, i, &pA_start, &pA_end) ; #else pA_start = Ap[i] ; @@ -192,7 +203,7 @@ __global__ void AxB_dot3_phase3_mp // find B(:,j) int64_t pB_start, pB_end ; #if GB_B_IS_HYPER - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, j, &pB_start, &pB_end) ; #else pB_start = Bp[j] ; @@ -331,7 +342,7 @@ __global__ void AxB_dot3_phase3_mp #else if (Aind == Bind) { - // cij += aki + bkj + // cij += aki * bkj GB_DOT_MERGE (pA + pA_start, pB + pB_start) ; // TODO check terminal condition, using tile.any } diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_spdn.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_spdn.cuh similarity index 89% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_spdn.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_spdn.cuh index 499a5f386f..e8986d86cf 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_spdn.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_spdn.cuh @@ -1,5 +1,9 @@ //------------------------------------------------------------------------------ -// AxB_dot3_phase3_spdn.cu +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_spdn.cuh +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + //------------------------------------------------------------------------------ // This CUDA kernel produces the semi-ring product of two @@ -67,7 +71,7 @@ template< typename T_C, typename T_A, typename T_B, typename T_Z, typename T_X, typename T_Y, uint64_t srcode> -__global__ void AxB_dot3_phase3_spdn +__global__ void AxB_dot3_phase3_spdn // FIXME rename ( int64_t start, int64_t end, @@ -113,17 +117,23 @@ __global__ void AxB_dot3_phase3_spdn #endif #if GB_A_IS_HYPER - const int64_t *__restrict__ A_Yp = A->Y->p ; - const int64_t *__restrict__ A_Yi = A->Y->i ; - const int64_t *__restrict__ A_Yx = (int64_t *) A->Y->x ; - const int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t anvec = A->nvec ; + const int64_t *__restrict__ Ah = A->h ; + const int64_t *__restrict__ A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *__restrict__ A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *__restrict__ A_Yx = (int64_t *) + ((A->Y == NULL) ? NULL : A->Y->x) ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #endif #if GB_B_IS_HYPER - const int64_t *__restrict__ B_Yp = B->Y->p ; - const int64_t *__restrict__ B_Yi = B->Y->i ; - const int64_t *__restrict__ B_Yx = (int64_t *) B->Y->x ; - const int64_t B_hash_bits = B->Y->vdim - 1 ; + const int64_t bnvec = B->nvec ; + const int64_t *__restrict__ Bh = B->h ; + const int64_t *__restrict__ B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *__restrict__ B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *__restrict__ B_Yx = (int64_t *) + ((B->Y == NULL) ? NULL : B->Y->x) ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; #endif // zombie count @@ -151,7 +161,7 @@ __global__ void AxB_dot3_phase3_spdn // find A(:,i) int64_t pA, pA_end ; #if GB_A_IS_HYPER - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, i, &pA, &pA_end) ; #elif GB_A_IS_SPARSE pA = Ap[i] ; @@ -171,7 +181,7 @@ __global__ void AxB_dot3_phase3_spdn // find B(:,j) int64_t pB, pB_end ; #if GB_B_IS_HYPER - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, j, &pB, &pB_end) ; #elif GB_B_IS_SPARSE pB = Bp[j] ; diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_vsdn.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsdn.cuh similarity index 87% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_vsdn.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsdn.cuh index d5713d5e1c..e5168527e0 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_vsdn.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsdn.cuh @@ -1,3 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsdn.cuh +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + //****************************************************************************** // Sparse dot products in batch form, sparse - dense case. // Each thread in this kernel is responsible for m vector-pairs(x,y), @@ -98,17 +106,23 @@ __global__ void AxB_dot3_phase3_vsdn #endif #if GB_A_IS_HYPER - const int64_t *__restrict__ A_Yp = A->Y->p ; - const int64_t *__restrict__ A_Yi = A->Y->i ; - const int64_t *__restrict__ A_Yx = (int64_t *) A->Y->x ; - const int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t anvec = A->nvec ; + const int64_t *__restrict__ Ah = A->h ; + const int64_t *__restrict__ A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *__restrict__ A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *__restrict__ A_Yx = (int64_t *) + ((A->Y == NULL) ? NULL : A->Y->x) ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #endif #if GB_B_IS_HYPER - const int64_t *__restrict__ B_Yp = B->Y->p ; - const int64_t *__restrict__ B_Yi = B->Y->i ; - const int64_t *__restrict__ B_Yx = (int64_t *) B->Y->x ; - const int64_t B_hash_bits = B->Y->vdim - 1 ; + const int64_t bnvec = B->nvec ; + const int64_t *__restrict__ Bh = B->h ; + const int64_t *__restrict__ B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *__restrict__ B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *__restrict__ B_Yx = (int64_t *) + ((B->Y == NULL) ? NULL : B->Y->x) ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; #endif // typedef cub::BlockReduce BlockReduce; @@ -147,7 +161,7 @@ __global__ void AxB_dot3_phase3_vsdn // find A(:,i) int64_t pA, pA_end ; #if GB_A_IS_HYPER - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, i, &pA, &pA_end) ; #elif GB_A_IS_SPARSE pA = Ap[i] ; @@ -161,7 +175,7 @@ __global__ void AxB_dot3_phase3_vsdn // find B(:,j) int64_t pB, pB_end ; #if GB_B_IS_HYPER - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, j, &pB, &pB_end) ; #elif GB_B_IS_SPARSE pB = Bp[j]; // col of C diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_vsvs.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsvs.cuh similarity index 85% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_vsvs.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsvs.cuh index 02a94eeeb6..bcd0d4d25c 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_dot3_phase3_vsvs.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsvs.cuh @@ -1,3 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_dot3_phase3_vsvs.cuh +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + //****************************************************************************** // Sparse dot version of Matrix-Matrix multiply with mask // Each thread in this kernel is responsible for m vector-pairs(x,y), @@ -145,17 +153,23 @@ __global__ void AxB_dot3_phase3_vsvs #endif #if GB_A_IS_HYPER - const int64_t *__restrict__ A_Yp = A->Y->p ; - const int64_t *__restrict__ A_Yi = A->Y->i ; - const int64_t *__restrict__ A_Yx = (int64_t *) A->Y->x ; - const int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t anvec = A->nvec ; + const int64_t *__restrict__ Ah = A->h ; + const int64_t *__restrict__ A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *__restrict__ A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *__restrict__ A_Yx = (int64_t *) + ((A->Y == NULL) ? NULL : A->Y->x) ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #endif #if GB_B_IS_HYPER - const int64_t *__restrict__ B_Yp = B->Y->p ; - const int64_t *__restrict__ B_Yi = B->Y->i ; - const int64_t *__restrict__ B_Yx = (int64_t *) B->Y->x ; - const int64_t B_hash_bits = B->Y->vdim - 1 ; + const int64_t bnvec = B->nvec ; + const int64_t *__restrict__ Bh = B->h ; + const int64_t *__restrict__ B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *__restrict__ B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *__restrict__ B_Yx = (int64_t *) + ((B->Y == NULL) ? NULL : B->Y->x) ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; #endif //int64_t pfirst, plast; @@ -184,7 +198,7 @@ __global__ void AxB_dot3_phase3_vsvs // find A(:,i): A is always sparse or hypersparse int64_t pA, pA_end ; #if GB_A_IS_HYPER - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, i, &pA, &pA_end) ; #else pA = Ap[i] ; @@ -194,7 +208,7 @@ __global__ void AxB_dot3_phase3_vsvs // find B(:,j): B is always sparse or hypersparse int64_t pB, pB_end ; #if GB_B_IS_HYPER - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, j, &pB, &pB_end) ; #else pB = Bp[j] ; diff --git a/GraphBLAS/CUDA/templates/GB_jit_AxB_phase2.cuh b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_phase2.cuh similarity index 94% rename from GraphBLAS/CUDA/templates/GB_jit_AxB_phase2.cuh rename to GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_phase2.cuh index 23ea6d85a2..3d9f7d39cb 100644 --- a/GraphBLAS/CUDA/templates/GB_jit_AxB_phase2.cuh +++ b/GraphBLAS/CUDA/JitKernels/GB_cuda_jit_AxB_phase2.cuh @@ -1,8 +1,13 @@ //------------------------------------------------------------------------------ -// templates/GB_AxB_cuda_dot3_phase2: fill the global buckets +// GraphBLAS/CUDA/JitKernels/GB_cuda_jit_GB_AxB_phase2.cuh +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ +// fill the global buckets //------------------------------------------------------------------------------ -// TODO describe me #pragma once #include "GB_cuda_kernel.h" #include "GB_mxm_shared_definitions.h" @@ -114,7 +119,7 @@ __inline__ __device__ uint64_t warp_ReduceSumPlus_uint64( thread_block_tile -__global__ void GB_jit_reduce +__global__ void GB_jit_reduce // FIXME rename ( GrB_Matrix A, // matrix to reduce void *zscalar, // scalar result, at least sizeof (uint32_t) diff --git a/GraphBLAS/CUDA/GB_cuda_atomics.cuh b/GraphBLAS/CUDA/Template/GB_cuda_atomics.cuh similarity index 99% rename from GraphBLAS/CUDA/GB_cuda_atomics.cuh rename to GraphBLAS/CUDA/Template/GB_cuda_atomics.cuh index abb96591e9..9eeddf43dc 100644 --- a/GraphBLAS/CUDA/GB_cuda_atomics.cuh +++ b/GraphBLAS/CUDA/Template/GB_cuda_atomics.cuh @@ -1,9 +1,11 @@ //------------------------------------------------------------------------------ -// GraphBLAS/CUDA/GB_cuda_atomics: CUDA atomics for GraphBLAS +// GraphBLAS/CUDA/Template/GB_cuda_atomics.cuh: CUDA atomics for GraphBLAS //------------------------------------------------------------------------------ +// yet still more stuff here + /* - * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/GraphBLAS/CUDA/GB_cuda_buckets.h b/GraphBLAS/CUDA/Template/GB_cuda_buckets.h similarity index 86% rename from GraphBLAS/CUDA/GB_cuda_buckets.h rename to GraphBLAS/CUDA/Template/GB_cuda_buckets.h index d818b2dc68..57cc9ebc4a 100644 --- a/GraphBLAS/CUDA/GB_cuda_buckets.h +++ b/GraphBLAS/CUDA/Template/GB_cuda_buckets.h @@ -1,13 +1,13 @@ //------------------------------------------------------------------------------ -// GB_cuda_buckets.h: definitions for buckets using for dot3 +// GraphBLAS/CUDA/Template/GB_cuda_buckets.h: bucket definitions for dot3 //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -//------------------------------------------------------------------------------ +// FIXME: rename this file to GB_cuda_dot3_buckets.h (or .cuh? .hpp?) -// This file is #include'd only in the GraphBLAS/CUDA/GB_cuda*.cu source files. +//------------------------------------------------------------------------------ #ifndef GB_CUDA_BUCKETS_H #define GB_CUDA_BUCKETS_H @@ -21,6 +21,7 @@ // dot3: C=A'B, M is sparse or hyper, C is sparse or hyper // 32 kernels A,B: (hyper,sparse,bitmap,full)^2 x (M and C are sparse/hyper) +// FIXME: rename enum values to GB_DOT3_BUCKET* typedef enum { GB_BUCKET_ZOMBIE = 0, // C(i,j) is a zombie (not a bucket) @@ -33,7 +34,7 @@ typedef enum GB_BUCKET_SPDN = 2, // spdn: sparse vector has lots of entries; // use a whole warp for each dot product } -GB_bucket_code ; +GB_bucket_code ; // FIXME: rename GB_dot3_bucket_code // These may use another bucket enum: diff --git a/GraphBLAS/CUDA/GB_cuda_dot3_defn.h b/GraphBLAS/CUDA/Template/GB_cuda_dot3_defn.h similarity index 95% rename from GraphBLAS/CUDA/GB_cuda_dot3_defn.h rename to GraphBLAS/CUDA/Template/GB_cuda_dot3_defn.h index ac6802545d..651ec5c064 100644 --- a/GraphBLAS/CUDA/GB_cuda_dot3_defn.h +++ b/GraphBLAS/CUDA/Template/GB_cuda_dot3_defn.h @@ -1,11 +1,13 @@ //------------------------------------------------------------------------------ -// CUDA/GB_cuda_dot3_defn.h: definitions just for the dot3 method +// GraphBLAS/CUDA/Template/GB_cuda_dot3_defn.h: defns just for dot3 //------------------------------------------------------------------------------ // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ +// FIXME: rename this to .cuh? It is only #included by GB_cuda_jit* + #pragma once //------------------------------------------------------------------------------ diff --git a/GraphBLAS/CUDA/GB_cuda_kernel.h b/GraphBLAS/CUDA/Template/GB_cuda_kernel.h similarity index 97% rename from GraphBLAS/CUDA/GB_cuda_kernel.h rename to GraphBLAS/CUDA/Template/GB_cuda_kernel.h index 6ba8d69be3..b4eb500a56 100644 --- a/GraphBLAS/CUDA/GB_cuda_kernel.h +++ b/GraphBLAS/CUDA/Template/GB_cuda_kernel.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// CUDA/GB_cuda_kernel.h: definitions for all GraphBLAS CUDA kernels +// GraphBLAS/CUDA/Template/GB_cuda_kernel.h: definitions for CUDA kernels //------------------------------------------------------------------------------ // SPDX-License-Identifier: Apache-2.0 @@ -9,6 +9,8 @@ // This file is #include'd into all CUDA kernels for GraphBLAS. It provides // a subset of GraphBLAS.h and GB.h, plus other definitions. +// FIXME: rename to .cuh? + #pragma once #define GB_CUDA_KERNEL @@ -75,6 +77,9 @@ typedef struct GB_Semiring_opaque *GrB_Semiring ; typedef struct GB_Scalar_opaque *GrB_Scalar ; typedef struct GB_Vector_opaque *GrB_Vector ; typedef struct GB_Matrix_opaque *GrB_Matrix ; +typedef struct GB_Context_opaque *GxB_Context ; +typedef struct GB_Global_opaque *GrB_Global ; +typedef struct GB_Iterator_opaque *GxB_Iterator ; #define GxB_HYPERSPARSE 1 // store matrix in hypersparse form #define GxB_SPARSE 2 // store matrix as sparse form (compressed vector) diff --git a/GraphBLAS/CUDA/go b/GraphBLAS/CUDA/go new file mode 100755 index 0000000000..74b4fa0787 --- /dev/null +++ b/GraphBLAS/CUDA/go @@ -0,0 +1,14 @@ +#!/bin/bash + +# nuke the cached kernels and src +find ~/.SuiteSparse/GrB9.0.1 -mindepth 1 -delete + +# rebuild the JITpackage +( cd ../JITpackage ; make purge ; make ) + +# rebuild GraphBLAS +( cd .. ; make ) + +# run a demo +../build/wathen_demo + diff --git a/GraphBLAS/CUDA/templates/stdbool.h b/GraphBLAS/CUDA/templates/stdbool.h deleted file mode 100644 index abd5a41fc2..0000000000 --- a/GraphBLAS/CUDA/templates/stdbool.h +++ /dev/null @@ -1 +0,0 @@ -// a fake copy of stdbool.h (contents not needed) diff --git a/GraphBLAS/CUDA/test/AxB_dot3_cuda_tests.cpp b/GraphBLAS/CUDA/test/AxB_dot3_cuda_tests.cpp index 758131f202..ca7c5de350 100644 --- a/GraphBLAS/CUDA/test/AxB_dot3_cuda_tests.cpp +++ b/GraphBLAS/CUDA/test/AxB_dot3_cuda_tests.cpp @@ -1,5 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/AxB_dot3_cuda_tests.cpp +//------------------------------------------------------------------------------ + // SPDX-License-Identifier: Apache-2.0 +//------------------------------------------------------------------------------ + // Test AxB_dot3_cuda kernels // Using data generators and test classes, cover // all NBUCKETS cases for the masked GEMM ( C, M, A, B) in GraphBLAS diff --git a/GraphBLAS/CUDA/GB_cuda_type_wrap.hpp b/GraphBLAS/CUDA/test/GB_cuda_type_wrap.hpp similarity index 97% rename from GraphBLAS/CUDA/GB_cuda_type_wrap.hpp rename to GraphBLAS/CUDA/test/GB_cuda_type_wrap.hpp index 22904be260..3acf26553f 100644 --- a/GraphBLAS/CUDA/GB_cuda_type_wrap.hpp +++ b/GraphBLAS/CUDA/test/GB_cuda_type_wrap.hpp @@ -1,3 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/GB_cuda_type_wrap.hpp +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + /* * Copyright (c) 2019,2020 NVIDIA CORPORATION. * diff --git a/GraphBLAS/CUDA/test/GpuTimer.h b/GraphBLAS/CUDA/test/GpuTimer.h index 014d7616de..ed5b52520d 100644 --- a/GraphBLAS/CUDA/test/GpuTimer.h +++ b/GraphBLAS/CUDA/test/GpuTimer.h @@ -1,4 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/GpuTimer.h +//------------------------------------------------------------------------------ + // SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + #ifndef __GPU_TIMER_H__ #define __GPU_TIMER_H__ diff --git a/GraphBLAS/CUDA/test/Makefile b/GraphBLAS/CUDA/test/Makefile index d21f329a0f..412ac47294 100644 --- a/GraphBLAS/CUDA/test/Makefile +++ b/GraphBLAS/CUDA/test/Makefile @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# GraphBLAS/CUDA/Makefile +# GraphBLAS/CUDA/test/Makefile #------------------------------------------------------------------------------- # cuda 10.1+ is assumed @@ -77,12 +77,13 @@ TEMPLATE_DIR ?= ../templates LIB += -ldl -L$(CUDA_LIB_DIR) -L$(CUDA_LIB_DIR)/stubs -lcuda -lcudadevrt -lcudart -lnvrtc +# FIXME: file names in HEADERS are old HEADERS = jitify.hpp dataFactory.hpp jitFactory.hpp jitTestFactory.hpp semiringFactory.hpp \ ../type_name.hpp TEMPLATES := $(wildcard $(TEMPLATE_DIR)/*.cu) -CU_OBJS := ../GB_jit_cache.o ../GB_jit_launcher.o +CU_OBJS := ../GB_cuda_jitify_cache.o ../GB_cuda_jitify_launcher.o CFILES := $(wildcard ../*.c) diff --git a/GraphBLAS/CUDA/test/cuda_tests_template.cpp b/GraphBLAS/CUDA/test/cuda_tests_template.cpp index 66e6413926..340ded031b 100644 --- a/GraphBLAS/CUDA/test/cuda_tests_template.cpp +++ b/GraphBLAS/CUDA/test/cuda_tests_template.cpp @@ -1,5 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/cuda_tests_template.cpp +//------------------------------------------------------------------------------ + // SPDX-License-Identifier: Apache-2.0 +//------------------------------------------------------------------------------ + // Test AxB_dot3_cuda kernels // Using data generators and test classes, cover // all NBUCKETS cases for the masked GEMM ( C, M, A, B) in GraphBLAS diff --git a/GraphBLAS/CUDA/test/dataFactory.hpp b/GraphBLAS/CUDA/test/dataFactory.hpp index af1215175e..5c6263c918 100644 --- a/GraphBLAS/CUDA/test/dataFactory.hpp +++ b/GraphBLAS/CUDA/test/dataFactory.hpp @@ -1,5 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/dataFactory.hpp +//------------------------------------------------------------------------------ + // SPDX-License-Identifier: Apache-2.0 +//------------------------------------------------------------------------------ + #pragma once #include @@ -8,10 +14,9 @@ #include #include "GB.h" -#include "../GB_cuda_type_wrap.hpp" +#include "GB_cuda_type_wrap.hpp" #include "test_utility.hpp" -#include "../GB_cuda_error.h" - +#include "GB_cuda_error.h" // CAUTION: This assumes our indices are small enough to fit into a 32-bit int. inline std::int64_t gen_key(std::int64_t i, std::int64_t j) { diff --git a/GraphBLAS/CUDA/test/jitTestFactory.hpp b/GraphBLAS/CUDA/test/jitTestFactory.hpp index 59344ed234..9e83ae4dd0 100644 --- a/GraphBLAS/CUDA/test/jitTestFactory.hpp +++ b/GraphBLAS/CUDA/test/jitTestFactory.hpp @@ -1,5 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/jitTestFactory.hpp +//------------------------------------------------------------------------------ + // SPDX-License-Identifier: Apache-2.0 +//------------------------------------------------------------------------------ + #pragma once #include diff --git a/GraphBLAS/CUDA/test/problem_spec.hpp b/GraphBLAS/CUDA/test/problem_spec.hpp index fdf55128d0..c1997771ab 100644 --- a/GraphBLAS/CUDA/test/problem_spec.hpp +++ b/GraphBLAS/CUDA/test/problem_spec.hpp @@ -1,3 +1,11 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/problem_spec.hpp +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + #pragma once #include diff --git a/GraphBLAS/CUDA/test/run_tests.cpp b/GraphBLAS/CUDA/test/run_tests.cpp index 3631ce4d3b..2618b9f688 100644 --- a/GraphBLAS/CUDA/test/run_tests.cpp +++ b/GraphBLAS/CUDA/test/run_tests.cpp @@ -1,9 +1,14 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/run_tests.cpp +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + #include -extern "C" { -#include "GraphBLAS.h" -#undef I -} +#include "GraphBLAS_cuda.h" #include "rmm_wrap.h" #include "test_utility.hpp" diff --git a/GraphBLAS/CUDA/test/testGen_cmake.py b/GraphBLAS/CUDA/test/testGen_cmake.py index ade7381ad8..52857f0bd0 100644 --- a/GraphBLAS/CUDA/test/testGen_cmake.py +++ b/GraphBLAS/CUDA/test/testGen_cmake.py @@ -1,4 +1,11 @@ +#------------------------------------------------------------------------------- +# GraphBLAS/CUDA/test/testGen_cmake.py +#------------------------------------------------------------------------------- + # SPDX-License-Identifier: Apache-2.0 + +#------------------------------------------------------------------------------- + # Generate test instances from a large tensor product set of options GB_TYPE_PREFIX = "GrB" diff --git a/GraphBLAS/CUDA/test/test_data.hpp b/GraphBLAS/CUDA/test/test_data.hpp index 1e418260b5..d6cca87d0e 100644 --- a/GraphBLAS/CUDA/test/test_data.hpp +++ b/GraphBLAS/CUDA/test/test_data.hpp @@ -1,3 +1,10 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/test_data.hpp +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ #include #include diff --git a/GraphBLAS/CUDA/test/test_jitify.cpp b/GraphBLAS/CUDA/test/test_jitify.cpp index b3ddbe35f1..30aab0adc2 100644 --- a/GraphBLAS/CUDA/test/test_jitify.cpp +++ b/GraphBLAS/CUDA/test/test_jitify.cpp @@ -1,8 +1,20 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/test_jitify.cpp +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + #include "jitify.hpp" -#include "../GB_jit_launcher.h" +#include "GB_cuda_jitify_launcher.h" int main(int argc, char **argv) { +#if 0 + +BROKEN + std::string named_program = "GB_jit_AxB_phase2"; std::string kern_name = "AxB_phase2"; @@ -21,7 +33,8 @@ int main(int argc, char **argv) { std::string hashable_name = "GB_jit_AxB_phase2"; std::stringstream string_to_be_jitted ; - string_to_be_jitted << hashable_name << std::endl << R"(#include "GB_jit_AxB_dot3_phase2.cuh")"; + string_to_be_jitted << hashable_name << std::endl << + R"(#include "GB_jit_AxB_dot3_phase2.cuh")"; // FIXME: wrong name jit::launcher( hashable_name, string_to_be_jitted.str(), @@ -33,6 +46,6 @@ int main(int argc, char **argv) { .launch( nanobuckets, blockBucket, bucketp, bucket, C->mat, cnz); - +#endif } diff --git a/GraphBLAS/CUDA/test/test_utility.hpp b/GraphBLAS/CUDA/test/test_utility.hpp index d86a558137..3eb6ba942e 100644 --- a/GraphBLAS/CUDA/test/test_utility.hpp +++ b/GraphBLAS/CUDA/test/test_utility.hpp @@ -1,3 +1,10 @@ +//------------------------------------------------------------------------------ +// GraphBLAS/CUDA/test/test_utility.hpp +//------------------------------------------------------------------------------ + +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ #pragma once diff --git a/GraphBLAS/Config/GB_config.h.in b/GraphBLAS/Config/GB_config.h.in index c72a289d2d..3585ce4c20 100644 --- a/GraphBLAS/Config/GB_config.h.in +++ b/GraphBLAS/Config/GB_config.h.in @@ -2,7 +2,7 @@ // GraphBLAS/Config/GB_config.h: JIT configuration for GraphBLAS //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ diff --git a/GraphBLAS/Config/GB_prejit.c b/GraphBLAS/Config/GB_prejit.c index 4ac9d69a2d..d2ed98f28e 100644 --- a/GraphBLAS/Config/GB_prejit.c +++ b/GraphBLAS/Config/GB_prejit.c @@ -2,7 +2,7 @@ // GraphBLAS/Config/GB_prejit.c: return list of PreJIT kernels //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ diff --git a/GraphBLAS/Config/GB_prejit.c.in b/GraphBLAS/Config/GB_prejit.c.in index aeb735a9ac..0955d97234 100644 --- a/GraphBLAS/Config/GB_prejit.c.in +++ b/GraphBLAS/Config/GB_prejit.c.in @@ -2,7 +2,7 @@ // GraphBLAS/Config/GB_prejit.c: return list of PreJIT kernels //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ diff --git a/GraphBLAS/Config/GraphBLAS.h.in b/GraphBLAS/Config/GraphBLAS.h.in index c8cec32ae2..9b05ad4dbe 100644 --- a/GraphBLAS/Config/GraphBLAS.h.in +++ b/GraphBLAS/Config/GraphBLAS.h.in @@ -3,7 +3,7 @@ // GraphBLAS.h: definitions for the GraphBLAS package //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -32,10 +32,10 @@ // Regarding "historical" functions and symbols: when a GxB_* function or // symbol is added to the C API Specification, the new GrB_* name should be -// used instead. The old GxB_* name will be kept for historical reasons, -// documented here and in working order; it might no longer be mentioned in the -// user guide. Historical functions and symbols would only be removed in the -// rare case that they cause a serious conflict with future methods. +// used instead. The old GxB_* name will be kept in working order for +// historical reasons; it might no longer be mentioned in the user guide. +// Historical functions and symbols would only be removed in the rare case that +// they cause a serious conflict with future methods. #ifndef GRAPHBLAS_H #define GRAPHBLAS_H @@ -246,12 +246,12 @@ // The 'about' string the describes this particular implementation of GraphBLAS: #define GxB_IMPLEMENTATION_ABOUT \ -"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved." \ +"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved." \ "\nhttp://suitesparse.com Dept of Computer Sci. & Eng, Texas A&M University.\n" // The GraphBLAS license for this particular implementation of GraphBLAS: #define GxB_IMPLEMENTATION_LICENSE \ -"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved." \ +"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved." \ "\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\n"\ "not use SuiteSparse:GraphBLAS except in compliance with the License. You\n" \ "may obtain a copy of the License at\n\n" \ @@ -270,10 +270,11 @@ // The 'spec' string describes the GraphBLAS spec: #define GxB_SPEC_ABOUT \ -"GraphBLAS C API, by Aydin Buluc, Timothy Mattson, Scott McMillan,\n" \ -"Jose' Moreira, Carl Yang, and Benjamin Brock. Based on 'GraphBLAS\n" \ -"Mathematics by Jeremy Kepner. See also 'Graph Algorithms in the Language\n" \ -"of Linear Algebra,' edited by J. Kepner and J. Gilbert, SIAM, 2011.\n" +"GraphBLAS C API, by Benjamin Brock, Aydin Buluc, Raye Kimmerer,\n" \ +"Jim Kitchen, Major Kumar, Timothy Mattson, Scott McMillan, Jose' Moreira,\n" \ +"Erik Welch, and Carl Yang. Based on 'GraphBLAS Mathematics by Jeremy\n" \ +"Kepner. See also 'Graph Algorithms in the Language of Linear Algebra,'\n" \ +"edited by J. Kepner and J. Gilbert, SIAM, 2011.\n" //============================================================================== // GrB_Index: the GraphBLAS integer @@ -330,6 +331,7 @@ typedef enum GrB_DIMENSION_MISMATCH = -6, // matrix dimensions do not match GrB_OUTPUT_NOT_EMPTY = -7, // output matrix already has values GrB_NOT_IMPLEMENTED = -8, // method not implemented + GrB_ALREADY_SET = -9, // field already written to GrB_PANIC = -101, // unknown error GrB_OUT_OF_MEMORY = -102, // out of memory GrB_INSUFFICIENT_SPACE = -103, // output array not large enough @@ -392,7 +394,12 @@ GrB_Info GrB_finalize (void) ; // finish GraphBLAS // GrB_getVersion: GraphBLAS C API version //============================================================================== -// GrB_getVersion provides a runtime access of the C API Version. +// GrB_getVersion provides a runtime access of the C API Version. Can also be +// done with two calls to GrB_Global_get_INT32 with the v2.1 C API: +// +// GrB_get (GrB_GLOBAL, &version, GrB_API_VER_MAJOR) ; +// GrB_get (GrB_GLOBAL, &subversion, GrB_API_VER_MINOR) ; + GrB_Info GrB_getVersion // runtime access to C API version number ( unsigned int *version, // returns GRB_VERSION @@ -405,13 +412,13 @@ GrB_Info GrB_getVersion // runtime access to C API version number // The GrB_Descriptor is used to modify the behavior of GraphBLAS operations. // -// GrB_OUTP: can be GxB_DEFAULT or GrB_REPLACE. If GrB_REPLACE, then C is +// GrB_OUTP: can be GrB_DEFAULT or GrB_REPLACE. If GrB_REPLACE, then C is // cleared after taking part in the accum operation but before the mask. // In other words, C = accum (C,T) is split into Z = accum(C,T) ; // C=0 ; C = Z. // -// GrB_MASK: can be GxB_DEFAULT, GrB_COMP, GrB_STRUCTURE, or set to both -// GrB_COMP and GrB_STRUCTURE. If GxB_DEFAULT, the mask is used +// GrB_MASK: can be GrB_DEFAULT, GrB_COMP, GrB_STRUCTURE, or set to both +// GrB_COMP and GrB_STRUCTURE. If GrB_DEFAULT, the mask is used // normally, where Mask(i,j)=1 means C(i,j) can be modified by C=Z, // and Mask(i,j)=0 means it cannot be modified even if Z(i,j) is has been // computed and differs from C(i,j). If GrB_COMP, this is the same as @@ -419,7 +426,7 @@ GrB_Info GrB_getVersion // runtime access to C API version number // the value of the mask is not considered, just its pattern. The // GrB_COMP and GrB_STRUCTURE settings can be combined. // -// GrB_INP0: can be GxB_DEFAULT or GrB_TRAN. If GxB_DEFAULT, the first input +// GrB_INP0: can be GrB_DEFAULT or GrB_TRAN. If GrB_DEFAULT, the first input // is used as-is. If GrB_TRAN, it is transposed. Only matrices are // transposed this way. Vectors are never transposed via the // GrB_Descriptor. @@ -429,7 +436,7 @@ GrB_Info GrB_getVersion // runtime access to C API version number // GxB_AxB_METHOD: this is a hint to SuiteSparse:GraphBLAS on which algorithm // it should use to compute C=A*B, in GrB_mxm, GrB_mxv, and GrB_vxm. // SuiteSparse:GraphBLAS has four different heuristics, and the default -// method (GxB_DEFAULT) selects between them automatically. The complete +// method (GrB_DEFAULT) selects between them automatically. The complete // rule is in the User Guide. The brief discussion here assumes all // matrices are stored by column. All methods compute the same result, // except that floating-point roundoff may differ when working on @@ -459,7 +466,7 @@ GrB_Info GrB_getVersion // runtime access to C API version number // state, with indices out of order. The sort is left pending. Some // methods can tolerate jumbled matrices on input, so this can be faster. // However, in some cases, it can be faster for GrB_mxm to sort its output -// as it is computed. With GxB_SORT set to GxB_DEFAULT, the sort is left +// as it is computed. With GxB_SORT set to GrB_DEFAULT, the sort is left // pending. With GxB_SORT set to a nonzero value, GrB_mxm typically sorts // the resulting matrix C (but not always; this is just a hint). If // GrB_init is called with GrB_BLOCKING mode, the sort will always be @@ -497,7 +504,8 @@ GrB_Desc_Field ; typedef enum { // for all GrB_Descriptor fields: - GxB_DEFAULT = 0, // default behavior of the method + GrB_DEFAULT = 0, // default behavior of the method + GxB_DEFAULT = 0, // historical; use GrB_DEFAULT instead // for GrB_OUTP only: GrB_REPLACE = 1, // clear the output before assigning new values to it @@ -505,6 +513,7 @@ typedef enum // for GrB_MASK only: GrB_COMP = 2, // use the structural complement of the input GrB_STRUCTURE = 4, // use the only pattern of the mask, not its values + GrB_COMP_STRUCTURE = 6, // shorthand for GrB_COMP + GrB_STRUCTURE // for GrB_INP0 and GrB_INP1 only: GrB_TRAN = 3, // use the transpose of the input @@ -521,7 +530,7 @@ typedef enum GrB_Desc_Value ; // default for GxB pack is to trust the input data -#define GxB_FAST_IMPORT GxB_DEFAULT +#define GxB_FAST_IMPORT ((int) GrB_DEFAULT) typedef struct GB_Descriptor_opaque *GrB_Descriptor ; @@ -530,61 +539,15 @@ GrB_Info GrB_Descriptor_new // create a new descriptor GrB_Descriptor *descriptor // handle of descriptor to create ) ; -GrB_Info GrB_Descriptor_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - GrB_Desc_Field field, // parameter to change - GrB_Desc_Value val // value to change it to -) ; - -GrB_Info GxB_Descriptor_get // get a parameter from a descriptor -( - GrB_Desc_Value *val, // value of the parameter - GrB_Descriptor desc, // descriptor to query; NULL means defaults - GrB_Desc_Field field // parameter to query -) ; - -GrB_Info GxB_Desc_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - GrB_Desc_Field field, // parameter to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Desc_get // get a parameter from a descriptor -( - GrB_Descriptor desc, // descriptor to query; NULL means defaults - GrB_Desc_Field field, // parameter to query - ... // value of the parameter -) ; - -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 -) ; - -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 -) ; +// historical methods; use GrB_set and GrB_get instead: +GrB_Info GrB_Descriptor_set (GrB_Descriptor, GrB_Desc_Field, GrB_Desc_Value) ; +GrB_Info GxB_Descriptor_get (GrB_Desc_Value *, GrB_Descriptor, GrB_Desc_Field) ; +GrB_Info GxB_Desc_set (GrB_Descriptor, GrB_Desc_Field, ...) ; +GrB_Info GxB_Desc_set_INT32 (GrB_Descriptor, GrB_Desc_Field, int32_t) ; +GrB_Info GxB_Desc_set_FP64 (GrB_Descriptor, GrB_Desc_Field, double) ; +GrB_Info GxB_Desc_get (GrB_Descriptor, GrB_Desc_Field, ...) ; +GrB_Info GxB_Desc_get_INT32 (GrB_Descriptor, GrB_Desc_Field, int32_t *) ; +GrB_Info GxB_Desc_get_FP64 (GrB_Descriptor, GrB_Desc_Field, double *) ; GrB_Info GrB_Descriptor_free // free a descriptor ( @@ -731,32 +694,12 @@ GB_GLOBAL GrB_Type // GrB_Type_new: create a new type //------------------------------------------------------------------------------ -// GrB_Type_new is implemented both as a macro and a function. Both are -// user-callable. The default is to use the macro, since this allows the name -// of the type to be saved as a string, for subsequent error reporting by -// GrB_error. - -#undef GrB_Type_new -#undef GrM_Type_new - -GrB_Info GRB (Type_new) // create a new GraphBLAS type +GrB_Info GrB_Type_new // create a new GraphBLAS type ( GrB_Type *type, // handle of user type to create size_t sizeof_ctype // size = sizeof (ctype) of the C type ) ; -// user code should not directly use GB_STR or GB_XSTR -// GB_STR: convert the content of x into a string "x" -#define GB_XSTR(x) GB_STR(x) -#define GB_STR(x) #x - -// GrB_Type_new as a user-callable macro, which allows the name of the ctype -// to be added to the new type. The type_defn is unknown. -#define GrB_Type_new(utype, sizeof_ctype) \ - GxB_Type_new(utype, sizeof_ctype, GB_STR(sizeof_ctype), NULL) -#define GrM_Type_new(utype, sizeof_ctype) \ - GxB_Type_new(utype, sizeof_ctype, GB_STR(sizeof_ctype), NULL) - // GxB_Type_new creates a type with a name and definition that are known to // GraphBLAS, as strings. The type_name is any valid string (max length of 128 // characters, including the required null-terminating character) that may @@ -786,22 +729,16 @@ GrB_Info GxB_Type_new // create a new named GraphBLAS type const char *type_defn // typedef for the type (no max length) ) ; -GrB_Info GxB_Type_name // return the name of a GraphBLAS type -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Type type -) ; - -GrB_Info GxB_Type_size // determine the size of the type -( - size_t *size, // the sizeof the type - const GrB_Type type // type to determine the sizeof -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Type_name (char *type_name, const GrB_Type type) ; +GrB_Info GxB_Type_size (size_t *size, const GrB_Type type) ; GrB_Info GxB_Type_from_name // return the built-in GrB_Type from a name ( - GrB_Type *type, // built-in type, or NULL if user-defined + GrB_Type *type, // built-in type, or NULL if user-defined. + // The name can be the underlying C type + // ("int8_t") or the GraphBLAS name + // ("GrB_INT8"). const char *type_name // array of size at least GxB_MAX_NAME_LEN ) ; @@ -1006,23 +943,16 @@ GB_GLOBAL GrB_UnaryOp typedef void (*GxB_unary_function) (void *, const void *) ; -// GrB_UnaryOp_new creates a user-defined unary op, with an automatic -// detection of the operator name. -#undef GrB_UnaryOp_new -#undef GrM_UnaryOp_new -GrB_Info GRB (UnaryOp_new) // create a new user-defined unary operator +// GrB_UnaryOp_new creates a user-defined unary op (with no name or defn) +GrB_Info GrB_UnaryOp_new // create a new user-defined unary operator ( GrB_UnaryOp *unaryop, // handle for the new unary operator GxB_unary_function function, // pointer to the unary function GrB_Type ztype, // type of output z GrB_Type xtype // type of input x ) ; -#define GrB_UnaryOp_new(op,f,z,x) \ - GxB_UnaryOp_new(op,f,z,x, GB_STR(f), NULL) -#define GrM_UnaryOp_new(op,f,z,x) \ - GxM_UnaryOp_new(op,f,z,x, GB_STR(f), NULL) -// GxB_UnaryOp_new creates a named user-defined unary op. +// GxB_UnaryOp_new creates a named and defined user-defined unary op. GrB_Info GxB_UnaryOp_new // create a new user-defined unary operator ( GrB_UnaryOp *unaryop, // handle for the new unary operator @@ -1033,29 +963,11 @@ GrB_Info GxB_UnaryOp_new // create a new user-defined unary operator const char *unop_defn // definition of the user function ) ; -// GxB_UnaryOp_ztype is historical. Use GxB_UnaryOp_ztype_name instead. -GrB_Info GxB_UnaryOp_ztype // return the type of z -( - GrB_Type *ztype, // return type of output z - GrB_UnaryOp unaryop // unary operator -) ; -GrB_Info GxB_UnaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_UnaryOp unaryop // unary operator -) ; - -// GxB_UnaryOp_xtype is historical. Use GxB_UnaryOp_xtype_name instead. -GrB_Info GxB_UnaryOp_xtype // return the type of x -( - GrB_Type *xtype, // return type of input x - GrB_UnaryOp unaryop // unary operator -) ; -GrB_Info GxB_UnaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_UnaryOp unaryop // unary operator -) ; +// historical; use GrB_get instead: +GrB_Info GxB_UnaryOp_ztype (GrB_Type *ztype, GrB_UnaryOp unaryop) ; +GrB_Info GxB_UnaryOp_ztype_name (char *type_name, const GrB_UnaryOp unaryop) ; +GrB_Info GxB_UnaryOp_xtype (GrB_Type *xtype, GrB_UnaryOp unaryop) ; +GrB_Info GxB_UnaryOp_xtype_name (char *type_name, const GrB_UnaryOp unaryop) ; GrB_Info GrB_UnaryOp_free // free a user-created unary operator ( @@ -1467,11 +1379,8 @@ GB_GLOBAL GrB_BinaryOp GxB_IGNORE_DUP ; typedef void (*GxB_binary_function) (void *, const void *, const void *) ; -// GrB_BinaryOp_new creates a user-defined binary op, with an automatic -// detection of the operator name. -#undef GrB_BinaryOp_new -#undef GrM_BinaryOp_new -GrB_Info GRB (BinaryOp_new) +// GrB_BinaryOp_new creates a user-defined binary op (no name or defn) +GrB_Info GrB_BinaryOp_new ( GrB_BinaryOp *binaryop, // handle for the new binary operator GxB_binary_function function, // pointer to the binary function @@ -1479,12 +1388,8 @@ GrB_Info GRB (BinaryOp_new) GrB_Type xtype, // type of input x GrB_Type ytype // type of input y ) ; -#define GrB_BinaryOp_new(op,f,z,x,y) \ - GxB_BinaryOp_new(op,f,z,x,y, GB_STR(f), NULL) -#define GrM_BinaryOp_new(op,f,z,x,y) \ - GxM_BinaryOp_new(op,f,z,x,y, GB_STR(f), NULL) -// GxB_BinaryOp_new creates a named user-defined binary op. +// GxB_BinaryOp_new creates a named and defined user-defined binary op. GrB_Info GxB_BinaryOp_new ( GrB_BinaryOp *op, // handle for the new binary operator @@ -1496,41 +1401,13 @@ GrB_Info GxB_BinaryOp_new const char *binop_defn // definition of the user function ) ; -// NOTE: GxB_BinaryOp_ztype is historical. Use GxB_BinaryOp_ztype_name instead. -GrB_Info GxB_BinaryOp_ztype // return the type of z -( - GrB_Type *ztype, // return type of output z - GrB_BinaryOp binaryop // binary operator to query -) ; -GrB_Info GxB_BinaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; - -// NOTE: GxB_BinaryOp_xtype is historical. Use GxB_BinaryOp_xtype_name instead. -GrB_Info GxB_BinaryOp_xtype // return the type of x -( - GrB_Type *xtype, // return type of input x - GrB_BinaryOp binaryop // binary operator to query -) ; -GrB_Info GxB_BinaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; - -// NOTE: GxB_BinaryOp_ytype is historical. Use GxB_BinaryOp_ytype_name instead. -GrB_Info GxB_BinaryOp_ytype // return the type of y -( - GrB_Type *ytype, // return type of input y - GrB_BinaryOp binaryop // binary operator to query -) ; -GrB_Info GxB_BinaryOp_ytype_name // return the type_name of y -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_BinaryOp_ztype (GrB_Type *ztype, GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_ztype_name (char *type_name, const GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_xtype (GrB_Type *xtype, GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_xtype_name (char *type_name, const GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_ytype (GrB_Type *ytype, GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_ytype_name (char *type_name, const GrB_BinaryOp op) ; GrB_Info GrB_BinaryOp_free // free a user-created binary operator ( @@ -1541,8 +1418,7 @@ GrB_Info GrB_BinaryOp_free // free a user-created binary operator // GxB_SelectOp: select operators (DEPRECATED: do not use) //============================================================================== -// GrB_select and GrB_IndexUnaryOp should be used instead of GxB_select. - +// historical; use GrB_select and GrB_IndexUnaryOp instead: typedef struct GB_SelectOp_opaque *GxB_SelectOp ; GB_GLOBAL GxB_SelectOp GxB_TRIL, GxB_TRIU, GxB_DIAG, GxB_OFFDIAG, GxB_NONZERO, GxB_EQ_ZERO, GxB_GT_ZERO, GxB_GE_ZERO, GxB_LT_ZERO, GxB_LE_ZERO, GxB_NE_THUNK, @@ -1569,12 +1445,9 @@ typedef void (*GxB_index_unary_function) const void *y // input scalar y ) ; -// GrB_IndexUnaryOp_new creates a user-defined unary op, with an automatic -// detection of the operator name. -#undef GrB_IndexUnaryOp_new -#undef GrM_IndexUnaryOp_new +// GrB_IndexUnaryOp_new creates a user-defined unary op (no name or defn) -GrB_Info GRB (IndexUnaryOp_new) // create a new user-defined IndexUnary op +GrB_Info GrB_IndexUnaryOp_new // create a new user-defined IndexUnary op ( GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator GxB_index_unary_function function, // pointer to IndexUnary function @@ -1583,11 +1456,6 @@ GrB_Info GRB (IndexUnaryOp_new) // create a new user-defined IndexUnary op GrB_Type ytype // type of input y (the scalar) ) ; -#define GrB_IndexUnaryOp_new(op,f,z,x,y) \ - GxB_IndexUnaryOp_new(op,f,z,x,y, GB_STR(f), NULL) -#define GrM_IndexUnaryOp_new(op,f,z,x,y) \ - GxM_IndexUnaryOp_new(op,f,z,x,y, GB_STR(f), NULL) - GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp ( GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator @@ -1599,26 +1467,10 @@ GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp const char *idxop_defn // definition of the user function ) ; -GrB_Info GxB_IndexUnaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // IndexUnary operator -) ; - -// For TRIL, TRIU, DIAG, OFFDIAG, COLLE, COLGT, ROWLE, and ROWGT, -// the xtype_name is an empty string (""), since these functions do not depend -// on the type of the matrix input. -GrB_Info GxB_IndexUnaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // select operator -) ; - -GrB_Info GxB_IndexUnaryOp_ytype_name // return the type_name of the scalary y -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // select operator -) ; +// historical; use GrB_get instead: +GrB_Info GxB_IndexUnaryOp_ztype_name (char *, const GrB_IndexUnaryOp op) ; +GrB_Info GxB_IndexUnaryOp_xtype_name (char *, const GrB_IndexUnaryOp op) ; +GrB_Info GxB_IndexUnaryOp_ytype_name (char *, const GrB_IndexUnaryOp op) ; GrB_Info GrB_IndexUnaryOp_free // free a user-created IndexUnaryOp ( @@ -1820,14 +1672,12 @@ GrB_Info GrB_Monoid_new_UDT // create a monoid with a user-defined type // Type-generic method for creating a new monoid: /* - GrB_Info GrB_Monoid_new // create a monoid ( GrB_Monoid *monoid, // handle of monoid to create GrB_BinaryOp op, // binary operator of the monoid identity // identity value of the monoid ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -1960,7 +1810,6 @@ GrB_Info GxB_Monoid_terminal_new_UDT // create a monoid with a user type // Type-generic method for creating a new monoid with a terminal value: /* - GrB_Info GxB_Monoid_terminal_new // create a monoid ( GrB_Monoid *monoid, // handle of monoid to create @@ -1968,7 +1817,6 @@ GrB_Info GxB_Monoid_terminal_new // create a monoid identity, // identity value of the monoid terminal // terminal value of the monoid ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -1981,25 +1829,10 @@ GrB_Info GxB_Monoid_terminal_new // create a monoid (monoid, op, identity, terminal) #endif -GrB_Info GxB_Monoid_operator // return the monoid operator -( - GrB_BinaryOp *op, // returns the binary op of the monoid - GrB_Monoid monoid // monoid to query -) ; - -GrB_Info GxB_Monoid_identity // return the monoid identity -( - void *identity, // returns the identity of the monoid - GrB_Monoid monoid // monoid to query -) ; - -GrB_Info GxB_Monoid_terminal // return the monoid terminal -( - bool *has_terminal, // true if the monoid has a terminal value - void *terminal, // returns the terminal of the monoid, - // unmodified if has_terminal is false - GrB_Monoid monoid // monoid to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Monoid_operator (GrB_BinaryOp *op, GrB_Monoid monoid) ; +GrB_Info GxB_Monoid_identity (void *identity, GrB_Monoid monoid) ; +GrB_Info GxB_Monoid_terminal (bool *, void *terminal, GrB_Monoid monoid) ; GrB_Info GrB_Monoid_free // free a user-created monoid ( @@ -2019,17 +1852,9 @@ GrB_Info GrB_Semiring_new // create a semiring GrB_BinaryOp multiply // multiply operator of the semiring ) ; -GrB_Info GxB_Semiring_add // return the add monoid of a semiring -( - GrB_Monoid *add, // returns add monoid of the semiring - GrB_Semiring semiring // semiring to query -) ; - -GrB_Info GxB_Semiring_multiply // return multiply operator of a semiring -( - GrB_BinaryOp *multiply, // returns multiply operator of the semiring - GrB_Semiring semiring // semiring to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Semiring_add (GrB_Monoid *add, GrB_Semiring semiring) ; +GrB_Info GxB_Semiring_multiply (GrB_BinaryOp *multiply, GrB_Semiring semiring) ; GrB_Info GrB_Semiring_free // free a user-created semiring ( @@ -2040,9 +1865,6 @@ GrB_Info GrB_Semiring_free // free a user-created semiring // GrB_Scalar: a GraphBLAS scalar //============================================================================== -// GxB_Scalar has become GrB_Scalar. The older name GxB_Scalar is kept as -// historical, but GrB_Scalar should be used instead. - typedef struct GB_Scalar_opaque *GxB_Scalar ; // historical: use GrB_Scalar typedef struct GB_Scalar_opaque *GrB_Scalar ; // use this instead @@ -2072,18 +1894,9 @@ GrB_Info GrB_Scalar_nvals // get the number of entries in a GrB_Scalar const GrB_Scalar s // GrB_Scalar to query ) ; -// NOTE: GxB_Scalar_type is historical. Use GxB_Scalar_type_name instead. -GrB_Info GxB_Scalar_type // get the type of a GrB_Scalar -( - GrB_Type *type, // returns the type of the GrB_Scalar - const GrB_Scalar s // GrB_Scalar to query -) ; -GrB_Info GxB_Scalar_type_name // return the name of the type of a scalar -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Scalar s // GrB_Scalar to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Scalar_type (GrB_Type *type, const GrB_Scalar s) ; +GrB_Info GxB_Scalar_type_name (char *type_name, const GrB_Scalar s) ; GrB_Info GxB_Scalar_memoryUsage // return # of bytes used for a scalar ( @@ -2212,13 +2025,11 @@ GrB_Info GxB_Scalar_setElement_UDT (GrB_Scalar s, void *x) ; // user-defined type. /* - GrB_Info GrB_Scalar_setElement // s = x ( GrB_Scalar s, // GrB_Scalar to modify x // user scalar to assign to s ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -2230,6 +2041,7 @@ GrB_Info GrB_Scalar_setElement // s = x ) \ (s, x) +// historical; use GrB_Scalar_setElement instead: #define GxB_Scalar_setElement(s,x) GrB_Scalar_setElement (s, x) #endif @@ -2360,6 +2172,7 @@ GrB_Info GrB_Scalar_extractElement // x = s ) \ (x, s) +// historical; use GrB_Scalar_extractElement instead: #define GxB_Scalar_extractElement(x,s) GrB_Scalar_extractElement (x, s) #endif @@ -2403,18 +2216,9 @@ GrB_Info GrB_Vector_nvals // get the number of entries in a vector const GrB_Vector v // vector to query ) ; -// NOTE: GxB_Vector_type is historical. Use GxB_Vector_type_name instead. -GrB_Info GxB_Vector_type // get the type of a vector -( - GrB_Type *type, // returns the type of the vector - const GrB_Vector v // vector to query -) ; -GrB_Info GxB_Vector_type_name // return the name of the type of a vector -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Vector v // vector to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Vector_type (GrB_Type *type, const GrB_Vector v) ; +GrB_Info GxB_Vector_type_name (char *type_name, const GrB_Vector v) ; GrB_Info GxB_Vector_memoryUsage // return # of bytes used for a vector ( @@ -2578,7 +2382,6 @@ GrB_Info GxB_Vector_build_Scalar // build a vector from (i,scalar) tuples // for a user-defined type. /* - GrB_Info GrB_Vector_build // build a vector from (I,X) tuples ( GrB_Vector w, // vector to build @@ -2587,7 +2390,6 @@ GrB_Info GrB_Vector_build // build a vector from (I,X) tuples GrB_Index nvals, // number of tuples const GrB_BinaryOp dup // binary function to assemble duplicates ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -2716,14 +2518,12 @@ GrB_Info GrB_Vector_setElement_Scalar // w(i) = x // user-defined type. /* - GrB_Info GrB_Vector_setElement // w(i) = x ( GrB_Vector w, // vector to modify x, // scalar to assign to w(i) GrB_Index i // row index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -2853,14 +2653,12 @@ GrB_Info GrB_Vector_extractElement_Scalar // x = v(i) // for a user-defined type. /* - GrB_Info GrB_Vector_extractElement // x = v(i) ( *x, // scalar extracted const GrB_Vector v, // vector to extract an entry from GrB_Index i // row index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3021,7 +2819,6 @@ GrB_Info GrB_Vector_extractTuples_UDT // [I,~,X] = find (v) // for a user-defined type. /* - GrB_Info GrB_Vector_extractTuples // [I,~,X] = find (v) ( GrB_Index *Ilist, // array for returning row indices of tuples @@ -3029,11 +2826,10 @@ GrB_Info GrB_Vector_extractTuples // [I,~,X] = find (v) GrB_Index *nvals, // I, X size on input; # tuples on output const GrB_Vector v // vector to extract tuples from ) ; - */ #if GxB_STDC_VERSION >= 201112L -#define GrB_Vector_extractTuples(Ilist,X,nvals,v) \ +#define GrB_Vector_extractTuples(Ilist,X,nvals,v) \ _Generic \ ( \ (X), \ @@ -3088,18 +2884,9 @@ GrB_Info GrB_Matrix_nvals // get the number of entries in a matrix const GrB_Matrix A // matrix to query ) ; -// NOTE: GxB_Matrix_type is historical. Use GxB_Matrix_type_name instead. -GrB_Info GxB_Matrix_type // get the type of a matrix -( - GrB_Type *type, // returns the type of the matrix - const GrB_Matrix A // matrix to query -) ; -GrB_Info GxB_Matrix_type_name // return the name of the type of a matrix -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Matrix A // matrix to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Matrix_type (GrB_Type *type, const GrB_Matrix A) ; +GrB_Info GxB_Matrix_type_name (char *type_name, const GrB_Matrix A) ; GrB_Info GxB_Matrix_memoryUsage // return # of bytes used for a matrix ( @@ -3128,7 +2915,7 @@ GrB_Info GrB_Matrix_free // free a matrix GrB_Info GrB_Matrix_build_BOOL // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const bool *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3138,7 +2925,7 @@ GrB_Info GrB_Matrix_build_BOOL // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT8 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int8_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3148,7 +2935,7 @@ GrB_Info GrB_Matrix_build_INT8 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT8 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint8_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3158,7 +2945,7 @@ GrB_Info GrB_Matrix_build_UINT8 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT16 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int16_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3168,7 +2955,7 @@ GrB_Info GrB_Matrix_build_INT16 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT16 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint16_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3178,7 +2965,7 @@ GrB_Info GrB_Matrix_build_UINT16 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int32_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3188,7 +2975,7 @@ GrB_Info GrB_Matrix_build_INT32 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint32_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3198,7 +2985,7 @@ GrB_Info GrB_Matrix_build_UINT32 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int64_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3208,7 +2995,7 @@ GrB_Info GrB_Matrix_build_INT64 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint64_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3218,7 +3005,7 @@ GrB_Info GrB_Matrix_build_UINT64 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_FP32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const float *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3228,7 +3015,7 @@ GrB_Info GrB_Matrix_build_FP32 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_FP64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const double *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3238,7 +3025,7 @@ GrB_Info GrB_Matrix_build_FP64 // build a matrix from (I,J,X) tuples GrB_Info GxB_Matrix_build_FC32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const GxB_FC32_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3248,7 +3035,7 @@ GrB_Info GxB_Matrix_build_FC32 // build a matrix from (I,J,X) tuples GrB_Info GxB_Matrix_build_FC64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const GxB_FC64_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3258,7 +3045,7 @@ GrB_Info GxB_Matrix_build_FC64 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UDT // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const void *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3268,7 +3055,7 @@ GrB_Info GrB_Matrix_build_UDT // build a matrix from (I,J,X) tuples GrB_Info GxB_Matrix_build_Scalar // build a matrix from (I,J,scalar) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples GrB_Scalar scalar, // value for all tuples GrB_Index nvals // number of tuples @@ -3278,21 +3065,19 @@ GrB_Info GxB_Matrix_build_Scalar // build a matrix from (I,J,scalar) tuples // for a user-defined type. /* - GrB_Info GrB_Matrix_build // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const *X, // array of values of tuples GrB_Index nvals, // number of tuples const GrB_BinaryOp dup // binary function to assemble duplicates ) ; - */ #if GxB_STDC_VERSION >= 201112L -#define GrB_Matrix_build(C,Ilist,J,X,nvals,dup) \ +#define GrB_Matrix_build(C,Ilist,J,X,nvals,dup) \ _Generic \ ( \ (X), \ @@ -3432,7 +3217,6 @@ GrB_Info GrB_Matrix_setElement_Scalar // C (i,j) = x // user-defined type. /* - GrB_Info GrB_Matrix_setElement // C (i,j) = x ( GrB_Matrix C, // matrix to modify @@ -3440,7 +3224,6 @@ GrB_Info GrB_Matrix_setElement // C (i,j) = x GrB_Index i, // row index GrB_Index j // column index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3585,7 +3368,6 @@ GrB_Info GrB_Matrix_extractElement_Scalar // x = A(i,j) // for a user-defined type. /* - GrB_Info GrB_Matrix_extractElement // x = A(i,j) ( *x, // extracted scalar @@ -3593,7 +3375,6 @@ GrB_Info GrB_Matrix_extractElement // x = A(i,j) GrB_Index i, // row index GrB_Index j // column index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3770,7 +3551,6 @@ GrB_Info GrB_Matrix_extractTuples_UDT // [I,J,X] = find (A) // for a user-defined type. /* - GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A) ( GrB_Index *Ilist, // array for returning row indices of tuples @@ -3779,7 +3559,6 @@ GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A) GrB_Index *nvals, // I,J,X size on input; # tuples on output const GrB_Matrix A // matrix to extract tuples from ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3819,7 +3598,7 @@ GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A) // ncols(A{i,j}) for all i). // The type of C is unchanged, and all matrices A{i,j} are typecasted into the -// type of C. Any settings made to C by GxB_Matrix_Option_set (format by row +// type of C. Any settings made to C by GrB_set (format by row // or by column, bitmap switch, hyper switch, and sparsity control) are // unchanged. @@ -3877,7 +3656,7 @@ GrB_Info GrB_Matrix_diag // build a diagonal matrix from a vector // already exist on input, of the correct size. Any existing entries in C are // discarded. The type of C is preserved, so that if the type of C and v // differ, the entries are typecasted into the type of C. Any settings made to -// C by GxB_Matrix_Option_set (format by row or by column, bitmap switch, hyper +// C by GrB_set (format by row or by column, bitmap switch, hyper // switch, and sparsity control) are unchanged. GrB_Info GxB_Matrix_diag // construct a diagonal matrix from a vector @@ -3902,7 +3681,7 @@ GrB_Info GxB_Matrix_diag // construct a diagonal matrix from a vector // the range -1 to -m+1. Any existing entries in v are discarded. The type of // v is preserved, so that if the type of A and v differ, the entries are // typecasted into the type of v. Any settings made to v by -// GxB_Vector_Option_set (bitmap switch and sparsity control) are unchanged. +// GrB_set (bitmap switch and sparsity control) are unchanged. GrB_Info GxB_Vector_diag // extract a diagonal from a matrix, as a vector ( @@ -3917,60 +3696,58 @@ GrB_Info GxB_Vector_diag // extract a diagonal from a matrix, as a vector //============================================================================== // The following options modify how SuiteSparse:GraphBLAS stores and operates -// on its matrices. The GxB_*Option* methods allow the user to suggest how the +// on its matrices. The GrB_get/set methods allow the user to suggest how the // internal representation of a matrix, or all matrices, should be held. These // options have no effect on the result (except for minor roundoff differences // for floating-point types). They only affect the time and memory usage of the // computations. -// GxB_Matrix_Option_set: sets an option for a specific matrix -// GxB_Matrix_Option_get: queries the current option of a specific matrix -// GxB_Vector_Option_set: sets an option for a specific vector -// GxB_Vector_Option_get: queries the current option of a specific vector -// GxB_Global_Option_set: sets an option for all future matrices -// GxB_Global_Option_get: queries current option for all future matrices - typedef enum // for global options or matrix options { //------------------------------------------------------------ - // for GxB_Matrix_Option_get/set and GxB_Global_Option_get/set: + // GrB_get / GrB_set for GrB_Matrix and GrB_GLOBAL: //------------------------------------------------------------ GxB_HYPER_SWITCH = 7000, // switch to hypersparse (double value) + GxB_HYPER_HASH = 7048, // hyper_hash control (int64 value) GxB_BITMAP_SWITCH = 7001, // switch to bitmap (double value) - GxB_FORMAT = 7002, // CSR/CSC format: GxB_BY_ROW or GxB_BY_COL + GxB_FORMAT = 7002, // historical; use GrB_STORAGE_ORIENTATION_HINT //------------------------------------------------------------ - // for GxB_Global_Option_get only: + // GrB_get for GrB_GLOBAL: //------------------------------------------------------------ - GxB_MODE = 7003, // mode passed to GrB_init - GxB_LIBRARY_NAME = 7004, // name of the library (char *) - GxB_LIBRARY_VERSION = 7005, // library version (3 int's) + GxB_MODE = 7003, // historical; use GrB_BLOCKING_MODE + GxB_LIBRARY_NAME = 7004, // historical; use GrB_NAME + GxB_LIBRARY_VERSION = 7005, // historical; use GrB_LIBRARY_VER_* GxB_LIBRARY_DATE = 7006, // date of the library (char *) GxB_LIBRARY_ABOUT = 7007, // about the library (char *) GxB_LIBRARY_URL = 7008, // URL for the library (char *) GxB_LIBRARY_LICENSE = 7009, // license of the library (char *) GxB_LIBRARY_COMPILE_DATE = 7010, // date library was compiled (char *) GxB_LIBRARY_COMPILE_TIME = 7011, // time library was compiled (char *) - GxB_API_VERSION = 7012, // API version (3 int's) + GxB_API_VERSION = 7012, // historical; use GrB_API_VER_* GxB_API_DATE = 7013, // date of the API (char *) GxB_API_ABOUT = 7014, // about the API (char *) GxB_API_URL = 7015, // URL for the API (char *) GxB_COMPILER_VERSION = 7016, // compiler version (3 int's) GxB_COMPILER_NAME = 7017, // compiler name (char *) GxB_LIBRARY_OPENMP = 7018, // library compiled with OpenMP + GxB_MALLOC_FUNCTION = 7037, // malloc function pointer + GxB_CALLOC_FUNCTION = 7038, // calloc function pointer + GxB_REALLOC_FUNCTION = 7039, // realloc function pointer + GxB_FREE_FUNCTION = 7040, // free function pointer //------------------------------------------------------------ - // for GxB_Global_Option_get/set only: + // GrB_get / GrB_set for GrB_GLOBAL: //------------------------------------------------------------ GxB_GLOBAL_NTHREADS = GxB_NTHREADS, // max number of threads to use GxB_GLOBAL_CHUNK = GxB_CHUNK, // chunk size for small problems. GxB_GLOBAL_GPU_ID = GxB_GPU_ID, // which GPU to use (DRAFT) - GxB_BURBLE = 7019, // diagnostic output (bool *) + GxB_BURBLE = 7019, // diagnostic output GxB_PRINTF = 7020, // printf function diagnostic output GxB_FLUSH = 7021, // flush function diagnostic output GxB_MEMORY_POOL = 7022, // no longer used @@ -3988,27 +3765,18 @@ typedef enum // for global options or matrix options GxB_JIT_ERROR_LOG = 7033, // CPU JIT: error log file //------------------------------------------------------------ - // for GxB_Matrix_Option_get only: + // GrB_get for GrB_Matrix: //------------------------------------------------------------ GxB_SPARSITY_STATUS = 7034, // hyper, sparse, bitmap or full (1,2,4,8) GxB_IS_HYPER = 7035, // historical; use GxB_SPARSITY_STATUS //------------------------------------------------------------ - // for GxB_Matrix_Option_get/set only: + // GrB_get/GrB_set for GrB_Matrix: //------------------------------------------------------------ GxB_SPARSITY_CONTROL = 7036, // sparsity control: 0 to 15; see below - //------------------------------------------------------------ - // memory functions (GxB_Global_Option_get only): - //------------------------------------------------------------ - - GxB_MALLOC_FUNCTION = 7037, - GxB_CALLOC_FUNCTION = 7038, - GxB_REALLOC_FUNCTION = 7039, - GxB_FREE_FUNCTION = 7040, - } GxB_Option_Field ; // for GxB_JIT_C_CONTROL: @@ -4022,7 +3790,7 @@ typedef enum } GxB_JIT_Control ; -// GxB_FORMAT can be by row or by column: +// GxB_FORMAT is historical, but it can be by row or by column: typedef enum { GxB_BY_ROW = 0, // CSR: compressed sparse row format @@ -4055,7 +3823,7 @@ GB_GLOBAL const double GxB_HYPER_DEFAULT ; // the default sparsity control is any format: #define GxB_AUTO_SPARSITY GxB_ANY_SPARSITY -// GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, scontrol) provides hints +// GrB_set (A, scontrol, GxB_SPARSITY_CONTROL) provides hints // about which data structure GraphBLAS should use for the matrix A: // // GxB_AUTO_SPARSITY: GraphBLAS selects automatically. @@ -4078,11 +3846,11 @@ GB_GLOBAL const double GxB_HYPER_DEFAULT ; // formats can be bitwise negated. For example, to allow for any format // except full, use ~GxB_FULL. // -// GxB_Matrix_Option_get (A, GxB_SPARSITY_STATUS, &sparsity) returns the +// GrB_get (A, &sparsity, GxB_SPARSITY_STATUS) returns the // current data structure currently used for the matrix A (either hypersparse, // sparse, bitmap, or full). // -// GxB_Matrix_Option_get (A, GxB_SPARSITY_CONTROL, &scontrol) returns the hint +// GrB_get (A, &scontrol, GxB_SPARSITY_CONTROL) returns the hint // for how A should be stored (hypersparse, sparse, bitmap, or full, or any // combination). @@ -4113,183 +3881,6 @@ GB_GLOBAL const double GxB_HYPER_DEFAULT ; GB_GLOBAL const double GxB_ALWAYS_HYPER, GxB_NEVER_HYPER ; -GrB_Info GxB_Matrix_Option_set // set an option in a matrix -( - GrB_Matrix A, // matrix to modify - GxB_Option_Field field, // option to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix -( - GrB_Matrix A, // matrix to query - GxB_Option_Field field, // option to query - ... // return value of the matrix option -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Vector_Option_set // set an option in a vector -( - GrB_Vector A, // vector to modify - GxB_Option_Field field, // option to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Vector_Option_get // gets the current option of a vector -( - GrB_Vector A, // vector to query - GxB_Option_Field field, // option to query - ... // return value of the vector option -) ; - -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 -) ; - -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: -// -// GxB_Global_Option_set (GxB_HYPER_SWITCH, GxB_HYPER_DEFAULT) ; -// GxB_Global_Option_set (GxB_BITMAP_SWITCH, NULL) ; -// GxB_Global_Option_set (GxB_FORMAT, GxB_FORMAT_DEFAULT) ; -// -// The compile-time constants GxB_HYPER_DEFAULT and GxB_FORMAT_DEFAULT are -// equal to 0.0625 and GxB_BY_ROW, by default. That is, by default, all new -// matrices are held by row in CSR format. If a matrix has fewer than n/16 -// columns, it can be converted to hypersparse structure. If it has more than -// n/8 columns, it can be converted to a sparse structure. Modifying these -// global settings via GxB_Global_Option_set has no effect on matrices already -// created. - -GrB_Info GxB_Global_Option_set // set a global default option -( - GxB_Option_Field field, // option to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Global_Option_set_CHAR // set a global default option -( - GxB_Option_Field field, // option to change - const char *value // value to change it to -) ; - -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 -) ; - -GrB_Info GxB_Global_Option_get // gets the current global default option -( - GxB_Option_Field field, // option to query - ... // return value of the global option -) ; - -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 -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Global_Option_get_CHAR // gets the current global option -( - GxB_Option_Field field, // option to query - const char **value // return value of the global option -) ; - -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_Context: for managing computational resources //============================================================================== @@ -4322,48 +3913,6 @@ GrB_Info GxB_Context_free // free a Context GxB_Context *Context // handle of Context to free ) ; -GrB_Info GxB_Context_set_INT32 // set a parameter in a Context -( - GxB_Context Context, // Context to modify - GxB_Context_Field field, // parameter to change - int32_t value // value to change it to -) ; - -GrB_Info GxB_Context_set_FP64 // set a parameter in a Context -( - GxB_Context Context, // Context to modify - GxB_Context_Field field, // parameter to change - double value // value to change it to -) ; - -GrB_Info GxB_Context_set // set a parameter in a Context -( - GxB_Context Context, // Context to modify - GxB_Context_Field field, // parameter to change - ... // value to change it to -) ; - -GrB_Info GxB_Context_get_INT32 // get a parameter of a Context -( - GxB_Context Context, // Context to query - GxB_Context_Field field, // parameter to query - int32_t *value // return value from the Context -) ; - -GrB_Info GxB_Context_get_FP64 // get a parameter in a Context -( - GxB_Context Context, // Context to query - GxB_Context_Field field, // parameter to query - double *value // return value from the Context -) ; - -GrB_Info GxB_Context_get // get a parameter in a Context -( - GxB_Context Context, // Context to query - GxB_Context_Field field, // parameter to query - ... // return value of the descriptor -) ; - GrB_Info GxB_Context_engage // engage a Context ( GxB_Context Context // Context to engage @@ -4375,152 +3924,41 @@ GrB_Info GxB_Context_disengage // disengage a Context ) ; //============================================================================== -// GxB_set and GxB_get +// GxB_set and GxB_get: historical; use GrB_set and GrB_get instead //============================================================================== -// The simplest way to set/get a value of a GrB_Descriptor is with -// the generic GxB_set and GxB_get functions: - -// GxB_set (desc, field, value) ; -// GxB_get (desc, field, &value) ; - -// GxB_set and GxB_get are generic methods that and set or query the options in -// a GrB_Matrix, a GrB_Descriptor, or in the global options. They can be used -// with the following syntax. - -// To set/get the global options: -// -// GxB_set (GxB_HYPER_SWITCH, double h) ; -// GxB_set (GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ; -// GxB_set (GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; -// GxB_get (GxB_HYPER_SWITCH, double *h) ; -// -// double b [GxB_NBITMAP_SWITCH] ; -// GxB_set (GxB_BITMAP_SWITCH, b) ; -// GxB_set (GxB_BITMAP_SWITCH, NULL) ; // set defaults -// GxB_get (GxB_BITMAP_SWITCH, b) ; -// -// GxB_set (GxB_FORMAT, GxB_BY_ROW) ; -// GxB_set (GxB_FORMAT, GxB_BY_COL) ; -// GxB_get (GxB_FORMAT, GxB_Format_Value *s) ; -// -// GxB_set (GxB_NTHREADS, nthreads_max) ; -// GxB_get (GxB_NTHREADS, int *nthreads_max) ; -// -// GxB_set (GxB_CHUNK, double chunk) ; -// GxB_get (GxB_CHUNK, double *chunk) ; -// -// GxB_set (GxB_BURBLE, bool burble) ; -// GxB_get (GxB_BURBLE, bool *burble) ; -// -// GxB_set (GxB_PRINTF, void *printf_function) ; -// GxB_get (GxB_PRINTF, void **printf_function) ; -// -// GxB_set (GxB_FLUSH, void *flush_function) ; -// GxB_get (GxB_FLUSH, void **flush_function) ; - -// GxB_set (GxB_JIT_C_COMPILER_NAME, const char *compiler) ; -// GxB_get (GxB_JIT_C_COMPILER_NAME, const char **compiler) ; -// GxB_set (GxB_JIT_C_COMPILER_FLAGS, const char *flags) ; -// GxB_get (GxB_JIT_C_COMPILER_FLAGS, const char **flags) ; -// GxB_set (GxB_JIT_C_LINKER_FLAGS, const char *flags) ; -// GxB_get (GxB_JIT_C_LINKER_FLAGS, const char **flags) ; -// GxB_set (GxB_JIT_CACHE_PATH, const char *cache_path) ; -// GxB_get (GxB_JIT_CACHE_PATH, const char **cache_path) ; -// GxB_set (GxB_JIT_C_CONTROL, int control) ; -// GxB_get (GxB_JIT_C_CONTROL, int *control) ; - -// To set/get the GxB_CONTEXT_WORLD options: These have the same effect as -// the global set/get for NTHREADS and CHUNK, listed above. -// -// GxB_set (GxB_CONTEXT_WORLD, GxB_NTHREADS, nthreads_max) ; -// GxB_get (GxB_CONTEXT_WORLD, GxB_NTHREADS, int *nthreads_max) ; -// -// GxB_set (GxB_CONTEXT_WORLD, GxB_CHUNK, double chunk) ; -// GxB_get (GxB_CONTEXT_WORLD, GxB_CHUNK, double *chunk) ; - -// To set/get a Context option: -// -// GxB_set (GxB_Context Context, GxB_NTHREADS, nthreads_max) ; -// GxB_get (GxB_Context Context, GxB_NTHREADS, int *nthreads_max) ; -// -// GxB_set (GxB_Context Context, GxB_CHUNK, double chunk) ; -// GxB_get (GxB_Context Context, GxB_CHUNK, double *chunk) ; - -// To get global options that can be queried but not modified: -// -// GxB_get (GxB_MODE, GrB_Mode *mode) ; - -// To set/get a matrix option: -// -// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, double h) ; -// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ; -// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; -// GxB_get (GrB_Matrix A, GxB_HYPER_SWITCH, double *h) ; -// -// GxB_set (GrB_Matrix A, GxB_BITMAP_SWITCH, double b) ; -// GxB_get (GrB_Matrix A, GxB_BITMAP_SWITCH, double *b) ; -// -// GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_ROW) ; -// GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_COL) ; -// GxB_get (GrB_Matrix A, GxB_FORMAT, GxB_Format_Value *s) ; -// -// GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ; -// GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, scontrol) ; -// GxB_get (GrB_Matrix A, GxB_SPARSITY_CONTROL, int *scontrol) ; -// -// GxB_get (GrB_Matrix A, GxB_SPARSITY_STATUS, int *sparsity) ; - -// To set/get a vector option or status: -// -// GxB_set (GrB_Vector v, GxB_BITMAP_SWITCH, double b) ; -// GxB_get (GrB_Vector v, GxB_BITMAP_SWITCH, double *b) ; -// -// GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_ROW) ; -// GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_COL) ; -// GxB_get (GrB_Vector v, GxB_FORMAT, GxB_Format_Value *s) ; -// -// GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ; -// GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, scontrol) ; -// GxB_get (GrB_Vector v, GxB_SPARSITY_CONTROL, int *scontrol) ; -// -// GxB_get (GrB_Vector v, GxB_SPARSITY_STATUS, int *sparsity) ; - -// To set/get a descriptor field: -// -// GxB_set (GrB_Descriptor d, GrB_OUTP, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_OUTP, GrB_REPLACE) ; -// GxB_get (GrB_Descriptor d, GrB_OUTP, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GrB_MASK, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP) ; -// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_STRUCTURE) ; -// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP + GrB_STRUCTURE) ; -// GxB_get (GrB_Descriptor d, GrB_MASK, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GrB_INP0, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_INP0, GrB_TRAN) ; -// GxB_get (GrB_Descriptor d, GrB_INP0, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GrB_INP1, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_INP1, GrB_TRAN) ; -// GxB_get (GrB_Descriptor d, GrB_INP1, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_GUSTAVSON) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_HASH) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_SAXPY) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_DOT) ; -// GxB_get (GrB_Descriptor d, GrB_AxB_METHOD, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GxB_SORT, int sort) ; -// GxB_get (GrB_Descriptor d, GxB_SORT, int *sort) ; -// -// GxB_set (GrB_Descriptor d, GxB_COMPRESSION, int method) ; -// GxB_get (GrB_Descriptor d, GxB_COMPRESSION, int *method) ; -// -// GxB_set (GrB_Descriptor d, GxB_IMPORT, int method) ; -// GxB_get (GrB_Descriptor d, GxB_IMPORT, int *method) ; +// historical: use GrB_set and GrB_get instead of these methods: +GrB_Info GxB_Matrix_Option_set (GrB_Matrix, GxB_Option_Field, ...) ; +GrB_Info GxB_Matrix_Option_set_INT32 (GrB_Matrix, GxB_Option_Field, int32_t) ; +GrB_Info GxB_Matrix_Option_set_FP64 (GrB_Matrix, GxB_Option_Field, double) ; +GrB_Info GxB_Matrix_Option_get (GrB_Matrix, GxB_Option_Field, ...) ; +GrB_Info GxB_Matrix_Option_get_INT32 (GrB_Matrix, GxB_Option_Field, int32_t *) ; +GrB_Info GxB_Matrix_Option_get_FP64 (GrB_Matrix, GxB_Option_Field, double *) ; +GrB_Info GxB_Vector_Option_set (GrB_Vector, GxB_Option_Field, ...) ; +GrB_Info GxB_Vector_Option_set_INT32 (GrB_Vector, GxB_Option_Field, int32_t) ; +GrB_Info GxB_Vector_Option_set_FP64 (GrB_Vector, GxB_Option_Field, double) ; +GrB_Info GxB_Vector_Option_get (GrB_Vector, GxB_Option_Field, ...) ; +GrB_Info GxB_Vector_Option_get_INT32 (GrB_Vector, GxB_Option_Field, int32_t *) ; +GrB_Info GxB_Vector_Option_get_FP64 (GrB_Vector, GxB_Option_Field, double *) ; +GrB_Info GxB_Global_Option_set (GxB_Option_Field, ...) ; +GrB_Info GxB_Global_Option_set_INT32 (GxB_Option_Field, int32_t) ; +GrB_Info GxB_Global_Option_set_FP64 (GxB_Option_Field, double) ; +GrB_Info GxB_Global_Option_set_FP64_ARRAY (GxB_Option_Field, double *) ; +GrB_Info GxB_Global_Option_set_INT64_ARRAY (GxB_Option_Field, int64_t *) ; +GrB_Info GxB_Global_Option_set_CHAR (GxB_Option_Field, const char *) ; +GrB_Info GxB_Global_Option_set_FUNCTION (GxB_Option_Field, void *) ; +GrB_Info GxB_Global_Option_get (GxB_Option_Field, ...) ; +GrB_Info GxB_Global_Option_get_INT32 (GxB_Option_Field, int32_t *) ; +GrB_Info GxB_Global_Option_get_FP64 (GxB_Option_Field, double *) ; +GrB_Info GxB_Global_Option_get_INT64 (GxB_Option_Field, int64_t *) ; +GrB_Info GxB_Global_Option_get_CHAR (GxB_Option_Field, const char **) ; +GrB_Info GxB_Global_Option_get_FUNCTION (GxB_Option_Field, void **) ; +GrB_Info GxB_Context_set_INT32 (GxB_Context, GxB_Context_Field, int32_t) ; +GrB_Info GxB_Context_set_FP64 (GxB_Context, GxB_Context_Field, double) ; +GrB_Info GxB_Context_set (GxB_Context, GxB_Context_Field, ...) ; +GrB_Info GxB_Context_get_INT32 (GxB_Context, GxB_Context_Field, int32_t *) ; +GrB_Info GxB_Context_get_FP64 (GxB_Context, GxB_Context_Field, double *) ; +GrB_Info GxB_Context_get (GxB_Context, GxB_Context_Field, ...) ; #if GxB_STDC_VERSION >= 201112L #define GxB_set(arg1,...) \ @@ -4550,6 +3988,518 @@ GrB_Info GxB_Context_disengage // disengage a Context (arg1, __VA_ARGS__) #endif +//============================================================================== +// GrB_set and GrB_get +//============================================================================== + +typedef struct GB_Global_opaque *GrB_Global ; +GB_GLOBAL const GrB_Global GrB_GLOBAL ; + +typedef enum +{ + + //-------------------------------------------------------------------------- + // GrB enums in the C API + //-------------------------------------------------------------------------- + + // GrB_Descriptor only: + GrB_OUTP_FIELD = 0, // descriptor for output of a method + GrB_MASK_FIELD = 1, // descriptor for the mask input of a method + GrB_INP0_FIELD = 2, // descriptor for the first input of a method + GrB_INP1_FIELD = 3, // descriptor for the second input of a method + + // all objects, including GrB_GLOBAL: + GrB_NAME = 10, // name of the object, as a string + + // GrB_GLOBAL only: + GrB_LIBRARY_VER_MAJOR = 11, // SuiteSparse:GraphBLAS version + GrB_LIBRARY_VER_MINOR = 12, + GrB_LIBRARY_VER_PATCH = 13, + GrB_API_VER_MAJOR = 14, // C API version + GrB_API_VER_MINOR = 15, + GrB_API_VER_PATCH = 16, + GrB_BLOCKING_MODE = 17, // GrB_Mode + + // GrB_GLOBAL, GrB_Matrix, GrB_Vector, GrB_Scalar: + GrB_STORAGE_ORIENTATION_HINT = 100, // GrB_Orientation + + // GrB_Matrix, GrB_Vector, GrB_Scalar (and void * serialize): + GrB_EL_TYPE_CODE = 102, // a GrB_Type_code (see below) + GrB_EL_TYPE_STRING = 106, // name of the type + + // GrB_*Op, GrB_Monoid, and GrB_Semiring: + GrB_INP0_TYPE_CODE = 103, // GrB_Type_code + GrB_INP1_TYPE_CODE = 104, + GrB_OUTP_TYPE_CODE = 105, + GrB_INP0_TYPE_STRING = 107, // name of the type, as a string + GrB_INP1_TYPE_STRING = 108, + GrB_OUTP_TYPE_STRING = 109, + + // GrB_Type (readable only): + GrB_SIZE = 110, // size of the type + + //-------------------------------------------------------------------------- + // SuiteSparse extensions: + //-------------------------------------------------------------------------- + + // GrB_Type, GrB_UnaryOp, GrB_BinaryOp, and GrB_IndexUnaryOp: + GxB_JIT_C_NAME = 7041, // C type or function name + GxB_JIT_C_DEFINITION = 7042, // C typedef or function definition + + // GrB_Monoid and GrB_Semiring: + GxB_MONOID_IDENTITY = 7043, // monoid identity value + GxB_MONOID_TERMINAL = 7044, // monoid terminal value + GxB_MONOID_OPERATOR = 7045, // monoid binary operator + + // GrB_Semiring only: + GxB_SEMIRING_MONOID = 7046, // semiring monoid + GxB_SEMIRING_MULTIPLY = 7047, // semiring multiplicative op +} +GrB_Field ; + +typedef enum +{ + GrB_ROWMAJOR = 0, + GrB_COLMAJOR = 1, + GrB_BOTH = 2, + GrB_UNKNOWN = 3, +} +GrB_Orientation ; + +typedef enum +{ + GrB_UDT_CODE = 0, // user-defined type + GrB_BOOL_CODE = 1, // GraphBLAS: GrB_BOOL C: bool + GrB_INT8_CODE = 2, // GraphBLAS: GrB_INT8 C: int8_t + GrB_UINT8_CODE = 3, // GraphBLAS: GrB_UINT8 C: uint8_t + GrB_INT16_CODE = 4, // GraphBLAS: GrB_INT16 C: int16_t + GrB_UINT16_CODE = 5, // GraphBLAS: GrB_UINT16 C: uint16_t + GrB_INT32_CODE = 6, // GraphBLAS: GrB_INT32 C: int32_t + GrB_UINT32_CODE = 7, // GraphBLAS: GrB_UINT32 C: uint32_t + GrB_INT64_CODE = 8, // GraphBLAS: GrB_INT64 C: int64_t + GrB_UINT64_CODE = 9, // GraphBLAS: GrB_UINT64 C: uint64_t + GrB_FP32_CODE = 10, // GraphBLAS: GrB_FP32 C: float + GrB_FP64_CODE = 11, // GraphBLAS: GrB_FP64 C: double + GxB_FC32_CODE = 7070, // GraphBLAS: GxB_FC32 C: float complex + GxB_FC64_CODE = 7071, // GraphBLAS: GxB_FC64 C: double complex +} +GrB_Type_Code ; + +//------------------------------------------------------------------------------ +// GrB_get: get a scalar, string, enum, size, or void * from an object +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_Scalar (GrB_Scalar, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Scalar_get_String (GrB_Scalar, char * , GrB_Field) ; +GrB_Info GrB_Scalar_get_INT32 (GrB_Scalar, int32_t * , GrB_Field) ; +GrB_Info GrB_Scalar_get_SIZE (GrB_Scalar, size_t * , GrB_Field) ; +GrB_Info GrB_Scalar_get_VOID (GrB_Scalar, void * , GrB_Field) ; + +GrB_Info GrB_Vector_get_Scalar (GrB_Vector, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Vector_get_String (GrB_Vector, char * , GrB_Field) ; +GrB_Info GrB_Vector_get_INT32 (GrB_Vector, int32_t * , GrB_Field) ; +GrB_Info GrB_Vector_get_SIZE (GrB_Vector, size_t * , GrB_Field) ; +GrB_Info GrB_Vector_get_VOID (GrB_Vector, void * , GrB_Field) ; + +GrB_Info GrB_Matrix_get_Scalar (GrB_Matrix, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Matrix_get_String (GrB_Matrix, char * , GrB_Field) ; +GrB_Info GrB_Matrix_get_INT32 (GrB_Matrix, int32_t * , GrB_Field) ; +GrB_Info GrB_Matrix_get_SIZE (GrB_Matrix, size_t * , GrB_Field) ; +GrB_Info GrB_Matrix_get_VOID (GrB_Matrix, void * , GrB_Field) ; + +GrB_Info GxB_Serialized_get_Scalar (const void *, GrB_Scalar, GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_String (const void *, char * , GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_INT32 (const void *, int32_t * , GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_SIZE (const void *, size_t * , GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_VOID (const void *, void * , GrB_Field, size_t) ; + +GrB_Info GrB_UnaryOp_get_Scalar (GrB_UnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_UnaryOp_get_String (GrB_UnaryOp, char * , GrB_Field) ; +GrB_Info GrB_UnaryOp_get_INT32 (GrB_UnaryOp, int32_t * , GrB_Field) ; +GrB_Info GrB_UnaryOp_get_SIZE (GrB_UnaryOp, size_t * , GrB_Field) ; +GrB_Info GrB_UnaryOp_get_VOID (GrB_UnaryOp, void * , GrB_Field) ; + +GrB_Info GrB_IndexUnaryOp_get_Scalar (GrB_IndexUnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_String (GrB_IndexUnaryOp, char * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_INT32 (GrB_IndexUnaryOp, int32_t * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_SIZE (GrB_IndexUnaryOp, size_t * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_VOID (GrB_IndexUnaryOp, void * , GrB_Field) ; + +GrB_Info GrB_BinaryOp_get_Scalar (GrB_BinaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_BinaryOp_get_String (GrB_BinaryOp, char * , GrB_Field) ; +GrB_Info GrB_BinaryOp_get_INT32 (GrB_BinaryOp, int32_t * , GrB_Field) ; +GrB_Info GrB_BinaryOp_get_SIZE (GrB_BinaryOp, size_t * , GrB_Field) ; +GrB_Info GrB_BinaryOp_get_VOID (GrB_BinaryOp, void * , GrB_Field) ; + +GrB_Info GrB_Monoid_get_Scalar (GrB_Monoid, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Monoid_get_String (GrB_Monoid, char * , GrB_Field) ; +GrB_Info GrB_Monoid_get_INT32 (GrB_Monoid, int32_t * , GrB_Field) ; +GrB_Info GrB_Monoid_get_SIZE (GrB_Monoid, size_t * , GrB_Field) ; +GrB_Info GrB_Monoid_get_VOID (GrB_Monoid, void * , GrB_Field) ; + +GrB_Info GrB_Semiring_get_Scalar (GrB_Semiring, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Semiring_get_String (GrB_Semiring, char * , GrB_Field) ; +GrB_Info GrB_Semiring_get_INT32 (GrB_Semiring, int32_t * , GrB_Field) ; +GrB_Info GrB_Semiring_get_SIZE (GrB_Semiring, size_t * , GrB_Field) ; +GrB_Info GrB_Semiring_get_VOID (GrB_Semiring, void * , GrB_Field) ; + +GrB_Info GrB_Descriptor_get_Scalar (GrB_Descriptor, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Descriptor_get_String (GrB_Descriptor, char * , GrB_Field) ; +GrB_Info GrB_Descriptor_get_INT32 (GrB_Descriptor, int32_t * , GrB_Field) ; +GrB_Info GrB_Descriptor_get_SIZE (GrB_Descriptor, size_t * , GrB_Field) ; +GrB_Info GrB_Descriptor_get_VOID (GrB_Descriptor, void * , GrB_Field) ; + +GrB_Info GrB_Type_get_Scalar (GrB_Type, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Type_get_String (GrB_Type, char * , GrB_Field) ; +GrB_Info GrB_Type_get_INT32 (GrB_Type, int32_t * , GrB_Field) ; +GrB_Info GrB_Type_get_SIZE (GrB_Type, size_t * , GrB_Field) ; +GrB_Info GrB_Type_get_VOID (GrB_Type, void * , GrB_Field) ; + +GrB_Info GrB_Global_get_Scalar (GrB_Global, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Global_get_String (GrB_Global, char * , GrB_Field) ; +GrB_Info GrB_Global_get_INT32 (GrB_Global, int32_t * , GrB_Field) ; +GrB_Info GrB_Global_get_SIZE (GrB_Global, size_t * , GrB_Field) ; +GrB_Info GrB_Global_get_VOID (GrB_Global, void * , GrB_Field) ; + +GrB_Info GxB_Context_get_Scalar (GxB_Context, GrB_Scalar, GrB_Field) ; +GrB_Info GxB_Context_get_String (GxB_Context, char * , GrB_Field) ; +GrB_Info GxB_Context_get_INT (GxB_Context, int32_t * , GrB_Field) ; +GrB_Info GxB_Context_get_SIZE (GxB_Context, size_t * , GrB_Field) ; +GrB_Info GxB_Context_get_VOID (GxB_Context, void * , GrB_Field) ; + +// GrB_get (object, value, field): +#if GxB_STDC_VERSION >= 201112L +#define GrB_get(object,value,...) \ + _Generic \ + ( \ + (object), \ + GrB_Scalar : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Scalar_get_Scalar , \ + char * : GrB_Scalar_get_String , \ + int32_t * : GrB_Scalar_get_INT32 , \ + size_t * : GrB_Scalar_get_SIZE , \ + void * : GrB_Scalar_get_VOID \ + ) , \ + GrB_Vector : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Vector_get_Scalar , \ + char * : GrB_Vector_get_String , \ + int32_t * : GrB_Vector_get_INT32 , \ + size_t * : GrB_Vector_get_SIZE , \ + void * : GrB_Vector_get_VOID \ + ) , \ + GrB_Matrix : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Matrix_get_Scalar , \ + char * : GrB_Matrix_get_String , \ + int32_t * : GrB_Matrix_get_INT32 , \ + size_t * : GrB_Matrix_get_SIZE , \ + void * : GrB_Matrix_get_VOID \ + ) , \ + GrB_UnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_UnaryOp_get_Scalar , \ + char * : GrB_UnaryOp_get_String , \ + int32_t * : GrB_UnaryOp_get_INT32 , \ + size_t * : GrB_UnaryOp_get_SIZE , \ + void * : GrB_UnaryOp_get_VOID \ + ) , \ + GrB_IndexUnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_IndexUnaryOp_get_Scalar , \ + char * : GrB_IndexUnaryOp_get_String , \ + int32_t * : GrB_IndexUnaryOp_get_INT32 , \ + size_t * : GrB_IndexUnaryOp_get_SIZE , \ + void * : GrB_IndexUnaryOp_get_VOID \ + ) , \ + GrB_BinaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_BinaryOp_get_Scalar , \ + char * : GrB_BinaryOp_get_String , \ + int32_t * : GrB_BinaryOp_get_INT32 , \ + size_t * : GrB_BinaryOp_get_SIZE , \ + void * : GrB_BinaryOp_get_VOID \ + ) , \ + GrB_Monoid : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Monoid_get_Scalar , \ + char * : GrB_Monoid_get_String , \ + int32_t * : GrB_Monoid_get_INT32 , \ + size_t * : GrB_Monoid_get_SIZE , \ + void * : GrB_Monoid_get_VOID \ + ) , \ + GrB_Semiring : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Semiring_get_Scalar , \ + char * : GrB_Semiring_get_String , \ + int32_t * : GrB_Semiring_get_INT32 , \ + size_t * : GrB_Semiring_get_SIZE , \ + void * : GrB_Semiring_get_VOID \ + ) , \ + GrB_Type : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Type_get_Scalar , \ + char * : GrB_Type_get_String , \ + int32_t * : GrB_Type_get_INT32 , \ + size_t * : GrB_Type_get_SIZE , \ + void * : GrB_Type_get_VOID \ + ) , \ + GrB_Descriptor : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Descriptor_get_Scalar , \ + char * : GrB_Descriptor_get_String , \ + int32_t * : GrB_Descriptor_get_INT32 , \ + size_t * : GrB_Descriptor_get_SIZE , \ + void * : GrB_Descriptor_get_VOID \ + ) , \ + GrB_Global : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Global_get_Scalar , \ + char * : GrB_Global_get_String , \ + int32_t * : GrB_Global_get_INT32 , \ + size_t * : GrB_Global_get_SIZE , \ + void * : GrB_Global_get_VOID \ + ) , \ + GxB_Context : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Context_get_Scalar , \ + char * : GxB_Context_get_String , \ + int32_t * : GxB_Context_get_INT , \ + size_t * : GxB_Context_get_SIZE , \ + void * : GxB_Context_get_VOID \ + ) , \ + const void *: \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Serialized_get_Scalar , \ + char * : GxB_Serialized_get_String , \ + int32_t * : GxB_Serialized_get_INT32 , \ + size_t * : GxB_Serialized_get_SIZE , \ + void * : GxB_Serialized_get_VOID \ + ) , \ + void *: \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Serialized_get_Scalar , \ + char * : GxB_Serialized_get_String , \ + int32_t * : GxB_Serialized_get_INT32 , \ + size_t * : GxB_Serialized_get_SIZE , \ + void * : GxB_Serialized_get_VOID \ + ) \ + ) (object, value, __VA_ARGS__) + +//------------------------------------------------------------------------------ +// GrB_set: set a scalar, string, enum, size, or void * of an object +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_set_Scalar (GrB_Scalar, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Scalar_set_String (GrB_Scalar, char * , GrB_Field) ; +GrB_Info GrB_Scalar_set_INT32 (GrB_Scalar, int32_t , GrB_Field) ; +GrB_Info GrB_Scalar_set_VOID (GrB_Scalar, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Vector_set_Scalar (GrB_Vector, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Vector_set_String (GrB_Vector, char * , GrB_Field) ; +GrB_Info GrB_Vector_set_INT32 (GrB_Vector, int32_t , GrB_Field) ; +GrB_Info GrB_Vector_set_VOID (GrB_Vector, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Matrix_set_Scalar (GrB_Matrix, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Matrix_set_String (GrB_Matrix, char * , GrB_Field) ; +GrB_Info GrB_Matrix_set_INT32 (GrB_Matrix, int32_t , GrB_Field) ; +GrB_Info GrB_Matrix_set_VOID (GrB_Matrix, void * , GrB_Field, size_t) ; + +GrB_Info GrB_UnaryOp_set_Scalar (GrB_UnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_UnaryOp_set_String (GrB_UnaryOp, char * , GrB_Field) ; +GrB_Info GrB_UnaryOp_set_INT32 (GrB_UnaryOp, int32_t , GrB_Field) ; +GrB_Info GrB_UnaryOp_set_VOID (GrB_UnaryOp, void * , GrB_Field, size_t) ; + +GrB_Info GrB_IndexUnaryOp_set_Scalar (GrB_IndexUnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_set_String (GrB_IndexUnaryOp, char * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_set_INT32 (GrB_IndexUnaryOp, int32_t , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_set_VOID (GrB_IndexUnaryOp, void * , GrB_Field, + size_t) ; + +GrB_Info GrB_BinaryOp_set_Scalar (GrB_BinaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_BinaryOp_set_String (GrB_BinaryOp, char * , GrB_Field) ; +GrB_Info GrB_BinaryOp_set_INT32 (GrB_BinaryOp, int32_t , GrB_Field) ; +GrB_Info GrB_BinaryOp_set_VOID (GrB_BinaryOp, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Monoid_set_Scalar (GrB_Monoid, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Monoid_set_String (GrB_Monoid, char * , GrB_Field) ; +GrB_Info GrB_Monoid_set_INT32 (GrB_Monoid, int32_t , GrB_Field) ; +GrB_Info GrB_Monoid_set_VOID (GrB_Monoid, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Semiring_set_Scalar (GrB_Semiring, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Semiring_set_String (GrB_Semiring, char * , GrB_Field) ; +GrB_Info GrB_Semiring_set_INT32 (GrB_Semiring, int32_t , GrB_Field) ; +GrB_Info GrB_Semiring_set_VOID (GrB_Semiring, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Descriptor_set_Scalar (GrB_Descriptor, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Descriptor_set_String (GrB_Descriptor, char * , GrB_Field) ; +GrB_Info GrB_Descriptor_set_INT32 (GrB_Descriptor, int32_t , GrB_Field) ; +GrB_Info GrB_Descriptor_set_VOID (GrB_Descriptor, void * , GrB_Field, + size_t) ; + +GrB_Info GrB_Type_set_Scalar (GrB_Type, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Type_set_String (GrB_Type, char * , GrB_Field) ; +GrB_Info GrB_Type_set_INT32 (GrB_Type, int32_t , GrB_Field) ; +GrB_Info GrB_Type_set_VOID (GrB_Type, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Global_set_Scalar (GrB_Global, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Global_set_String (GrB_Global, char * , GrB_Field) ; +GrB_Info GrB_Global_set_INT32 (GrB_Global, int32_t , GrB_Field) ; +GrB_Info GrB_Global_set_VOID (GrB_Global, void * , GrB_Field, size_t) ; + +GrB_Info GxB_Context_set_Scalar (GxB_Context, GrB_Scalar, GrB_Field) ; +GrB_Info GxB_Context_set_String (GxB_Context, char * , GrB_Field) ; +GrB_Info GxB_Context_set_INT (GxB_Context, int32_t , GrB_Field) ; +GrB_Info GxB_Context_set_VOID (GxB_Context, void * , GrB_Field, size_t) ; + +// GrB_set (object, value, field) or (object, value, field, size) for _VOID +#if GxB_STDC_VERSION >= 201112L +#define GrB_set(object,value,...) \ + _Generic \ + ( \ + (object), \ + GrB_Scalar : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Scalar_set_Scalar , \ + char * : GrB_Scalar_set_String , \ + int32_t : GrB_Scalar_set_INT32 , \ + void * : GrB_Scalar_set_VOID \ + ) , \ + GrB_Vector : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Vector_set_Scalar , \ + char * : GrB_Vector_set_String , \ + int32_t : GrB_Vector_set_INT32 , \ + void * : GrB_Vector_set_VOID \ + ) , \ + GrB_Matrix : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Matrix_set_Scalar , \ + char * : GrB_Matrix_set_String , \ + int32_t : GrB_Matrix_set_INT32 , \ + void * : GrB_Matrix_set_VOID \ + ) , \ + GrB_UnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_UnaryOp_set_Scalar , \ + char * : GrB_UnaryOp_set_String , \ + int32_t : GrB_UnaryOp_set_INT32 , \ + void * : GrB_UnaryOp_set_VOID \ + ) , \ + GrB_IndexUnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_IndexUnaryOp_set_Scalar , \ + char * : GrB_IndexUnaryOp_set_String , \ + int32_t : GrB_IndexUnaryOp_set_INT32 , \ + void * : GrB_IndexUnaryOp_set_VOID \ + ) , \ + GrB_BinaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_BinaryOp_set_Scalar , \ + char * : GrB_BinaryOp_set_String , \ + int32_t : GrB_BinaryOp_set_INT32 , \ + void * : GrB_BinaryOp_set_VOID \ + ) , \ + GrB_Monoid : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Monoid_set_Scalar , \ + char * : GrB_Monoid_set_String , \ + int32_t : GrB_Monoid_set_INT32 , \ + void * : GrB_Monoid_set_VOID \ + ) , \ + GrB_Semiring : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Semiring_set_Scalar , \ + char * : GrB_Semiring_set_String , \ + int32_t : GrB_Semiring_set_INT32 , \ + void * : GrB_Semiring_set_VOID \ + ) , \ + GrB_Type : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Type_set_Scalar , \ + char * : GrB_Type_set_String , \ + int32_t : GrB_Type_set_INT32 , \ + void * : GrB_Type_set_VOID \ + ) , \ + GrB_Descriptor : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Descriptor_set_Scalar , \ + char * : GrB_Descriptor_set_String , \ + int32_t : GrB_Descriptor_set_INT32 , \ + void * : GrB_Descriptor_set_VOID \ + ) , \ + GrB_Global : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Global_set_Scalar , \ + char * : GrB_Global_set_String , \ + int32_t : GrB_Global_set_INT32 , \ + void * : GrB_Global_set_VOID \ + ) , \ + GxB_Context : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Context_set_Scalar , \ + char * : GxB_Context_set_String , \ + int32_t : GxB_Context_set_INT , \ + void * : GxB_Context_set_VOID \ + ) \ + ) (object, value, __VA_ARGS__) +#endif + +#endif + //============================================================================== // GrB_free: free any GraphBLAS object //============================================================================== @@ -5023,7 +4973,7 @@ GrB_Info GrB_Vector_extract // w = accum (w, u(I)) const GrB_Vector mask, // optional mask for w, unused if NULL const GrB_BinaryOp accum, // optional accum for z=accum(w,t) const GrB_Vector u, // first input: vector u - const GrB_Index *Ilist, // row indices + const GrB_Index *Ilist, // row indices GrB_Index ni, // number of row indices const GrB_Descriptor desc // descriptor for w and mask ) ; @@ -5034,7 +4984,7 @@ GrB_Info GrB_Matrix_extract // C = accum (C, A(I,J)) const GrB_Matrix Mask, // optional mask for C, unused if NULL const GrB_BinaryOp accum, // optional accum for Z=accum(C,T) const GrB_Matrix A, // first input: matrix A - const GrB_Index *Ilist, // row indices + const GrB_Index *Ilist, // row indices GrB_Index ni, // number of row indices const GrB_Index *J, // column indices GrB_Index nj, // number of column indices @@ -5047,7 +4997,7 @@ GrB_Info GrB_Col_extract // w = accum (w, A(I,j)) const GrB_Vector mask, // optional mask for w, unused if NULL const GrB_BinaryOp accum, // optional accum for z=accum(w,t) const GrB_Matrix A, // first input: matrix A - const GrB_Index *Ilist, // row indices + const GrB_Index *Ilist, // row indices GrB_Index ni, // number of row indices GrB_Index j, // column index const GrB_Descriptor desc // descriptor for w, mask, and A @@ -9237,6 +9187,11 @@ GrB_Info GxB_Context_fprint // print and check a GxB_Context FILE *f // file for output ) ; +// user code should not directly use GB_STR or GB_XSTR +// GB_STR: convert the content of x into a string "x" +#define GB_XSTR(x) GB_STR(x) +#define GB_STR(x) #x + #if GxB_STDC_VERSION >= 201112L #define GxB_fprint(object,pr,f) \ _Generic \ @@ -10791,7 +10746,7 @@ GrB_Info GrB_Matrix_exportHint // suggest the best export format fread (blob, sizeof (uint8_t), blob_size, f) ; fclose (f) ; char type_name [GxB_MAX_NAME_LEN] ; - GxB_deserialize_type_name (type_name, blob, blob_size) ; + GrB_get (blob, type_name, GxB_JIT_C_NAME, blob_size) ; printf ("blob type is: %s\n", type_name) ; GrB_Type user_type = NULL ; if (strncmp (type_name, "myquaternion", GxB_MAX_NAME_LEN) == 0) @@ -10946,23 +10901,8 @@ GrB_Info GxB_Vector_deserialize // deserialize blob into a GrB_Vector const GrB_Descriptor desc // to control # of threads used ) ; -// GxB_deserialize_type_name extracts the type_name of the GrB_Type of the -// GrB_Matrix or GrB_Vector held in a serialized blob. On input, type_name -// must point to a user-owned char array of size at least GxB_MAX_NAME_LEN (it -// must not point into the blob itself). On output, type_name will contain a -// null-terminated string with the corresponding C type name. If the blob -// holds a matrix of a built-in type, the name is returned as "bool" for -// GrB_BOOL, "uint8_t" for GrB_UINT8, "float complex" for GxB_FC32, etc. -// See GxB_Type_name to convert this name into a GrB_Type. -GrB_Info GxB_deserialize_type_name // return the type name of a blob -( - // output: - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - // input, not modified: - const void *blob, // the blob - GrB_Index blob_size // size of the blob -) ; +// historical; use GrB_get with GxB_JIT_C_NAME instead. +GrB_Info GxB_deserialize_type_name (char *, const void *, GrB_Index) ; //============================================================================== // GxB_Vector_sort and GxB_Matrix_sort: sort a matrix or vector diff --git a/GraphBLAS/Config/GraphBLAS.pc.in b/GraphBLAS/Config/GraphBLAS.pc.in index 1eafb5dd97..db39c4c671 100644 --- a/GraphBLAS/Config/GraphBLAS.pc.in +++ b/GraphBLAS/Config/GraphBLAS.pc.in @@ -1,4 +1,4 @@ -# GraphBLAS, Copyright (c) 2017-2023, Timothy A. Davis. +# GraphBLAS, Copyright (c) 2017-2024, Timothy A. Davis. # All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 diff --git a/GraphBLAS/Config/GraphBLASConfig.cmake.in b/GraphBLAS/Config/GraphBLASConfig.cmake.in index 1ce4385c84..76bf4273e4 100644 --- a/GraphBLAS/Config/GraphBLASConfig.cmake.in +++ b/GraphBLAS/Config/GraphBLASConfig.cmake.in @@ -4,7 +4,8 @@ # The following copyright and license applies to just this file only, not to # the library itself: -# GraphBLASConfig.cmake, Copyright (c) 2023, Timothy A. Davis. All Rights Reserved. +# GraphBLASConfig.cmake, Copyright (c) 2024, Timothy A. Davis. All Rights +# Reserved. # SPDX-License-Identifier: BSD-3-clause #------------------------------------------------------------------------------- diff --git a/GraphBLAS/Config/README.md.in b/GraphBLAS/Config/README.md.in index 08a764fa63..177217a840 100644 --- a/GraphBLAS/Config/README.md.in +++ b/GraphBLAS/Config/README.md.in @@ -1,6 +1,6 @@ # SuiteSparse:GraphBLAS -SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. SPDX-License-Identifier: Apache-2.0 @@ -63,7 +63,7 @@ README.md file with further details. CMakeLists.txt: cmake instructions to compile GraphBLAS -cmake_modules: additional cmake files +`cmake_modules`: additional cmake files Config: version-dependent files used by CMake @@ -100,7 +100,7 @@ CUDA: GPU interface, a work in progress. This is being developed in CONTRIBUTOR-LICENSE.txt: how to contribute to SuiteSparse:GraphBLAS -cpu_features: (c) Google.com, Apache 2.0 license. +`cpu_features`: (c) Google.com, Apache 2.0 license. logo: the (awesome!) GraphBLAS logo by Jakab Rokob, CC BY 4.0 license @@ -108,7 +108,7 @@ lz4: LZ4 compression, (c) 2011-2016, Yann Collet, BSD2 license zstd: ZSTD compression, (c) Meta, by Yann Collet, BSD3 license xxHash: xxHash code, (c) 2012-2021, Yann Collet -rmm_wrap: Rapids Memory Manager, (c) NVIDIA, to use with CUDA. +`rmm_wrap`: Rapids Memory Manager, (c) NVIDIA, to use with CUDA. (draft; not yet in use) @@ -128,9 +128,9 @@ PreJIT: a folder for JIT kernels that are to be integrated into the Versions v5.2.0 and earlier conform to the version 1.3.0 (Sept 25, 2019) of the GraphBLAS C API Specification. Versions v6.0.0 and later conform to the -version 2.0.0 (Nov, 2021) of the GraphBLAS C API Specification. This library -also includes several additional functions and features as extensions to the -spec. +version 2.0.0 (Nov, 2021) of the GraphBLAS C API Specification. Versions +9.0.0 and later conform to the v2.1.0 C API. This library also includes +several additional functions and features as extensions to the spec. All functions, objects, and macros with the prefix GxB are extensions to the spec. Functions, objects, and macros with prefix GB must not be accessed @@ -196,7 +196,7 @@ To support the development of GraphBLAS, contact the author (davis@tamu.edu) or the Texas A&M Foundation (True Brown, tbrown@txamfoundation.com; or Kevin McGinnis, kmcginnis@txamfoundation.com) for details. -SuiteSparse:GraphBLAS, is copyrighted by Timothy A. Davis, (c) 2017-2023, All +SuiteSparse:GraphBLAS, is copyrighted by Timothy A. Davis, (c) 2017-2024, All Rights Reserved. davis@tamu.edu. ----------------------------------------------------------------------------- @@ -244,7 +244,7 @@ file, and in the GraphBLAS User Guide): (1) LZ4, xxHash, and ZSTD by Yann Collet, appearing here under the BSD2 or BSD3 licenses. -(2) cpu_features (c) Google, Apache 2.0 license with components (c) IBM and -Intel (also Apache 2.0), and the cpu_featurer/ndk_compat component (c) +(2) `cpu_features` (c) Google, Apache 2.0 license with components (c) IBM and +Intel (also Apache 2.0), and the `cpu_featurer/ndk_compat` component (c) The Android Open Source Project (BSD-2-clause) diff --git a/GraphBLAS/Demo/Include/graphblas_demos.h b/GraphBLAS/Demo/Include/graphblas_demos.h index b12c52e7ed..d775bf705f 100644 --- a/GraphBLAS/Demo/Include/graphblas_demos.h +++ b/GraphBLAS/Demo/Include/graphblas_demos.h @@ -56,6 +56,7 @@ #include "GraphBLAS.h" #undef I #include "simple_rand.h" +// #include "usercomplex.h" #undef MIN #undef MAX diff --git a/GraphBLAS/Demo/Include/import_test.c b/GraphBLAS/Demo/Include/import_test.c index 5e74f8af55..aaf701d46c 100644 --- a/GraphBLAS/Demo/Include/import_test.c +++ b/GraphBLAS/Demo/Include/import_test.c @@ -8,6 +8,7 @@ //------------------------------------------------------------------------------ #include "GraphBLAS.h" +#undef I #include "graphblas_demos.h" #if defined __INTEL_COMPILER diff --git a/GraphBLAS/Demo/Output/gauss_demo.out b/GraphBLAS/Demo/Output/gauss_demo.out index af441d5155..f6afbec372 100644 --- a/GraphBLAS/Demo/Output/gauss_demo.out +++ b/GraphBLAS/Demo/Output/gauss_demo.out @@ -11,7 +11,7 @@ JIT C flags: [ -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast JIT C link flags: [ -shared ] JIT C libraries: [ -lm -ldl -lgomp -lpthread] JIT C preface: [] -JIT cache: [/home/faculty/d/davis/.SuiteSparse/GrB8.3.0] +JIT cache: [/home/faculty/d/davis/.SuiteSparse/GrB9.0.0] JIT C control: [4] JIT C control: [4] reset ------------------------------------- @@ -29,16 +29,16 @@ JIT C preface (revised): -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' -[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b4/GB_jit__user_type__0__gauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' +[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b4/GB_jit__user_type__0__gauss.c.o [100%] Linking C shared library libGB_jit__user_type__0__gauss.so [100%] Built target GB_jit__user_type__0__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/b4/libGB_jit__user_type__0__gauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/b4/libGB_jit__user_type__0__gauss.so - 0.583 sec ] + 0.617 sec ] GraphBLAS type: BadGauss user-defined: [gauss] size: 4 typedef struct { int32_t real ; } gauss ; [ GxB_Type_new (jit: type changed) (jit: loaded but must recompile) (jit: compile and load) (jit: cmake) @@ -50,20 +50,20 @@ gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2 -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' -[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b4/GB_jit__user_type__0__gauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' +[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b4/GB_jit__user_type__0__gauss.c.o [100%] Linking C shared library libGB_jit__user_type__0__gauss.so [100%] Built target GB_jit__user_type__0__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/b4/libGB_jit__user_type__0__gauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/b4/libGB_jit__user_type__0__gauss.so - 0.6 sec ] + 0.596 sec ] GraphBLAS type: Gauss user-defined: [gauss] size: 8 typedef struct { int32_t real ; int32_t imag ; } gauss ; [ GxB_Type_new - 7.53e-06 sec ] + 1.2e-05 sec ] GraphBLAS type: Gauss user-defined: [gauss] size: 8 typedef struct { int32_t real ; int32_t imag ; } gauss ; [ GxB_BinaryOp_new (jit: loaded but must recompile) (jit: compile and load) (jit: cmake) @@ -75,16 +75,16 @@ gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2 -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' -[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/1b/GB_jit__user_op__0__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' +[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/1b/GB_jit__user_op__0__addgauss.c.o [100%] Linking C shared library libGB_jit__user_op__0__addgauss.so [100%] Built target GB_jit__user_op__0__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/1b/libGB_jit__user_op__0__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/1b/libGB_jit__user_op__0__addgauss.so - 0.608 sec ] + 0.605 sec ] GraphBLAS BinaryOp: BadAddGauss (user-defined): z=addgauss(x,y) GraphBLAS type: ztype user-defined: [gauss] size: 8 @@ -107,16 +107,16 @@ void addgauss (gauss *z, const gauss *x, const gauss *y) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' -[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/1b/GB_jit__user_op__0__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' +[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/1b/GB_jit__user_op__0__addgauss.c.o [100%] Linking C shared library libGB_jit__user_op__0__addgauss.so [100%] Built target GB_jit__user_op__0__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/1b/libGB_jit__user_op__0__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/1b/libGB_jit__user_op__0__addgauss.so - 0.596 sec ] + 0.614 sec ] GraphBLAS BinaryOp: AddGauss (user-defined): z=addgauss(x,y) GraphBLAS type: ztype user-defined: [gauss] size: 8 @@ -131,7 +131,7 @@ void addgauss (gauss *z, const gauss *x, const gauss *y) z->imag = x->imag + y->imag ; } [ GxB_BinaryOp_new - 6.59e-06 sec ] + 6.98e-06 sec ] GraphBLAS BinaryOp: AddGauss (user-defined): z=addgauss(x,y) GraphBLAS type: ztype user-defined: [gauss] size: 8 @@ -216,12 +216,12 @@ row 1: ( 2, 2) ( 2, 1) ( 2, 0) ( 2, -1) row 2: ( 3, 2) ( 3, 1) ( 3, 0) ( 3, -1) row 3: ( 4, 2) ( 4, 1) ( 4, 0) ( 4, -1) - [ GrB_reduce (A bitmap) work:16 gpus:0 (jit: load) - 0.00023 sec ] + [ GrB_reduce (A bitmap) (jit: load) + 0.000144 sec ] sum (A) = (39,6) [ GrB_mxm C=A*B, saxpy (B = B*B, anz: 15 bnz: 15) (bitmap saxpy) (jit: load) (bitmap to full) - 0.000294 sec ] + 0.000198 sec ] =============== Gauss A = A^2 matrix: @@ -232,8 +232,8 @@ row 1: ( 18, 10) ( 18, 8) ( 20, 0) ( 22, -8) row 2: ( 27, 16) ( 28, 12) ( 30, 0) ( 32, -12) row 3: ( 36, 22) ( 38, 16) ( 40, 0) ( 42, -16) - [ GrB_reduce (A full) work:16 gpus:0 (jit: load) - 0.000164 sec ] + [ GrB_reduce (A full) (jit: load) + 0.000102 sec ] sum (A^2) = (387,46) @@ -246,12 +246,11 @@ row 2: . . . . row 3: . . . . [ GxB_set (full to sparse) - 2.09e-05 sec ] + 1.09e-05 sec ] [ GxB_set (hyper to sparse) - 1.1e-05 sec ] - [ GrB_mxm (iso mask: struct) (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C=A'*B, masked_dot_product (dot3) (S{S} = Sf'*Sf) work:16 GPUs:0 Not using cuda path. -nthreads 1 ntasks 1 (jit: load) (sparse to bitmap) (jit: load) - 0.000475 sec ] + 6.95e-06 sec ] + [ GrB_mxm (iso mask: struct) (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C=A'*B, masked_dot_product (dot3) (S{S} = Sf'*Sf) nthreads 1 ntasks 1 (jit: load) (sparse to bitmap) + 0.000206 sec ] =============== Gauss C = diag(AA') matrix: @@ -263,11 +262,11 @@ row 2: . . (2893, 768) . row 3: . . . (5108,1456) [ GxB_set - 7.67e-07 sec ] + 4.82e-07 sec ] [ GxB_set (hyper to sparse) - 8.94e-06 sec ] + 5.16e-06 sec ] [ GrB_select (A dense) - 3.06e-05 sec ] + 3.13e-05 sec ] Gauss D matrix @@ -278,7 +277,7 @@ row 2: . . ( 30, 0) . row 3: . . . ( 42, -16) [ GrB_mxm C=A*B, colscale (Sf=Sf*S) (jit: load) - 0.000186 sec ] + 0.000133 sec ] =============== Gauss C = D*A matrix: @@ -290,9 +289,9 @@ row 2: ( 810, 480) ( 840, 360) ( 900, 0) ( 960,-360) row 3: (1864, 348) (1852, 64) (1680,-640) (1508,-1344) [ GxB_set - 4.31e-07 sec ] + 3.64e-07 sec ] [ GxB_set (sparse to bitmap) - 1.29e-05 sec ] + 6.43e-06 sec ] Gauss D matrix (bitmap) @@ -305,7 +304,7 @@ row 3: . . . ( 42, -16) 4x4 GraphBLAS gauss matrix, bitmap by row sparsity control: bitmap only - D, 4 entries, memory: 360 bytes + D, 4 entries, memory: 376 bytes (0,0) [user-defined value] (1,1) [user-defined value] @@ -313,7 +312,7 @@ row 3: . . . ( 42, -16) (3,3) [user-defined value] [ GxB_set (bitmap to sparse) - 1.43e-05 sec ] + 1.01e-05 sec ] Gauss D matrix (back to sparse) @@ -326,7 +325,7 @@ row 3: . . . ( 42, -16) 4x4 GraphBLAS gauss matrix, sparse by row sparsity control: sparse only - D, 4 entries, memory: 320 bytes + D, 4 entries, memory: 336 bytes (0,0) [user-defined value] (1,1) [user-defined value] @@ -334,7 +333,7 @@ row 3: . . . ( 42, -16) (3,3) [user-defined value] [ GrB_mxm C=A*B, rowscale (Sf=S*Sf) (jit: load) - 0.000181 sec ] + 0.000128 sec ] =============== Gauss C = A*D matrix: @@ -346,7 +345,7 @@ row 2: ( 179, 252) ( 408, 440) ( 900, 0) (1152,-1016) row 3: ( 236, 342) ( 556, 592) (1200, 0) (1508,-1344) [ GrB_assign (C iso assign) (pending: 0) Method 21: (C full) = scalar - 4.1e-05 sec ] + 3.02e-05 sec ] =============== Gauss C = (1,-2) matrix: @@ -368,7 +367,7 @@ row 2: ( 27, 16) ( 28, 12) ( 30, 0) ( 32, -12) row 3: ( 36, 22) ( 38, 16) ( 40, 0) ( 42, -16) [ GrB_mxm C=A'*B, dot_product (dot4: F += Sf'*Sf) (jit: load) (C in place) - 0.000185 sec ] + 0.000126 sec ] =============== Gauss C += A*A' matrix: @@ -380,7 +379,7 @@ row 2: ( 918, 58) (1943, 476) (2894, 766) (3845,1056) row 3: (1221, 88) (2581, 658) (3845,1056) (5109,1454) [ GrB_assign (C iso assign) (pending: 0) Method 21: (C full) = scalar - 2.16e-05 sec ] + 1.29e-05 sec ] =============== Gauss B = (1,-2) matrix: @@ -392,7 +391,7 @@ row 2: ( 1, -2) ( 1, -2) ( 1, -2) ( 1, -2) row 3: ( 1, -2) ( 1, -2) ( 1, -2) ( 1, -2) [ GrB_mxm C=A*B, saxpy (saxpy4: F += Sf*F) (coarse, threads: 1) (jit: load) (C in place) - 0.000194 sec ] + 0.000147 sec ] =============== Gauss C += B*A: @@ -404,7 +403,7 @@ row 2: (1112, -70) (2110, 327) (2989, 566) (3868, 805) row 3: (1415, -40) (2748, 509) (3940, 856) (5132,1203) [ GrB_mxm C=A*B, saxpy (saxpy5: F += F*Sf) (jit: load) (C in place) - 0.000177 sec ] + 0.000126 sec ] =============== Gauss C += A*B: @@ -416,7 +415,7 @@ row 2: (1261,-288) (2259, 109) (3138, 348) (4017, 587) row 3: (1615,-330) (2948, 219) (4140, 566) (5332, 913) [ GrB_apply (shallow-op) (jit: load) - 0.000171 sec ] + 0.000121 sec ] =============== Gauss C = (1,-2) + A: @@ -428,7 +427,7 @@ row 2: ( 28, 14) ( 29, 10) ( 31, -2) ( 33, -14) row 3: ( 37, 20) ( 39, 14) ( 41, -2) ( 43, -18) [ GrB_apply (shallow-op) (jit: load) - 0.000152 sec ] + 0.000106 sec ] =============== Gauss C = A*(1,-2): @@ -440,7 +439,7 @@ row 2: ( 59, -38) ( 52, -44) ( 30, -60) ( 8, -76) row 3: ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) [ GrB_apply (transpose-op) (transpose) (1-thread bucket transpose) (jit: load) (full to sparse) - 0.00019 sec ] + 0.000134 sec ] =============== Gauss C = A'*(1,-2): @@ -452,7 +451,7 @@ row 2: ( 5, -20) ( 20, -40) ( 30, -60) ( 40, -80) row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) [ GrB_apply (transpose-op) (transpose) (1-thread bucket transpose) (jit: load) (full to sparse) - 0.000176 sec ] + 0.000121 sec ] =============== Gauss C = (1,-2)*A': @@ -473,10 +472,10 @@ void realgauss (int32_t *z, const gauss *x) (*z) = x->real ; } [ GrB_apply (shallow-op) (jit: load) - 0.00016 sec ] + 0.000159 sec ] 4x4 GraphBLAS int32_t matrix, full by row - R, 16 entries, memory: 280 bytes + R, 16 entries, memory: 296 bytes (0,0) 17 (0,1) 38 @@ -506,10 +505,10 @@ row 2: ( 5, -20) ( 20, -40) ( 30, -60) ( 40, -80) row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) [ GrB_apply (transpose-op) (transpose) (bitmap/full transpose) (jit: load) - 0.000193 sec ] + 0.000125 sec ] 4x4 GraphBLAS int32_t matrix, full by row - R, 16 entries, memory: 280 bytes + R, 16 entries, memory: 296 bytes (0,0) 17 (0,1) 11 @@ -539,12 +538,12 @@ row 2: ( 5, -20) ( 20, -40) ( 30, -60) ( 40, -80) row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) [ GrB_apply (shallow-op) (jit: load) - 0.00017 sec ] + 0.000119 sec ] R = ijgauss (C) 4x4 GraphBLAS int64_t matrix, full by row - R, 16 entries, memory: 344 bytes + R, 16 entries, memory: 360 bytes (0,0) 18 (0,1) 38 @@ -563,8 +562,8 @@ R = ijgauss (C) (3,2) 10 (3,3) 11 - [ GrB_Matrix_extractTuples (A full) (jit: load) - 0.000162 sec ] + [ GrB_Matrix_extractTuples (A full) + 3.29e-05 sec ] R (0,0) = 18 R (0,1) = 38 R (0,2) = 58 @@ -592,7 +591,7 @@ row 2: ( 5, -20) ( 20, -40) ( 30, -60) ( 40, -80) row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) [ GrB_transpose (transpose) (bitmap/full transpose) (jit: load) - 0.000164 sec ] + 0.000161 sec ] =============== C = C' @@ -604,9 +603,9 @@ row 2: ( 59, -38) ( 52, -44) ( 30, -60) ( 8, -76) row 3: ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) [ GxB_set (in-place transpose) (transpose) - 1.71e-05 sec ] - [ GxB_Matrix_concat (sparse concat) (transpose) (bitmap/full transpose) (transpose) (transpose) (1-thread bucket transpose) (jit: load) (transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) (jit: load) (jit: load) (jit: load) - 0.000687 sec ] + 1.23e-05 sec ] + [ GxB_Matrix_concat (sparse concat) (transpose) (bitmap/full transpose) (transpose) (transpose) (1-thread bucket transpose) (jit: load) (transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) + 0.000185 sec ] =============== Z = [C D ; E E ; D C] @@ -870,7 +869,7 @@ row 255: . . . ( 42, -16) ( 80, -50) ( 70, -60 256x8 GraphBLAS gauss matrix, sparse by col - Z, 40 entries, memory: 928 bytes + Z, 40 entries, memory: 944 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -913,8 +912,8 @@ row 255: . . . ( 42, -16) ( 80, -50) ( 70, -60 (254,7) [user-defined value] (255,7) [user-defined value] - [ GxB_Matrix_split (sparse/hyper split) (jit: load) - 0.000201 sec ] + [ GxB_Matrix_split (sparse/hyper split) + 2.96e-05 sec ] =============== C Tile from Z: @@ -1051,7 +1050,7 @@ row 127: . . . 128x3 GraphBLAS gauss matrix, sparse by col - CTiles [k], 12 entries, memory: 440 bytes + CTiles [k], 12 entries, memory: 456 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1202,7 +1201,7 @@ row 127: . . . . . 128x5 GraphBLAS gauss matrix, sparse by col - CTiles [k], 8 entries, memory: 392 bytes + CTiles [k], 8 entries, memory: 408 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1349,7 +1348,7 @@ row 127: . . . 128x3 GraphBLAS gauss matrix, sparse by col - CTiles [k], 3 entries, memory: 296 bytes + CTiles [k], 3 entries, memory: 312 bytes (124,0) [user-defined value] (125,1) [user-defined value] @@ -1491,7 +1490,7 @@ row 127: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) 128x5 GraphBLAS gauss matrix, sparse by col - CTiles [k], 17 entries, memory: 536 bytes + CTiles [k], 17 entries, memory: 552 bytes (127,0) [user-defined value] (124,1) [user-defined value] @@ -1512,9 +1511,9 @@ row 127: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) (127,4) [user-defined value] [ GxB_set (in-place transpose) (transpose) - 7.88e-06 sec ] - [ GxB_Matrix_concat (bitmap concat) (transpose) (bitmap/full transpose) (jit: load) (transpose) (jit: load) (transpose) (1-thread bucket transpose) (jit: load) (transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) - 0.000361 sec ] + 7.28e-06 sec ] + [ GxB_Matrix_concat (bitmap concat) (transpose) (bitmap/full transpose) (transpose) (transpose) (1-thread bucket transpose) (transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) + 5.54e-05 sec ] =============== Z = [C D ; E E ; D C] @@ -1538,7 +1537,7 @@ row 15: . . . ( 42, -16) ( 80, -50) ( 70, -60) 16x8 GraphBLAS gauss matrix, bitmap by col - Z, 40 entries, memory: 1.3 KB + Z, 40 entries, memory: 1.4 KB (0,0) [user-defined value] (1,0) [user-defined value] @@ -1581,8 +1580,8 @@ row 15: . . . ( 42, -16) ( 80, -50) ( 70, -60) (14,7) [user-defined value] (15,7) [user-defined value] - [ GxB_Matrix_split (bitmap split) (jit: load) - 0.000117 sec ] + [ GxB_Matrix_split (bitmap split) + 1.49e-05 sec ] =============== C Tile from Z: @@ -1599,7 +1598,7 @@ row 7: . . . 8x3 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 12 entries, memory: 432 bytes + CTiles [k], 12 entries, memory: 448 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1630,7 +1629,7 @@ row 7: . . . . . 8x5 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 8 entries, memory: 576 bytes + CTiles [k], 8 entries, memory: 592 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1657,7 +1656,7 @@ row 7: . . . 8x3 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 3 entries, memory: 432 bytes + CTiles [k], 3 entries, memory: 448 bytes (4,0) [user-defined value] (5,1) [user-defined value] @@ -1679,7 +1678,7 @@ row 7: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) 8x5 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 17 entries, memory: 576 bytes + CTiles [k], 17 entries, memory: 592 bytes (7,0) [user-defined value] (4,1) [user-defined value] @@ -1700,7 +1699,7 @@ row 7: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) (7,4) [user-defined value] [ GrB_assign (pending: 0) Method 22: (C full) += scalar (jit: load) - 0.000118 sec ] + 0.000165 sec ] =============== C = C + ciso @@ -1712,9 +1711,9 @@ row 2: ( 60, -40) ( 53, -46) ( 31, -62) ( 9, -78) row 3: ( 81, -52) ( 71, -62) ( 41, -82) ( 11,-102) [ GxB_set - 2.73e-07 sec ] - [ GxB_Matrix_split (full split) (jit: load) - 0.000108 sec ] + 2.72e-07 sec ] + [ GxB_Matrix_split (full split) + 1.53e-05 sec ] =============== S Tile from C: @@ -1725,7 +1724,7 @@ row 0: ( 18, -16) ( 12, -19) 1x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 2 entries, memory: 232 bytes + STiles [k], 2 entries, memory: 248 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -1740,7 +1739,7 @@ row 0: ( 6, -22) ( 0, -25) 1x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 2 entries, memory: 232 bytes + STiles [k], 2 entries, memory: 248 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -1757,7 +1756,7 @@ row 2: ( 81, -52) ( 71, -62) 3x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 6 entries, memory: 264 bytes + STiles [k], 6 entries, memory: 280 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -1778,7 +1777,7 @@ row 2: ( 41, -82) ( 11,-102) 3x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 6 entries, memory: 264 bytes + STiles [k], 6 entries, memory: 280 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -1799,7 +1798,7 @@ row 2: ( 60, -40) ( 53, -46) ( 31, -62) ( 9, -78) row 3: ( 81, -52) ( 71, -62) ( 41, -82) ( 11,-102) [ GrB_assign (pending: 0) Method 22: (C full) += scalar (generic C(:,:)+=x assign) - 1.47e-05 sec ] + 1.69e-05 sec ] =============== C = C + ciso (JIT paused): @@ -1821,7 +1820,7 @@ row 2: ( 61, -42) ( 54, -48) ( 32, -64) ( 10, -80) row 3: ( 82, -54) ( 72, -64) ( 42, -84) ( 12,-104) [ GrB_assign (pending: 0) Method 22: (C full) += scalar (generic C(:,:)+=x assign) - 1e-05 sec ] + 1.07e-05 sec ] =============== C = C * ciso (JIT paused): @@ -1834,7 +1833,7 @@ row 3: ( -26,-218) ( -56,-208) (-126,-168) (-196,-128) JIT: run (may not load or compile) [ GrB_assign (pending: 0) Method 22: (C full) += scalar - 7.75e-06 sec ] + 8.46e-06 sec ] =============== C = C + ciso (JIT run): @@ -1846,7 +1845,7 @@ row 2: ( -22,-166) ( -41,-158) ( -95,-130) (-149,-102) row 3: ( -25,-220) ( -55,-210) (-125,-170) (-195,-130) [ GrB_assign (pending: 0) Method 22: (C full) += scalar (generic C(:,:)+=x assign) - 1e-05 sec ] + 1.01e-05 sec ] =============== C = C * ciso (JIT not loaded): @@ -1859,7 +1858,7 @@ row 3: (-465,-170) (-475,-100) (-465, 80) (-455, 260) JIT: on [ GrB_assign (pending: 0) Method 22: (C full) += scalar (jit: load) - 0.000112 sec ] + 0.000127 sec ] =============== C = C * ciso (full JIT): diff --git a/GraphBLAS/Demo/Output/gauss_demo1.out b/GraphBLAS/Demo/Output/gauss_demo1.out index 90a7cb21a3..3fd296ca1c 100644 --- a/GraphBLAS/Demo/Output/gauss_demo1.out +++ b/GraphBLAS/Demo/Output/gauss_demo1.out @@ -11,7 +11,7 @@ JIT C flags: [ -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast JIT C link flags: [ -shared ] JIT C libraries: [ -lm -ldl -lgomp -lpthread] JIT C preface: [] -JIT cache: [/home/faculty/d/davis/.SuiteSparse/GrB8.3.0] +JIT cache: [/home/faculty/d/davis/.SuiteSparse/GrB9.0.0] JIT C control: [4] JIT C control: [4] reset ------------------------------------- @@ -29,16 +29,16 @@ JIT C preface (revised): -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' -[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b4/GB_jit__user_type__0__gauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' +[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b4/GB_jit__user_type__0__gauss.c.o [100%] Linking C shared library libGB_jit__user_type__0__gauss.so [100%] Built target GB_jit__user_type__0__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/b4/libGB_jit__user_type__0__gauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/b4/libGB_jit__user_type__0__gauss.so - 0.598 sec ] + 0.586 sec ] GraphBLAS type: BadGauss user-defined: [gauss] size: 4 typedef struct { int32_t real ; } gauss ; [ GxB_Type_new (jit: type changed) (jit: loaded but must recompile) (jit: compile and load) (jit: cmake) @@ -50,20 +50,20 @@ gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2 -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' -[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b4/GB_jit__user_type__0__gauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' +[ 50%] Building C object CMakeFiles/GB_jit__user_type__0__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b4/GB_jit__user_type__0__gauss.c.o [100%] Linking C shared library libGB_jit__user_type__0__gauss.so [100%] Built target GB_jit__user_type__0__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2be202506bf1b4' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/ce2be202506bf1b4' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/b4/libGB_jit__user_type__0__gauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/b4/libGB_jit__user_type__0__gauss.so - 0.595 sec ] + 0.603 sec ] GraphBLAS type: Gauss user-defined: [gauss] size: 8 typedef struct { int32_t real ; int32_t imag ; } gauss ; [ GxB_Type_new - 1.03e-05 sec ] + 1.09e-05 sec ] GraphBLAS type: Gauss user-defined: [gauss] size: 8 typedef struct { int32_t real ; int32_t imag ; } gauss ; [ GxB_BinaryOp_new (jit: compile and load) (jit: cmake) @@ -75,16 +75,16 @@ gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ce2 -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' -[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/1b/GB_jit__user_op__0__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' +[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/1b/GB_jit__user_op__0__addgauss.c.o [100%] Linking C shared library libGB_jit__user_op__0__addgauss.so [100%] Built target GB_jit__user_op__0__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/1b/libGB_jit__user_op__0__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/1b/libGB_jit__user_op__0__addgauss.so - 0.608 sec ] + 0.617 sec ] GraphBLAS BinaryOp: BadAddGauss (user-defined): z=addgauss(x,y) GraphBLAS type: ztype user-defined: [gauss] size: 8 @@ -107,16 +107,16 @@ void addgauss (gauss *z, const gauss *x, const gauss *y) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' -[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/1b/GB_jit__user_op__0__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' +[ 50%] Building C object CMakeFiles/GB_jit__user_op__0__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/1b/GB_jit__user_op__0__addgauss.c.o [100%] Linking C shared library libGB_jit__user_op__0__addgauss.so [100%] Built target GB_jit__user_op__0__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/af7c00a52397011b' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/af7c00a52397011b' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/1b/libGB_jit__user_op__0__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/1b/libGB_jit__user_op__0__addgauss.so - 0.624 sec ] + 0.598 sec ] GraphBLAS BinaryOp: AddGauss (user-defined): z=addgauss(x,y) GraphBLAS type: ztype user-defined: [gauss] size: 8 @@ -131,7 +131,7 @@ void addgauss (gauss *z, const gauss *x, const gauss *y) z->imag = x->imag + y->imag ; } [ GxB_BinaryOp_new - 7.3e-06 sec ] + 8.62e-06 sec ] GraphBLAS BinaryOp: AddGauss (user-defined): z=addgauss(x,y) GraphBLAS type: ztype user-defined: [gauss] size: 8 @@ -216,7 +216,7 @@ row 1: ( 2, 2) ( 2, 1) ( 2, 0) ( 2, -1) row 2: ( 3, 2) ( 3, 1) ( 3, 0) ( 3, -1) row 3: ( 4, 2) ( 4, 1) ( 4, 0) ( 4, -1) - [ GrB_reduce (A bitmap) work:16 gpus:0 (jit: compile and load) (jit: cmake) + [ GrB_reduce (A bitmap) (jit: compile and load) (jit: cmake) -- The C compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done @@ -225,16 +225,16 @@ row 3: ( 4, 2) ( 4, 1) ( 4, 0) ( 4, -1) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/30e2328e57edb8cc -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/30e2328e57edb8cc' -[ 50%] Building C object CMakeFiles/GB_jit__reduce__83feee2__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/cc/GB_jit__reduce__83feee2__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/30e2328e57edb8cc +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/30e2328e57edb8cc' +[ 50%] Building C object CMakeFiles/GB_jit__reduce__83feee2__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/cc/GB_jit__reduce__83feee2__addgauss.c.o [100%] Linking C shared library libGB_jit__reduce__83feee2__addgauss.so [100%] Built target GB_jit__reduce__83feee2__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/30e2328e57edb8cc' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/30e2328e57edb8cc' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/cc/libGB_jit__reduce__83feee2__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/cc/libGB_jit__reduce__83feee2__addgauss.so - 0.667 sec ] + 0.656 sec ] sum (A) = (39,6) [ GrB_mxm C=A*B, saxpy (B = B*B, anz: 15 bnz: 15) (bitmap saxpy) (jit: compile and load) (jit: cmake) @@ -246,16 +246,16 @@ sum (A) = (39,6) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/e335728df7d8fc68 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/e335728df7d8fc68' -[ 50%] Building C object CMakeFiles/GB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/68/GB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/e335728df7d8fc68 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/e335728df7d8fc68' +[ 50%] Building C object CMakeFiles/GB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/68/GB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.c.o [100%] Linking C shared library libGB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.so [100%] Built target GB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/e335728df7d8fc68' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/e335728df7d8fc68' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/68/libGB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/68/libGB_jit__AxB_saxbit__03fe100eee0eee8a__addgauss_multgauss.so (bitmap to full) - 0.774 sec ] + 0.769 sec ] =============== Gauss A = A^2 matrix: @@ -266,7 +266,7 @@ row 1: ( 18, 10) ( 18, 8) ( 20, 0) ( 22, -8) row 2: ( 27, 16) ( 28, 12) ( 30, 0) ( 32, -12) row 3: ( 36, 22) ( 38, 16) ( 40, 0) ( 42, -16) - [ GrB_reduce (A full) work:16 gpus:0 (jit: compile and load) (jit: cmake) + [ GrB_reduce (A full) (jit: compile and load) (jit: cmake) -- The C compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done @@ -275,16 +275,16 @@ row 3: ( 36, 22) ( 38, 16) ( 40, 0) ( 42, -16) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/216cc7a07453b1ee -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/216cc7a07453b1ee' -[ 50%] Building C object CMakeFiles/GB_jit__reduce__83feee3__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/ee/GB_jit__reduce__83feee3__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/216cc7a07453b1ee +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/216cc7a07453b1ee' +[ 50%] Building C object CMakeFiles/GB_jit__reduce__83feee3__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/ee/GB_jit__reduce__83feee3__addgauss.c.o [100%] Linking C shared library libGB_jit__reduce__83feee3__addgauss.so [100%] Built target GB_jit__reduce__83feee3__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/216cc7a07453b1ee' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/216cc7a07453b1ee' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/ee/libGB_jit__reduce__83feee3__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/ee/libGB_jit__reduce__83feee3__addgauss.so - 0.708 sec ] + 0.74 sec ] sum (A^2) = (387,46) @@ -297,11 +297,10 @@ row 2: . . . . row 3: . . . . [ GxB_set (full to sparse) - 1.35e-05 sec ] + 2.34e-05 sec ] [ GxB_set (hyper to sparse) - 8.36e-06 sec ] - [ GrB_mxm (iso mask: struct) (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C=A'*B, masked_dot_product (dot3) (S{S} = Sf'*Sf) work:16 GPUs:0 Not using cuda path. -nthreads 1 ntasks 1 (jit: compile and load) (jit: cmake) + 1.51e-05 sec ] + [ GrB_mxm (iso mask: struct) (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C=A'*B, masked_dot_product (dot3) (S{S} = Sf'*Sf) nthreads 1 ntasks 1 (jit: compile and load) (jit: cmake) -- The C compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done @@ -310,33 +309,16 @@ nthreads 1 ntasks 1 (jit: compile and load) (jit: cmake) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/67a80190c429079f -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/67a80190c429079f' -[ 50%] Building C object CMakeFiles/GB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/9f/GB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/67a80190c429079f +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/67a80190c429079f' +[ 50%] Building C object CMakeFiles/GB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/9f/GB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.c.o [100%] Linking C shared library libGB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.so [100%] Built target GB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/67a80190c429079f' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/67a80190c429079f' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/9f/libGB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.so -(sparse to bitmap) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/be2424ff0149b586 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/be2424ff0149b586' -[ 50%] Building C object CMakeFiles/GB_jit__convert_s2b__0002ee0eed__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/86/GB_jit__convert_s2b__0002ee0eed__gauss.c.o -[100%] Linking C shared library libGB_jit__convert_s2b__0002ee0eed__gauss.so -[100%] Built target GB_jit__convert_s2b__0002ee0eed__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/be2424ff0149b586' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/86/libGB_jit__convert_s2b__0002ee0eed__gauss.so - - 1.32 sec ] +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/9f/libGB_jit__AxB_dot3__03fe100eee2eee55__addgauss_multgauss.so +(sparse to bitmap) + 0.719 sec ] =============== Gauss C = diag(AA') matrix: @@ -348,11 +330,11 @@ row 2: . . (2893, 768) . row 3: . . . (5108,1456) [ GxB_set - 1.61e-06 sec ] + 1.33e-06 sec ] [ GxB_set (hyper to sparse) - 9.37e-06 sec ] + 8.97e-06 sec ] [ GrB_select (A dense) - 3.26e-05 sec ] + 5.52e-05 sec ] Gauss D matrix @@ -371,16 +353,16 @@ row 3: . . . ( 42, -16) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/dd2129670608a0a3 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/dd2129670608a0a3' -[ 50%] Building C object CMakeFiles/GB_jit__colscale__0100eee0eee45__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/a3/GB_jit__colscale__0100eee0eee45__multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/dd2129670608a0a3 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/dd2129670608a0a3' +[ 50%] Building C object CMakeFiles/GB_jit__colscale__0100eee0eee45__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/a3/GB_jit__colscale__0100eee0eee45__multgauss.c.o [100%] Linking C shared library libGB_jit__colscale__0100eee0eee45__multgauss.so [100%] Built target GB_jit__colscale__0100eee0eee45__multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/dd2129670608a0a3' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/dd2129670608a0a3' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/a3/libGB_jit__colscale__0100eee0eee45__multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/a3/libGB_jit__colscale__0100eee0eee45__multgauss.so - 0.637 sec ] + 0.622 sec ] =============== Gauss C = D*A matrix: @@ -392,9 +374,9 @@ row 2: ( 810, 480) ( 840, 360) ( 900, 0) ( 960,-360) row 3: (1864, 348) (1852, 64) (1680,-640) (1508,-1344) [ GxB_set - 9.27e-07 sec ] + 1.08e-06 sec ] [ GxB_set (sparse to bitmap) - 1.75e-05 sec ] + 1.35e-05 sec ] Gauss D matrix (bitmap) @@ -407,7 +389,7 @@ row 3: . . . ( 42, -16) 4x4 GraphBLAS gauss matrix, bitmap by row sparsity control: bitmap only - D, 4 entries, memory: 360 bytes + D, 4 entries, memory: 376 bytes (0,0) [user-defined value] (1,1) [user-defined value] @@ -415,7 +397,7 @@ row 3: . . . ( 42, -16) (3,3) [user-defined value] [ GxB_set (bitmap to sparse) - 2.67e-05 sec ] + 1.5e-05 sec ] Gauss D matrix (back to sparse) @@ -428,7 +410,7 @@ row 3: . . . ( 42, -16) 4x4 GraphBLAS gauss matrix, sparse by row sparsity control: sparse only - D, 4 entries, memory: 320 bytes + D, 4 entries, memory: 336 bytes (0,0) [user-defined value] (1,1) [user-defined value] @@ -444,16 +426,16 @@ row 3: . . . ( 42, -16) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/96b50768cfd669a8 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/96b50768cfd669a8' -[ 50%] Building C object CMakeFiles/GB_jit__rowscale__0100eee0eee45__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/a8/GB_jit__rowscale__0100eee0eee45__multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/96b50768cfd669a8 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/96b50768cfd669a8' +[ 50%] Building C object CMakeFiles/GB_jit__rowscale__0100eee0eee45__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/a8/GB_jit__rowscale__0100eee0eee45__multgauss.c.o [100%] Linking C shared library libGB_jit__rowscale__0100eee0eee45__multgauss.so [100%] Built target GB_jit__rowscale__0100eee0eee45__multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/96b50768cfd669a8' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/96b50768cfd669a8' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/a8/libGB_jit__rowscale__0100eee0eee45__multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/a8/libGB_jit__rowscale__0100eee0eee45__multgauss.so - 0.634 sec ] + 0.597 sec ] =============== Gauss C = A*D matrix: @@ -465,7 +447,7 @@ row 2: ( 179, 252) ( 408, 440) ( 900, 0) (1152,-1016) row 3: ( 236, 342) ( 556, 592) (1200, 0) (1508,-1344) [ GrB_assign (C iso assign) (pending: 0) Method 21: (C full) = scalar - 3.38e-05 sec ] + 3.96e-05 sec ] =============== Gauss C = (1,-2) matrix: @@ -495,16 +477,16 @@ row 3: ( 36, 22) ( 38, 16) ( 40, 0) ( 42, -16) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/7acb8bd141ca27c9 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/7acb8bd141ca27c9' -[ 50%] Building C object CMakeFiles/GB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/c9/GB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/7acb8bd141ca27c9 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/7acb8bd141ca27c9' +[ 50%] Building C object CMakeFiles/GB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/c9/GB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.c.o [100%] Linking C shared library libGB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.so [100%] Built target GB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/7acb8bd141ca27c9' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/7acb8bd141ca27c9' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/c9/libGB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/c9/libGB_jit__AxB_dot4__03fe900eee0eeec5__addgauss_multgauss.so (C in place) - 0.678 sec ] + 0.675 sec ] =============== Gauss C += A*A' matrix: @@ -516,7 +498,7 @@ row 2: ( 918, 58) (1943, 476) (2894, 766) (3845,1056) row 3: (1221, 88) (2581, 658) (3845,1056) (5109,1454) [ GrB_assign (C iso assign) (pending: 0) Method 21: (C full) = scalar - 2.18e-05 sec ] + 2.82e-05 sec ] =============== Gauss B = (1,-2) matrix: @@ -536,16 +518,16 @@ row 3: ( 1, -2) ( 1, -2) ( 1, -2) ( 1, -2) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5301828568d7f863 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5301828568d7f863' -[ 50%] Building C object CMakeFiles/GB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/63/GB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/5301828568d7f863 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/5301828568d7f863' +[ 50%] Building C object CMakeFiles/GB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/63/GB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.c.o [100%] Linking C shared library libGB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.so [100%] Built target GB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5301828568d7f863' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/5301828568d7f863' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/63/libGB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/63/libGB_jit__AxB_saxpy4__03fe300eee0eeec7__addgauss_multgauss.so (C in place) - 1.01 sec ] + 1.05 sec ] =============== Gauss C += B*A: @@ -565,16 +547,16 @@ row 3: (1415, -40) (2748, 509) (3940, 856) (5132,1203) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/c94d1f86a5825b56 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/c94d1f86a5825b56' -[ 50%] Building C object CMakeFiles/GB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/56/GB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/c94d1f86a5825b56 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/c94d1f86a5825b56' +[ 50%] Building C object CMakeFiles/GB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/56/GB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.c.o [100%] Linking C shared library libGB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.so [100%] Built target GB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/c94d1f86a5825b56' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/c94d1f86a5825b56' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/56/libGB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/56/libGB_jit__AxB_saxpy5__03fe500eee0eeecd__addgauss_multgauss.so (C in place) - 0.647 sec ] + 0.644 sec ] =============== Gauss C += A*B: @@ -594,16 +576,16 @@ row 3: (1615,-330) (2948, 219) (4140, 566) (5332, 913) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/3b6448d781104419 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/3b6448d781104419' -[ 50%] Building C object CMakeFiles/GB_jit__apply_bind1st__0000eee0efec1__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/19/GB_jit__apply_bind1st__0000eee0efec1__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/3b6448d781104419 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/3b6448d781104419' +[ 50%] Building C object CMakeFiles/GB_jit__apply_bind1st__0000eee0efec1__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/19/GB_jit__apply_bind1st__0000eee0efec1__addgauss.c.o [100%] Linking C shared library libGB_jit__apply_bind1st__0000eee0efec1__addgauss.so [100%] Built target GB_jit__apply_bind1st__0000eee0efec1__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/3b6448d781104419' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/3b6448d781104419' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/19/libGB_jit__apply_bind1st__0000eee0efec1__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/19/libGB_jit__apply_bind1st__0000eee0efec1__addgauss.so - 0.615 sec ] + 0.618 sec ] =============== Gauss C = (1,-2) + A: @@ -623,16 +605,16 @@ row 3: ( 37, 20) ( 39, 14) ( 41, -2) ( 43, -18) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/42813a1e14cb43c9 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/42813a1e14cb43c9' -[ 50%] Building C object CMakeFiles/GB_jit__apply_bind2nd__0000eee0eefc4__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/c9/GB_jit__apply_bind2nd__0000eee0eefc4__multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/42813a1e14cb43c9 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/42813a1e14cb43c9' +[ 50%] Building C object CMakeFiles/GB_jit__apply_bind2nd__0000eee0eefc4__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/c9/GB_jit__apply_bind2nd__0000eee0eefc4__multgauss.c.o [100%] Linking C shared library libGB_jit__apply_bind2nd__0000eee0eefc4__multgauss.so [100%] Built target GB_jit__apply_bind2nd__0000eee0eefc4__multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/42813a1e14cb43c9' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/42813a1e14cb43c9' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/c9/libGB_jit__apply_bind2nd__0000eee0eefc4__multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/c9/libGB_jit__apply_bind2nd__0000eee0eefc4__multgauss.so - 0.655 sec ] + 0.665 sec ] =============== Gauss C = A*(1,-2): @@ -652,16 +634,16 @@ row 3: ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/37d33aa629f415d3 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/37d33aa629f415d3' -[ 50%] Building C object CMakeFiles/GB_jit__trans_bind2nd__0000eee0eef44__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/d3/GB_jit__trans_bind2nd__0000eee0eef44__multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/37d33aa629f415d3 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/37d33aa629f415d3' +[ 50%] Building C object CMakeFiles/GB_jit__trans_bind2nd__0000eee0eef44__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/d3/GB_jit__trans_bind2nd__0000eee0eef44__multgauss.c.o [100%] Linking C shared library libGB_jit__trans_bind2nd__0000eee0eef44__multgauss.so [100%] Built target GB_jit__trans_bind2nd__0000eee0eef44__multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/37d33aa629f415d3' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/37d33aa629f415d3' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/d3/libGB_jit__trans_bind2nd__0000eee0eef44__multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/d3/libGB_jit__trans_bind2nd__0000eee0eef44__multgauss.so (full to sparse) - 0.668 sec ] + 0.679 sec ] =============== Gauss C = A'*(1,-2): @@ -681,16 +663,16 @@ row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/07d1cb825d4304d3 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/07d1cb825d4304d3' -[ 50%] Building C object CMakeFiles/GB_jit__trans_bind1st__0000eee0efe41__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/d3/GB_jit__trans_bind1st__0000eee0efe41__multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/07d1cb825d4304d3 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/07d1cb825d4304d3' +[ 50%] Building C object CMakeFiles/GB_jit__trans_bind1st__0000eee0efe41__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/d3/GB_jit__trans_bind1st__0000eee0efe41__multgauss.c.o [100%] Linking C shared library libGB_jit__trans_bind1st__0000eee0efe41__multgauss.so [100%] Built target GB_jit__trans_bind1st__0000eee0efe41__multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/07d1cb825d4304d3' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/07d1cb825d4304d3' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/d3/libGB_jit__trans_bind1st__0000eee0efe41__multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/d3/libGB_jit__trans_bind1st__0000eee0efe41__multgauss.so (full to sparse) - 0.673 sec ] + 0.678 sec ] =============== Gauss C = (1,-2)*A': @@ -719,19 +701,19 @@ void realgauss (int32_t *z, const gauss *x) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5c78101d6e73dc21 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5c78101d6e73dc21' -[ 50%] Building C object CMakeFiles/GB_jit__apply_unop__00006e06ef__realgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/21/GB_jit__apply_unop__00006e06ef__realgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/5c78101d6e73dc21 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/5c78101d6e73dc21' +[ 50%] Building C object CMakeFiles/GB_jit__apply_unop__00006e06ef__realgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/21/GB_jit__apply_unop__00006e06ef__realgauss.c.o [100%] Linking C shared library libGB_jit__apply_unop__00006e06ef__realgauss.so [100%] Built target GB_jit__apply_unop__00006e06ef__realgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5c78101d6e73dc21' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/5c78101d6e73dc21' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/21/libGB_jit__apply_unop__00006e06ef__realgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/21/libGB_jit__apply_unop__00006e06ef__realgauss.so - 0.621 sec ] + 0.639 sec ] 4x4 GraphBLAS int32_t matrix, full by row - R, 16 entries, memory: 280 bytes + R, 16 entries, memory: 296 bytes (0,0) 17 (0,1) 38 @@ -769,19 +751,19 @@ row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b799fc2c5b29ec49 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b799fc2c5b29ec49' -[ 50%] Building C object CMakeFiles/GB_jit__trans_unop__08006e06ef__realgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/49/GB_jit__trans_unop__08006e06ef__realgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/b799fc2c5b29ec49 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/b799fc2c5b29ec49' +[ 50%] Building C object CMakeFiles/GB_jit__trans_unop__08006e06ef__realgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/49/GB_jit__trans_unop__08006e06ef__realgauss.c.o [100%] Linking C shared library libGB_jit__trans_unop__08006e06ef__realgauss.so [100%] Built target GB_jit__trans_unop__08006e06ef__realgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b799fc2c5b29ec49' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/b799fc2c5b29ec49' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/49/libGB_jit__trans_unop__08006e06ef__realgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/49/libGB_jit__trans_unop__08006e06ef__realgauss.so - 0.631 sec ] + 0.616 sec ] 4x4 GraphBLAS int32_t matrix, full by row - R, 16 entries, memory: 280 bytes + R, 16 entries, memory: 296 bytes (0,0) 17 (0,1) 11 @@ -819,21 +801,21 @@ row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/4e606820337e573c -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/4e606820337e573c' -[ 50%] Building C object CMakeFiles/GB_jit__apply_unop__07fe8ee8ef__ijgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/3c/GB_jit__apply_unop__07fe8ee8ef__ijgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/4e606820337e573c +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/4e606820337e573c' +[ 50%] Building C object CMakeFiles/GB_jit__apply_unop__07fe8ee8ef__ijgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/3c/GB_jit__apply_unop__07fe8ee8ef__ijgauss.c.o [100%] Linking C shared library libGB_jit__apply_unop__07fe8ee8ef__ijgauss.so [100%] Built target GB_jit__apply_unop__07fe8ee8ef__ijgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/4e606820337e573c' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/4e606820337e573c' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/3c/libGB_jit__apply_unop__07fe8ee8ef__ijgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/3c/libGB_jit__apply_unop__07fe8ee8ef__ijgauss.so - 0.626 sec ] + 0.644 sec ] R = ijgauss (C) 4x4 GraphBLAS int64_t matrix, full by row - R, 16 entries, memory: 344 bytes + R, 16 entries, memory: 360 bytes (0,0) 18 (0,1) 38 @@ -852,25 +834,8 @@ R = ijgauss (C) (3,2) 10 (3,3) 11 - [ GrB_Matrix_extractTuples (A full) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5660a671ca40c48b -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5660a671ca40c48b' -[ 50%] Building C object CMakeFiles/GB_jit__apply_unop__0002bb0b8f.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/8b/GB_jit__apply_unop__0002bb0b8f.c.o -[100%] Linking C shared library libGB_jit__apply_unop__0002bb0b8f.so -[100%] Built target GB_jit__apply_unop__0002bb0b8f -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/5660a671ca40c48b' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/8b/libGB_jit__apply_unop__0002bb0b8f.so - - 0.6 sec ] + [ GrB_Matrix_extractTuples (A full) + 4.07e-05 sec ] R (0,0) = 18 R (0,1) = 38 R (0,2) = 58 @@ -906,16 +871,16 @@ row 3: ( -1, -23) ( 6, -52) ( 8, -76) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/20f5326f3ffc493d -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/20f5326f3ffc493d' -[ 50%] Building C object CMakeFiles/GB_jit__trans_unop__0802ee0eef__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/3d/GB_jit__trans_unop__0802ee0eef__gauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/20f5326f3ffc493d +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/20f5326f3ffc493d' +[ 50%] Building C object CMakeFiles/GB_jit__trans_unop__0802ee0eef__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/3d/GB_jit__trans_unop__0802ee0eef__gauss.c.o [100%] Linking C shared library libGB_jit__trans_unop__0802ee0eef__gauss.so [100%] Built target GB_jit__trans_unop__0802ee0eef__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/20f5326f3ffc493d' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/20f5326f3ffc493d' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/3d/libGB_jit__trans_unop__0802ee0eef__gauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/3d/libGB_jit__trans_unop__0802ee0eef__gauss.so - 0.626 sec ] + 0.644 sec ] =============== C = C' @@ -927,7 +892,7 @@ row 2: ( 59, -38) ( 52, -44) ( 30, -60) ( 8, -76) row 3: ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) [ GxB_set (in-place transpose) (transpose) - 2.9e-05 sec ] + 2.09e-05 sec ] [ GxB_Matrix_concat (sparse concat) (transpose) (bitmap/full transpose) (transpose) (transpose) (1-thread bucket transpose) (jit: compile and load) (jit: cmake) -- The C compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info @@ -937,67 +902,16 @@ row 3: ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/f6daeb95a8060316 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/f6daeb95a8060316' -[ 50%] Building C object CMakeFiles/GB_jit__trans_unop__0802ee0ee5__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/16/GB_jit__trans_unop__0802ee0ee5__gauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/f6daeb95a8060316 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/f6daeb95a8060316' +[ 50%] Building C object CMakeFiles/GB_jit__trans_unop__0802ee0ee5__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/16/GB_jit__trans_unop__0802ee0ee5__gauss.c.o [100%] Linking C shared library libGB_jit__trans_unop__0802ee0ee5__gauss.so [100%] Built target GB_jit__trans_unop__0802ee0ee5__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/f6daeb95a8060316' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/16/libGB_jit__trans_unop__0802ee0ee5__gauss.so -(transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/48b856264c49fbf7 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/48b856264c49fbf7' -[ 50%] Building C object CMakeFiles/GB_jit__concat_sparse__0802ee0ee7__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/f7/GB_jit__concat_sparse__0802ee0ee7__gauss.c.o -[100%] Linking C shared library libGB_jit__concat_sparse__0802ee0ee7__gauss.so -[100%] Built target GB_jit__concat_sparse__0802ee0ee7__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/48b856264c49fbf7' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/f6daeb95a8060316' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/f7/libGB_jit__concat_sparse__0802ee0ee7__gauss.so -(jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b74773f44d3a63e0 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b74773f44d3a63e0' -[ 50%] Building C object CMakeFiles/GB_jit__concat_sparse__0802ee0ee4__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/e0/GB_jit__concat_sparse__0802ee0ee4__gauss.c.o -[100%] Linking C shared library libGB_jit__concat_sparse__0802ee0ee4__gauss.so -[100%] Built target GB_jit__concat_sparse__0802ee0ee4__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b74773f44d3a63e0' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/e0/libGB_jit__concat_sparse__0802ee0ee4__gauss.so -(jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ca722575fc658dc5 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ca722575fc658dc5' -[ 50%] Building C object CMakeFiles/GB_jit__concat_sparse__0802ee0ee5__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/c5/GB_jit__concat_sparse__0802ee0ee5__gauss.c.o -[100%] Linking C shared library libGB_jit__concat_sparse__0802ee0ee5__gauss.so -[100%] Built target GB_jit__concat_sparse__0802ee0ee5__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/ca722575fc658dc5' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/c5/libGB_jit__concat_sparse__0802ee0ee5__gauss.so - - 2.63 sec ] +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/16/libGB_jit__trans_unop__0802ee0ee5__gauss.so +(transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) + 0.659 sec ] =============== Z = [C D ; E E ; D C] @@ -1261,7 +1175,7 @@ row 255: . . . ( 42, -16) ( 80, -50) ( 70, -60 256x8 GraphBLAS gauss matrix, sparse by col - Z, 40 entries, memory: 928 bytes + Z, 40 entries, memory: 944 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1304,25 +1218,8 @@ row 255: . . . ( 42, -16) ( 80, -50) ( 70, -60 (254,7) [user-defined value] (255,7) [user-defined value] - [ GxB_Matrix_split (sparse/hyper split) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/bc6fbb55201f367c -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/bc6fbb55201f367c' -[ 50%] Building C object CMakeFiles/GB_jit__split_sparse__0802ee0ee5__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/7c/GB_jit__split_sparse__0802ee0ee5__gauss.c.o -[100%] Linking C shared library libGB_jit__split_sparse__0802ee0ee5__gauss.so -[100%] Built target GB_jit__split_sparse__0802ee0ee5__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/bc6fbb55201f367c' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/7c/libGB_jit__split_sparse__0802ee0ee5__gauss.so - - 0.647 sec ] + [ GxB_Matrix_split (sparse/hyper split) + 3.36e-05 sec ] =============== C Tile from Z: @@ -1459,7 +1356,7 @@ row 127: . . . 128x3 GraphBLAS gauss matrix, sparse by col - CTiles [k], 12 entries, memory: 440 bytes + CTiles [k], 12 entries, memory: 456 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1610,7 +1507,7 @@ row 127: . . . . . 128x5 GraphBLAS gauss matrix, sparse by col - CTiles [k], 8 entries, memory: 392 bytes + CTiles [k], 8 entries, memory: 408 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -1757,7 +1654,7 @@ row 127: . . . 128x3 GraphBLAS gauss matrix, sparse by col - CTiles [k], 3 entries, memory: 296 bytes + CTiles [k], 3 entries, memory: 312 bytes (124,0) [user-defined value] (125,1) [user-defined value] @@ -1899,7 +1796,7 @@ row 127: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) 128x5 GraphBLAS gauss matrix, sparse by col - CTiles [k], 17 entries, memory: 536 bytes + CTiles [k], 17 entries, memory: 552 bytes (127,0) [user-defined value] (124,1) [user-defined value] @@ -1920,60 +1817,9 @@ row 127: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) (127,4) [user-defined value] [ GxB_set (in-place transpose) (transpose) - 1.6e-05 sec ] - [ GxB_Matrix_concat (bitmap concat) (transpose) (bitmap/full transpose) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/0c3e9de2e5d73a82 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/0c3e9de2e5d73a82' -[ 50%] Building C object CMakeFiles/GB_jit__concat_bitmap__0802ee0eeb__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/82/GB_jit__concat_bitmap__0802ee0eeb__gauss.c.o -[100%] Linking C shared library libGB_jit__concat_bitmap__0802ee0eeb__gauss.so -[100%] Built target GB_jit__concat_bitmap__0802ee0eeb__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/0c3e9de2e5d73a82' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/82/libGB_jit__concat_bitmap__0802ee0eeb__gauss.so -(transpose) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/068b643968f6613c -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/068b643968f6613c' -[ 50%] Building C object CMakeFiles/GB_jit__concat_bitmap__0802ee0ee8__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/3c/GB_jit__concat_bitmap__0802ee0ee8__gauss.c.o -[100%] Linking C shared library libGB_jit__concat_bitmap__0802ee0ee8__gauss.so -[100%] Built target GB_jit__concat_bitmap__0802ee0ee8__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/068b643968f6613c' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/3c/libGB_jit__concat_bitmap__0802ee0ee8__gauss.so -(transpose) (1-thread bucket transpose) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/e363064d750a735e -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/e363064d750a735e' -[ 50%] Building C object CMakeFiles/GB_jit__concat_bitmap__0802ee0ee9__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/5e/GB_jit__concat_bitmap__0802ee0ee9__gauss.c.o -[100%] Linking C shared library libGB_jit__concat_bitmap__0802ee0ee9__gauss.so -[100%] Built target GB_jit__concat_bitmap__0802ee0ee9__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/e363064d750a735e' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/5e/libGB_jit__concat_bitmap__0802ee0ee9__gauss.so -(transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) - 1.97 sec ] + 9.74e-06 sec ] + [ GxB_Matrix_concat (bitmap concat) (transpose) (bitmap/full transpose) (transpose) (transpose) (1-thread bucket transpose) (transpose) (1-thread bucket transpose) (transpose) (transpose) (bitmap/full transpose) + 7.15e-05 sec ] =============== Z = [C D ; E E ; D C] @@ -1997,7 +1843,7 @@ row 15: . . . ( 42, -16) ( 80, -50) ( 70, -60) 16x8 GraphBLAS gauss matrix, bitmap by col - Z, 40 entries, memory: 1.3 KB + Z, 40 entries, memory: 1.4 KB (0,0) [user-defined value] (1,0) [user-defined value] @@ -2040,25 +1886,8 @@ row 15: . . . ( 42, -16) ( 80, -50) ( 70, -60) (14,7) [user-defined value] (15,7) [user-defined value] - [ GxB_Matrix_split (bitmap split) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/f5d9f01d1b2c9447 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/f5d9f01d1b2c9447' -[ 50%] Building C object CMakeFiles/GB_jit__split_bitmap__0802ee0eea__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/47/GB_jit__split_bitmap__0802ee0eea__gauss.c.o -[100%] Linking C shared library libGB_jit__split_bitmap__0802ee0eea__gauss.so -[100%] Built target GB_jit__split_bitmap__0802ee0eea__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/f5d9f01d1b2c9447' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/47/libGB_jit__split_bitmap__0802ee0eea__gauss.so - - 0.614 sec ] + [ GxB_Matrix_split (bitmap split) + 1.78e-05 sec ] =============== C Tile from Z: @@ -2075,7 +1904,7 @@ row 7: . . . 8x3 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 12 entries, memory: 432 bytes + CTiles [k], 12 entries, memory: 448 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -2106,7 +1935,7 @@ row 7: . . . . . 8x5 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 8 entries, memory: 576 bytes + CTiles [k], 8 entries, memory: 592 bytes (0,0) [user-defined value] (1,0) [user-defined value] @@ -2133,7 +1962,7 @@ row 7: . . . 8x3 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 3 entries, memory: 432 bytes + CTiles [k], 3 entries, memory: 448 bytes (4,0) [user-defined value] (5,1) [user-defined value] @@ -2155,7 +1984,7 @@ row 7: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) 8x5 GraphBLAS gauss matrix, bitmap by col - CTiles [k], 17 entries, memory: 576 bytes + CTiles [k], 17 entries, memory: 592 bytes (7,0) [user-defined value] (4,1) [user-defined value] @@ -2184,16 +2013,16 @@ row 7: ( 42, -16) ( 80, -50) ( 70, -60) ( 40, -80) ( 10,-100) -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/bcb251ed7f212866 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/bcb251ed7f212866' -[ 50%] Building C object CMakeFiles/GB_jit__subassign_22__1000eee0eec8__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/66/GB_jit__subassign_22__1000eee0eec8__addgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/bcb251ed7f212866 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/bcb251ed7f212866' +[ 50%] Building C object CMakeFiles/GB_jit__subassign_22__1000eee0eec8__addgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/66/GB_jit__subassign_22__1000eee0eec8__addgauss.c.o [100%] Linking C shared library libGB_jit__subassign_22__1000eee0eec8__addgauss.so [100%] Built target GB_jit__subassign_22__1000eee0eec8__addgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/bcb251ed7f212866' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/bcb251ed7f212866' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/66/libGB_jit__subassign_22__1000eee0eec8__addgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/66/libGB_jit__subassign_22__1000eee0eec8__addgauss.so - 0.639 sec ] + 0.643 sec ] =============== C = C + ciso @@ -2205,26 +2034,9 @@ row 2: ( 60, -40) ( 53, -46) ( 31, -62) ( 9, -78) row 3: ( 81, -52) ( 71, -62) ( 41, -82) ( 11,-102) [ GxB_set - 6.48e-07 sec ] - [ GxB_Matrix_split (full split) (jit: compile and load) (jit: cmake) --- The C compiler identification is GNU 9.4.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.3s) --- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b25a3ffd809024d5 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b25a3ffd809024d5' -[ 50%] Building C object CMakeFiles/GB_jit__split_full__0802ee0eef__gauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/d5/GB_jit__split_full__0802ee0eef__gauss.c.o -[100%] Linking C shared library libGB_jit__split_full__0802ee0eef__gauss.so -[100%] Built target GB_jit__split_full__0802ee0eef__gauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/b25a3ffd809024d5' --- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/d5/libGB_jit__split_full__0802ee0eef__gauss.so - - 0.612 sec ] + 7.84e-07 sec ] + [ GxB_Matrix_split (full split) + 2.92e-05 sec ] =============== S Tile from C: @@ -2235,7 +2047,7 @@ row 0: ( 18, -16) ( 12, -19) 1x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 2 entries, memory: 232 bytes + STiles [k], 2 entries, memory: 248 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -2250,7 +2062,7 @@ row 0: ( 6, -22) ( 0, -25) 1x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 2 entries, memory: 232 bytes + STiles [k], 2 entries, memory: 248 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -2267,7 +2079,7 @@ row 2: ( 81, -52) ( 71, -62) 3x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 6 entries, memory: 264 bytes + STiles [k], 6 entries, memory: 280 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -2288,7 +2100,7 @@ row 2: ( 41, -82) ( 11,-102) 3x2 GraphBLAS gauss matrix, full by row sparsity control: full - STiles [k], 6 entries, memory: 264 bytes + STiles [k], 6 entries, memory: 280 bytes (0,0) [user-defined value] (0,1) [user-defined value] @@ -2309,7 +2121,7 @@ row 2: ( 60, -40) ( 53, -46) ( 31, -62) ( 9, -78) row 3: ( 81, -52) ( 71, -62) ( 41, -82) ( 11,-102) [ GrB_assign (pending: 0) Method 22: (C full) += scalar (generic C(:,:)+=x assign) - 3.18e-05 sec ] + 3.51e-05 sec ] =============== C = C + ciso (JIT paused): @@ -2331,7 +2143,7 @@ row 2: ( 61, -42) ( 54, -48) ( 32, -64) ( 10, -80) row 3: ( 82, -54) ( 72, -64) ( 42, -84) ( 12,-104) [ GrB_assign (pending: 0) Method 22: (C full) += scalar (generic C(:,:)+=x assign) - 1.81e-05 sec ] + 1.82e-05 sec ] =============== C = C * ciso (JIT paused): @@ -2344,7 +2156,7 @@ row 3: ( -26,-218) ( -56,-208) (-126,-168) (-196,-128) JIT: run (may not load or compile) [ GrB_assign (pending: 0) Method 22: (C full) += scalar - 1.4e-05 sec ] + 1.47e-05 sec ] =============== C = C + ciso (JIT run): @@ -2356,7 +2168,7 @@ row 2: ( -22,-166) ( -41,-158) ( -95,-130) (-149,-102) row 3: ( -25,-220) ( -55,-210) (-125,-170) (-195,-130) [ GrB_assign (pending: 0) Method 22: (C full) += scalar (generic C(:,:)+=x assign) - 1.76e-05 sec ] + 1.82e-05 sec ] =============== C = C * ciso (JIT not loaded): @@ -2377,16 +2189,16 @@ JIT: on -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) --- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/7a164201169278d1 -gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/7a164201169278d1' -[ 50%] Building C object CMakeFiles/GB_jit__subassign_22__1000eee0eec8__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/d1/GB_jit__subassign_22__1000eee0eec8__multgauss.c.o +-- Build files have been written to: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/7a164201169278d1 +gmake[1]: Entering directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/7a164201169278d1' +[ 50%] Building C object CMakeFiles/GB_jit__subassign_22__1000eee0eec8__multgauss.dir/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/d1/GB_jit__subassign_22__1000eee0eec8__multgauss.c.o [100%] Linking C shared library libGB_jit__subassign_22__1000eee0eec8__multgauss.so [100%] Built target GB_jit__subassign_22__1000eee0eec8__multgauss -gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/tmp/7a164201169278d1' +gmake[1]: Leaving directory '/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/tmp/7a164201169278d1' -- Install configuration: "" --- Installing: /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/d1/libGB_jit__subassign_22__1000eee0eec8__multgauss.so +-- Installing: /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/d1/libGB_jit__subassign_22__1000eee0eec8__multgauss.so - 0.627 sec ] + 0.661 sec ] =============== C = C * ciso (full JIT): diff --git a/GraphBLAS/Demo/Output/import_demo.out b/GraphBLAS/Demo/Output/import_demo.out index 13be0e9b98..dc72b3c9b0 100644 --- a/GraphBLAS/Demo/Output/import_demo.out +++ b/GraphBLAS/Demo/Output/import_demo.out @@ -4,7 +4,7 @@ ========================= import_test: format 0 67x67 GraphBLAS double matrix, sparse by row - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (0,7) -0.834182 (0,12) 1.26582 @@ -40,7 +40,7 @@ ========================= import_test: format 1 67x67 GraphBLAS double matrix, sparse by row - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (0,7) -0.834182 (0,12) 1.26582 @@ -76,7 +76,7 @@ ========================= import_test: format 2 67x67 GraphBLAS double matrix, sparse by row - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (0,7) -0.834182 (0,12) 1.26582 @@ -112,7 +112,7 @@ ========================= import_test: format 3 67x67 GraphBLAS double matrix, sparse by row - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (0,7) -0.834182 (0,12) 1.26582 @@ -150,7 +150,7 @@ ========================= import_test: format 0 67x67 GraphBLAS double matrix, sparse by col - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (4,0) -0.278842 (5,0) -0.268019 @@ -186,7 +186,7 @@ ========================= import_test: format 1 67x67 GraphBLAS double matrix, sparse by col - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (4,0) -0.278842 (5,0) -0.268019 @@ -222,7 +222,7 @@ ========================= import_test: format 2 67x67 GraphBLAS double matrix, sparse by col - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (4,0) -0.278842 (5,0) -0.268019 @@ -258,7 +258,7 @@ ========================= import_test: format 3 67x67 GraphBLAS double matrix, sparse by col - C to export, 294 entries, memory: 5.3 KB + C to export, 294 entries, memory: 5.4 KB (4,0) -0.278842 (5,0) -0.268019 diff --git a/GraphBLAS/Demo/Output/openmp_demo.out b/GraphBLAS/Demo/Output/openmp_demo.out index 7c05985184..1984601419 100644 --- a/GraphBLAS/Demo/Output/openmp_demo.out +++ b/GraphBLAS/Demo/Output/openmp_demo.out @@ -3,44 +3,49 @@ User threads in this program are OpenMP threads. ================= worker 0 starts: -================= worker 6 starts: - -================= worker 3 starts: - -================= worker 1 starts: +================= worker 4 starts: ================= worker 2 starts: -================= worker 5 starts: +================= worker 3 starts: -================= worker 4 starts: +================= worker 6 starts: ================= worker 7 starts: +================= worker 1 starts: + +================= worker 5 starts: + ----------------- worker 0 intentional error: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) Row index 1000 out of range; must be < 6 ------------------ worker 4 intentional error: +----------------- worker 7 intentional error: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1004 out of range; must be < 6 +Row index 1007 out of range; must be < 6 + +----------------- worker 3 intentional error: +GraphBLAS error: GrB_INVALID_INDEX +function: GrB_Matrix_setElement_INT32 (C, row, col, x) +Row index 1003 out of range; must be < 6 ----------------- worker 6 intentional error: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) Row index 1006 out of range; must be < 6 ------------------ worker 3 intentional error: +----------------- worker 4 intentional error: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1003 out of range; must be < 6 +Row index 1004 out of range; must be < 6 ------------------ worker 7 intentional error: +----------------- worker 1 intentional error: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1007 out of range; must be < 6 +Row index 1001 out of range; must be < 6 ----------------- worker 2 intentional error: GraphBLAS error: GrB_INVALID_INDEX @@ -52,15 +57,10 @@ GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) Row index 1005 out of range; must be < 6 ------------------ worker 1 intentional error: -GraphBLAS error: GrB_INVALID_INDEX -function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1001 out of range; must be < 6 - ----------------- worker 0 is done: 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101000 (0,1) 102000 @@ -93,46 +93,164 @@ Row index 1001 out of range; must be < 6 (4,4) 505000 ... ------------------ worker 1 is done: +----------------- worker 6 is done: 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes - (0,0) 101001 - (0,1) 102001 - (0,2) 103001 - (0,3) 104001 - (0,4) 105001 - (0,5) 106001 - (1,0) 201001 - (1,1) 202001 - (1,2) 203001 - (1,3) 204001 - (1,4) 205001 - (1,5) 206001 - (2,0) 301001 - (2,1) 302001 - (2,2) 303001 - (2,3) 304001 - (2,4) 305001 - (2,5) 306001 - (3,0) 401001 - (3,1) 402001 - (3,2) 403001 - (3,3) 404001 - (3,4) 405001 - (3,5) 406001 - (4,0) 501001 - (4,1) 502001 - (4,2) 503001 - (4,3) 504001 - (4,4) 505001 + (0,0) 101006 + (0,1) 102006 + (0,2) 103006 + (0,3) 104006 + (0,4) 105006 + (0,5) 106006 + (1,0) 201006 + (1,1) 202006 + (1,2) 203006 + (1,3) 204006 + (1,4) 205006 + (1,5) 206006 + (2,0) 301006 + (2,1) 302006 + (2,2) 303006 + (2,3) 304006 + (2,4) 305006 + (2,5) 306006 + (3,0) 401006 + (3,1) 402006 + (3,2) 403006 + (3,3) 404006 + (3,4) 405006 + (3,5) 406006 + (4,0) 501006 + (4,1) 502006 + (4,2) 503006 + (4,3) 504006 + (4,4) 505006 + ... + +----------------- worker 0 error should be same: +GraphBLAS error: GrB_INVALID_INDEX +function: GrB_Matrix_setElement_INT32 (C, row, col, x) +Row index 1000 out of range; must be < 6 + +----------------- worker 3 is done: + + 6x6 GraphBLAS double matrix, full by row + A, 36 entries, memory: 520 bytes + + (0,0) 101003 + (0,1) 102003 + (0,2) 103003 + (0,3) 104003 + (0,4) 105003 + (0,5) 106003 + (1,0) 201003 + (1,1) 202003 + (1,2) 203003 + (1,3) 204003 + (1,4) 205003 + (1,5) 206003 + (2,0) 301003 + (2,1) 302003 + (2,2) 303003 + (2,3) 304003 + (2,4) 305003 + (2,5) 306003 + (3,0) 401003 + (3,1) 402003 + (3,2) 403003 + (3,3) 404003 + (3,4) 405003 + (3,5) 406003 + (4,0) 501003 + (4,1) 502003 + (4,2) 503003 + (4,3) 504003 + (4,4) 505003 + ... + +----------------- worker 4 is done: + + 6x6 GraphBLAS double matrix, full by row + A, 36 entries, memory: 520 bytes + + (0,0) 101004 + (0,1) 102004 + (0,2) 103004 + (0,3) 104004 + (0,4) 105004 + (0,5) 106004 + (1,0) 201004 + (1,1) 202004 + (1,2) 203004 + (1,3) 204004 + (1,4) 205004 + (1,5) 206004 + (2,0) 301004 + (2,1) 302004 + (2,2) 303004 + (2,3) 304004 + (2,4) 305004 + (2,5) 306004 + (3,0) 401004 + (3,1) 402004 + (3,2) 403004 + (3,3) 404004 + (3,4) 405004 + (3,5) 406004 + (4,0) 501004 + (4,1) 502004 + (4,2) 503004 + (4,3) 504004 + (4,4) 505004 + ... + +----------------- worker 2 is done: + + 6x6 GraphBLAS double matrix, full by row + A, 36 entries, memory: 520 bytes + + (0,0) 101002 + (0,1) 102002 + (0,2) 103002 + (0,3) 104002 + (0,4) 105002 + (0,5) 106002 + (1,0) 201002 + (1,1) 202002 + (1,2) 203002 + (1,3) 204002 + (1,4) 205002 + (1,5) 206002 + (2,0) 301002 + (2,1) 302002 + (2,2) 303002 + (2,3) 304002 + (2,4) 305002 + (2,5) 306002 + (3,0) 401002 + (3,1) 402002 + (3,2) 403002 + (3,3) 404002 + (3,4) 405002 + (3,5) 406002 + (4,0) 501002 + (4,1) 502002 + (4,2) 503002 + (4,3) 504002 + (4,4) 505002 ... +----------------- worker 3 error should be same: +GraphBLAS error: GrB_INVALID_INDEX +function: GrB_Matrix_setElement_INT32 (C, row, col, x) +Row index 1003 out of range; must be < 6 + ----------------- worker 5 is done: 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101005 (0,1) 102005 @@ -165,51 +283,46 @@ Row index 1001 out of range; must be < 6 (4,4) 505005 ... ------------------ worker 6 is done: +----------------- worker 1 is done: 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes - (0,0) 101006 - (0,1) 102006 - (0,2) 103006 - (0,3) 104006 - (0,4) 105006 - (0,5) 106006 - (1,0) 201006 - (1,1) 202006 - (1,2) 203006 - (1,3) 204006 - (1,4) 205006 - (1,5) 206006 - (2,0) 301006 - (2,1) 302006 - (2,2) 303006 - (2,3) 304006 - (2,4) 305006 - (2,5) 306006 - (3,0) 401006 - (3,1) 402006 - (3,2) 403006 - (3,3) 404006 - (3,4) 405006 - (3,5) 406006 - (4,0) 501006 - (4,1) 502006 - (4,2) 503006 - (4,3) 504006 - (4,4) 505006 + (0,0) 101001 + (0,1) 102001 + (0,2) 103001 + (0,3) 104001 + (0,4) 105001 + (0,5) 106001 + (1,0) 201001 + (1,1) 202001 + (1,2) 203001 + (1,3) 204001 + (1,4) 205001 + (1,5) 206001 + (2,0) 301001 + (2,1) 302001 + (2,2) 303001 + (2,3) 304001 + (2,4) 305001 + (2,5) 306001 + (3,0) 401001 + (3,1) 402001 + (3,2) 403001 + (3,3) 404001 + (3,4) 405001 + (3,5) 406001 + (4,0) 501001 + (4,1) 502001 + (4,2) 503001 + (4,3) 504001 + (4,4) 505001 ... ------------------ worker 1 error should be same: -GraphBLAS error: GrB_INVALID_INDEX -function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1001 out of range; must be < 6 - ----------------- worker 7 is done: 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101007 (0,1) 102007 @@ -242,153 +355,40 @@ Row index 1001 out of range; must be < 6 (4,4) 505007 ... ------------------ worker 0 error should be same: -GraphBLAS error: GrB_INVALID_INDEX -function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1000 out of range; must be < 6 - ------------------ worker 2 is done: - - 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes - - (0,0) 101002 - (0,1) 102002 - (0,2) 103002 - (0,3) 104002 - (0,4) 105002 - (0,5) 106002 - (1,0) 201002 - (1,1) 202002 - (1,2) 203002 - (1,3) 204002 - (1,4) 205002 - (1,5) 206002 - (2,0) 301002 - (2,1) 302002 - (2,2) 303002 - (2,3) 304002 - (2,4) 305002 - (2,5) 306002 - (3,0) 401002 - (3,1) 402002 - (3,2) 403002 - (3,3) 404002 - (3,4) 405002 - (3,5) 406002 - (4,0) 501002 - (4,1) 502002 - (4,2) 503002 - (4,3) 504002 - (4,4) 505002 - ... - ----------------- worker 6 error should be same: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) Row index 1006 out of range; must be < 6 ------------------ worker 7 error should be same: +----------------- worker 5 error should be same: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1007 out of range; must be < 6 +Row index 1005 out of range; must be < 6 ------------------ worker 5 error should be same: +----------------- worker 7 error should be same: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1005 out of range; must be < 6 +Row index 1007 out of range; must be < 6 ----------------- worker 2 error should be same: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) Row index 1002 out of range; must be < 6 ------------------ worker 4 is done: - - 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes - - (0,0) 101004 - (0,1) 102004 - (0,2) 103004 - (0,3) 104004 - (0,4) 105004 - (0,5) 106004 - (1,0) 201004 - (1,1) 202004 - (1,2) 203004 - (1,3) 204004 - (1,4) 205004 - (1,5) 206004 - (2,0) 301004 - (2,1) 302004 - (2,2) 303004 - (2,3) 304004 - (2,4) 305004 - (2,5) 306004 - (3,0) 401004 - (3,1) 402004 - (3,2) 403004 - (3,3) 404004 - (3,4) 405004 - (3,5) 406004 - (4,0) 501004 - (4,1) 502004 - (4,2) 503004 - (4,3) 504004 - (4,4) 505004 - ... - ------------------ worker 3 is done: - - 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes - - (0,0) 101003 - (0,1) 102003 - (0,2) 103003 - (0,3) 104003 - (0,4) 105003 - (0,5) 106003 - (1,0) 201003 - (1,1) 202003 - (1,2) 203003 - (1,3) 204003 - (1,4) 205003 - (1,5) 206003 - (2,0) 301003 - (2,1) 302003 - (2,2) 303003 - (2,3) 304003 - (2,4) 305003 - (2,5) 306003 - (3,0) 401003 - (3,1) 402003 - (3,2) 403003 - (3,3) 404003 - (3,4) 405003 - (3,5) 406003 - (4,0) 501003 - (4,1) 502003 - (4,2) 503003 - (4,3) 504003 - (4,4) 505003 - ... - ----------------- worker 4 error should be same: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) Row index 1004 out of range; must be < 6 ------------------ worker 3 error should be same: +----------------- worker 1 error should be same: GraphBLAS error: GrB_INVALID_INDEX function: GrB_Matrix_setElement_INT32 (C, row, col, x) -Row index 1003 out of range; must be < 6 +Row index 1001 out of range; must be < 6 ---- Leader prints matrix 0 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101000 (0,1) 102000 @@ -424,7 +424,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 1 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101001 (0,1) 102001 @@ -460,7 +460,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 2 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101002 (0,1) 102002 @@ -496,7 +496,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 3 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101003 (0,1) 102003 @@ -532,7 +532,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 4 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101004 (0,1) 102004 @@ -568,7 +568,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 5 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101005 (0,1) 102005 @@ -604,7 +604,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 6 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101006 (0,1) 102006 @@ -640,7 +640,7 @@ Row index 1003 out of range; must be < 6 ---- Leader prints matrix 7 6x6 GraphBLAS double matrix, full by row - A, 36 entries, memory: 504 bytes + A, 36 entries, memory: 520 bytes (0,0) 101007 (0,1) 102007 diff --git a/GraphBLAS/Demo/Output/wildtype_demo.out b/GraphBLAS/Demo/Output/wildtype_demo.out index 24fc339563..c7e73afe6b 100644 --- a/GraphBLAS/Demo/Output/wildtype_demo.out +++ b/GraphBLAS/Demo/Output/wildtype_demo.out @@ -1,5 +1,5 @@ [ GxB_Type_new - 9.21e-06 sec ] + 9.48e-06 sec ] GraphBLAS type: WildType user-defined: [wildtype] size: 192 typedef struct { double stuff [4][4] ; char whatstuff [64] ; } wildtype ; WildType size: 192 @@ -11,8 +11,8 @@ a wildtype scalar: scalar1 [this is from scalar1] 100.0 101.0 102.0 103.0 200.0 201.0 202.0 203.0 300.0 301.0 302.0 303.0 -(iso wait:C (setElement:to non-iso) 0 zombies, 1 pending) [ GrB_transpose (wait:A 0 zombies, 2 pending) (build) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/de/GB_jit__build__02eeeee__wildtype.o -c /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/de/GB_jit__build__02eeeee__wildtype.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/de/libGB_jit__build__02eeeee__wildtype.so /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/de/GB_jit__build__02eeeee__wildtype.o -lm -ldl -lgomp -lpthread ") add:(H<.>=H+H) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/77/GB_jit__add__1002e0e0eee00__wildtype.o -c /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/77/GB_jit__add__1002e0e0eee00__wildtype.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/77/libGB_jit__add__1002e0e0eee00__wildtype.so /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/77/GB_jit__add__1002e0e0eee00__wildtype.o -lm -ldl -lgomp -lpthread ") (hyper to sparse) (transpose) (builder transpose) (hyper to sparse) - 0.535 sec ] +(iso wait:C (setElement:to non-iso) 0 zombies, 1 pending) [ GrB_transpose (wait:A 0 zombies, 2 pending) (build) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/de/GB_jit__build__02eeeee__wildtype.o -c /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/de/GB_jit__build__02eeeee__wildtype.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/de/libGB_jit__build__02eeeee__wildtype.so /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/de/GB_jit__build__02eeeee__wildtype.o -lm -ldl -lgomp -lpthread ") add:(H<.>=H+H) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/77/GB_jit__add__1002e0e0eee00__wildtype.o -c /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/77/GB_jit__add__1002e0e0eee00__wildtype.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/77/libGB_jit__add__1002e0e0eee00__wildtype.so /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/77/GB_jit__add__1002e0e0eee00__wildtype.o -lm -ldl -lgomp -lpthread ") (hyper to sparse) (transpose) (builder transpose) (hyper to sparse) + 0.556 sec ] a wildtype scalar: got scalar2 = C(7,2) [this is A(2,7)] 0.0 1.0 2.0 3.0 @@ -132,14 +132,14 @@ multiplication C=A*B InTheWild semiring: Printing the matrix with GxB_Matrix_fprint: 10x10 GraphBLAS wildtype matrix, sparse by row - input A, 3 entries, memory: 904 bytes + input A, 3 entries, memory: 920 bytes (2,4) [user-defined value] (2,7) [user-defined value] (3,7) [user-defined value] [ GrB_Matrix_nvals - 1.3e-06 sec ] + 1.11e-06 sec ] ============= printing the WildType matrix: input A (10-by-10 with 3 entries) @@ -184,7 +184,7 @@ Printing the matrix with GxB_Matrix_fprint: pending operator: implicit 2nd [ GrB_Matrix_nvals (wait:A 0 zombies, 2 pending) (build) add:(H<.>=H+H) (hyper to sparse) - 0.000289 sec ] + 0.000173 sec ] ============= printing the WildType matrix: input B (10-by-10 with 3 entries) @@ -213,8 +213,8 @@ a wildtype scalar: [here is B(7,5)] -2.5 -1.5 -0.5 0.5 ============= that was the WildType matrix input B - [ GrB_mxm C=A*B, saxpy (S = S*S, anz: 3 bnz: 3) axbwork 8 (intensity: 1.14 workspace/(nnz(A)+nnz(B)): 1.43) (nthreads 1 coarse: 1) (sparse saxpy) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/21/GB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.o -c /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/21/GB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/21/libGB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.so /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/21/GB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.o -lm -ldl -lgomp -lpthread ") - 0.963 sec ] + [ GrB_mxm C=A*B, saxpy (S = S*S, anz: 3 bnz: 3) axbwork 8 (intensity: 1.14 workspace/(nnz(A)+nnz(B)): 1.43) (nthreads 1 coarse: 1) (sparse saxpy) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/21/GB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.o -c /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/21/GB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/21/libGB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.so /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/21/GB_jit__AxB_saxpy3__03fe100eee0eee45__wildadd_wildmult.o -lm -ldl -lgomp -lpthread ") + 0.978 sec ] Printing the matrix with GxB_Matrix_fprint: @@ -227,7 +227,7 @@ Printing the matrix with GxB_Matrix_fprint: (3,5) [user-defined value] [ GrB_Matrix_nvals - 3.43e-07 sec ] + 5.17e-07 sec ] ============= printing the WildType matrix: output C (10-by-10 with 4 entries) @@ -270,7 +270,7 @@ a wildtype scalar: [this was multiplied] The mask matrix M: 10x10 GraphBLAS bool matrix, hypersparse by row - M, no entries, memory: 4.3 KB + M, no entries, memory: 4.4 KB iso value: 1 pending tuples: 4 max pending: 256 zombies: 0 pending tuples: @@ -281,9 +281,8 @@ The mask matrix M: row: 3 col: 3 pending operator: implicit 2nd - [ GrB_mxm (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C=A'*B, masked_dot_product (dot3) (S{S} = S'*S) Not using cuda path: type size not supported -nthreads 1 ntasks 1 (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/0f/GB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.o -c /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/0f/GB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/0f/libGB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.so /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/0f/GB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.o -lm -ldl -lgomp -lpthread ") - 0.563 sec ] + [ GrB_mxm (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C=A'*B, masked_dot_product (dot3) (S{S} = S'*S) nthreads 1 ntasks 1 (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/0f/GB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.o -c /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/0f/GB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/0f/libGB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.so /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/0f/GB_jit__AxB_dot3__03fe100eee2eee55__wildadd_wildmult.o -lm -ldl -lgomp -lpthread ") + 0.51 sec ] Printing the matrix with GxB_Matrix_fprint: @@ -296,7 +295,7 @@ Printing the matrix with GxB_Matrix_fprint: (3,3) [user-defined value] [ GrB_Matrix_nvals - 3.2e-07 sec ] + 4.27e-07 sec ] ============= printing the WildType matrix: output C (10-by-10 with 4 entries) @@ -333,26 +332,24 @@ a wildtype scalar: [this was added] -13424304.0 -2565388.0 6850828.0 16267044.0 ============= that was the WildType matrix output C - [ GrB_reduce Not using cuda path: type size not supported -(jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b7/GB_jit__reduce__03feee1__wildadd.o -c /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b7/GB_jit__reduce__03feee1__wildadd.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/b7/libGB_jit__reduce__03feee1__wildadd.so /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/b7/GB_jit__reduce__03feee1__wildadd.o -lm -ldl -lgomp -lpthread ") - 0.24 sec ] + [ GrB_reduce (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b7/GB_jit__reduce__03feee1__wildadd.o -c /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b7/GB_jit__reduce__03feee1__wildadd.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/b7/libGB_jit__reduce__03feee1__wildadd.so /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/b7/GB_jit__reduce__03feee1__wildadd.o -lm -ldl -lgomp -lpthread ") + 0.245 sec ] a wildtype scalar: sum (first time) [this was added] -111773.5 269.5 93412.5 583455.5 -49510798.5 271594.5 43367587.5 319487980.5 -92402621.5 2801413.5 85075148.5 622622583.5 -149241466.8 471094.8 130123106.2 959972867.8 - [ GrB_reduce Not using cuda path: type size not supported - - 1.59e-05 sec ] + [ GrB_reduce + 1.2e-05 sec ] a wildtype scalar: sum (again) [this was added] -111773.5 269.5 93412.5 583455.5 -49510798.5 271594.5 43367587.5 319487980.5 -92402621.5 2801413.5 85075148.5 622622583.5 -149241466.8 471094.8 130123106.2 959972867.8 - [ GxB_set (transpose) (in-place transpose) (transpose) (1-thread bucket transpose) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB8.3.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/6c/GB_jit__trans_unop__0802ee0ee5__wildtype.o -c /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/6c/GB_jit__trans_unop__0802ee0ee5__wildtype.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/lib/6c/libGB_jit__trans_unop__0802ee0ee5__wildtype.so /home/faculty/d/davis/.SuiteSparse/GrB8.3.0/c/6c/GB_jit__trans_unop__0802ee0ee5__wildtype.o -lm -ldl -lgomp -lpthread ") - 0.216 sec ] + [ GxB_set (transpose) (in-place transpose) (transpose) (1-thread bucket transpose) (jit: compile and load) (jit: sh -c "/usr/bin/cc -DGB_JIT_RUNTIME=1 -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -I/home/faculty/d/davis/.SuiteSparse/GrB9.0.0/src -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/6c/GB_jit__trans_unop__0802ee0ee5__wildtype.o -c /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/6c/GB_jit__trans_unop__0802ee0ee5__wildtype.c ; /usr/bin/cc -Wundef -std=c11 -lm -Wno-pragmas -fexcess-precision=fast -fcx-limited-range -fno-math-errno -fwrapv -O3 -DNDEBUG -fopenmp -fPIC -shared -o /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/lib/6c/libGB_jit__trans_unop__0802ee0ee5__wildtype.so /home/faculty/d/davis/.SuiteSparse/GrB9.0.0/c/6c/GB_jit__trans_unop__0802ee0ee5__wildtype.o -lm -ldl -lgomp -lpthread ") + 0.212 sec ] C is now stored by column, but it looks just the same to the GraphBLAS user application. The difference is opaque, in the @@ -369,7 +366,7 @@ Printing the matrix with GxB_Matrix_fprint: (3,3) [user-defined value] [ GrB_Matrix_nvals - 2.43e-07 sec ] + 5.4e-07 sec ] ============= printing the WildType matrix: output C (10-by-10 with 4 entries) @@ -410,32 +407,32 @@ a wildtype scalar: [this was added] Printing the matrix with GxB_Matrix_fprint: 10x10 GraphBLAS float matrix, hypersparse by row - D, no entries, memory: 240 bytes + D, no entries, memory: 256 bytes The matrix D is not wild enough to print. [ GrB_apply (shallow-op) - 2.92e-05 sec ] + 3.66e-05 sec ] 10x10 GraphBLAS int64_t matrix, sparse by row - E (positional i), 3 entries, memory: 352 bytes + E (positional i), 3 entries, memory: 368 bytes (2,4) 2 (2,7) 2 (3,7) 3 [ GrB_apply (shallow-op) - 1.15e-05 sec ] + 1.26e-05 sec ] 10x10 GraphBLAS int64_t matrix, sparse by row - E (positional j), 3 entries, memory: 352 bytes + E (positional j), 3 entries, memory: 368 bytes (2,4) 4 (2,7) 7 (3,7) 7 [ GrB_eWiseAdd - 6.52e-06 sec ] + 7.58e-06 sec ] This is supposed to fail, as a demo of GrB_error: GraphBLAS error: GrB_DOMAIN_MISMATCH diff --git a/GraphBLAS/Demo/Program/simple_demo.c b/GraphBLAS/Demo/Program/simple_demo.c index 4739e80c27..c562106ccb 100644 --- a/GraphBLAS/Demo/Program/simple_demo.c +++ b/GraphBLAS/Demo/Program/simple_demo.c @@ -9,7 +9,7 @@ /* A simple test that illustrates the use of simple_rand. - This test does not require ANSI C11, nor GraphBLAS. It only tests the + This test does not require C11, nor GraphBLAS. It only tests the simple_* Demo functions. The output of this test should look like the following. The random numbers should be the same. On a Mac OSX system: diff --git a/GraphBLAS/Doc/ChangeLog b/GraphBLAS/Doc/ChangeLog index 8617cffed5..8739c676bd 100644 --- a/GraphBLAS/Doc/ChangeLog +++ b/GraphBLAS/Doc/ChangeLog @@ -1,3 +1,23 @@ +Jan 1, 2024: version 9.0.0 + + * GrB_get/GrB_set: new functions from the v2.1 C API. + * GrB_Type_new, GrB_UnaryOp_new, GrB_IndexUnaryOp_new: no longer macros, + since GrB_set can be used to set the names of the operators. These + methods no longer extract the name, so the default name is now the + empty string. This is because GrB_get/set can only set these names + once. This is a non-compatible change of behavior for these 3 + methods, so SuiteSparse:GraphBLAS must become v9.0.0. + * historical methods: many methods are replaced by GrB_get and GrB_set. + They remain in SuiteSparse:GraphBLAS but have been declared historical. + Terse prototypes exist in GraphBLAS.h, and any discussion is removed + from the User Guide: GxB_get, GxB_set, and the methods they call, and + many more. Use GrB_get/set in place those methods, and for: + GxB_*type_name, GxB_*type, GxB_Monoid_operator, GxB_Monoid_identity, + GxB_Monoid_terminal, GxB_Semiring_add, GxB_Semiring_multiply. Use + GrB_STORAGE_ORIENTATION_HINT in place of GxB_FORMAT. + * hyper_hash: constructed only if the # of non-empty vectors in a + hypersparse matrix is large (> 1024, by default) + Dec 30, 2023: version 8.3.1 * major change to build system: by Markus Mützel @@ -5,6 +25,8 @@ Dec 30, 2023: version 8.3.1 Oct 7, 2023: version 8.2.1 + * (50) bug fix: remove undefined behavior in Source/GB_add.c with + Cnvec_nonempty, caught by Yves Vandreissche, Intel * (49) bug fix: GrB_mxm saxpy4 and saxpy5 had incorrectly handling of typecasting in v8.0.0 to v8.2.0 (caught by Erik Welch) * cross-compiler support: replace check_c_source_runs with _compiles, @@ -105,7 +127,7 @@ Version 7.4.1, Jan 9, 2023 Version 7.4.0, Dec 23, 2022 - * added non-va_arg methods: va_arg-based GxB_get/set methods are ANSI C11 + * added non-va_arg methods: va_arg-based GxB_get/set methods are 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 @@ -618,7 +640,7 @@ Version 3.1.2, Dec 16, 2019 B is a standard matrix with one or more empty vectors. * (14) bug fix for @GrB interface: A(58) and A(:) were conflated. * compiler port: changes to allow GraphBLAS to be compiled with older - compilers (pre ANSI C11), and Microsoft Visual Studio. + compilers (pre C11), and Microsoft Visual Studio. Version 3.1.1, Oct 21, 2019 @@ -719,7 +741,7 @@ Version 2.3.0, Feb 25, 2019 * added GxB_init: GrB_init with malloc/calloc/realloc/free redefinition * _Generic: compilers differ on _Generic(x,int:,const int:). gcc, clang, icc 18.0.0 treat int and const int the same; icc 18.0.3 treats them - as different. This is a result of an ambiguity in the ANSI C11 + as different. This is a result of an ambiguity in the C11 specification. Minor update so that the use of _Generic(...) is compatible with all compilers. * early exit: for GrB_reduce @@ -773,7 +795,7 @@ Version 2.2.0 (BETA4), Nov 28, 2018 Kronecker matrix generator * minor changes for gcc -Wall -Wpedantic -Wextra, and icc -w3: to fix or silence warnings. In a few cases, prior versions were relying on - extensions to the ANSI C11 standard in gcc, clang, xlc. The extensions + extensions to the C11 standard in gcc, clang, xlc. The extensions are widely supported but best avoided anway. Version 2.2.0 (BETA3), Nov 23, 2018 diff --git a/GraphBLAS/Doc/FUTURE.txt b/GraphBLAS/Doc/FUTURE.txt new file mode 100644 index 0000000000..7327aa3ccf --- /dev/null +++ b/GraphBLAS/Doc/FUTURE.txt @@ -0,0 +1,42 @@ +FUTURE plans For 9.0.1: and beyond: + +GraphBLAS: + + don't just check 1st line of GraphBLAS.h when deciding to unpack + the src in user cache folder. Use a crc test. + +CUDA: + + finding src + kernel source location, and name + +Future features: + + pack/unpack COO + kernel fusion + CUDA kernels + fine-grain parallelism for dot-product based mxm, mxv, vxm, + then add GxB_vxvt (outer product) and GxB_vtxv (inner product) + (or call them GxB_outerProduct and GxB_innerProduct?) + + aggregators + index binary ops + GrB_extract with GrB_Vectors instead of (GrB_Index *) arrays for I and J + + iso: set a flag with GrB_get/set to disable iso. useful if the matrix is + about to become non-iso anyway. Pagerank does: + + r = teleport (becomes iso) + r += A*x (becomes non-iso) + + apply: C = f(A), A dense, no mask or accum, C already dense: do in place + + JIT: allow a flag to be set in a type or operator to selectively control + the JIT + + JIT: requires GxB_BinaryOp_new to give the string that defines the op. + Allow use of + GrB_BinaryOp_new (...) + GrB_set (op, GxB_DEFN, "string" + also for all ops + diff --git a/GraphBLAS/Doc/GrB_get_set.tex b/GraphBLAS/Doc/GrB_get_set.tex new file mode 100644 index 0000000000..2c339aa93d --- /dev/null +++ b/GraphBLAS/Doc/GrB_get_set.tex @@ -0,0 +1,1642 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{GraphBLAS Options ({\sf GrB\_get} and {\sf GrB\_set})} +\label{options} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The latest v2.1 C API adds a pair of methods, \verb'GrB_get' and \verb'GrB_set' +that allows the user to query GraphBLAS objects and change their state. These +two methods are polymorphic wrappers for a suite of methods for each object. +They replace the \verb'GxB_get' and \verb'GxB_set' methods in +SuiteSparse:GraphBLAS v8.* and earlier. + +The general polymorphic signatures of these methods are given below: + +{\footnotesize +\begin{verbatim} + GrB_Info GrB_get (object, value, GrB_Field field) ; + GrB_Info GrB_set (object, value, GrB_Field field) ; + GrB_Info GrB_set (object, void *value, GrB_Field field, size_t s) ; \end{verbatim}} + +\noindent +where \verb'object' can be any GraphBLAS object. The \verb'value' can be a +\verb'GrB_Scalar', an \verb'int32_t' (or a pointer to \verb'int32_t' for +\verb'GrB_get'), a string (\verb'char *'), or a \verb'void *' pointer. In the +latter case, \verb'GrB_set' requires an additional parameter (\verb'size_t s') +that specifies the size of the object pointed to by \verb'void *value'. + +The non-polymorphic names have the following format, where \verb'[OBJ]' +is any GraphBLAS object. + +{\footnotesize +\begin{verbatim} + GrB_Info GrB_[OBJ]_get_[KIND] (object, value, GrB_Field field) ; + GrB_Info GrB_[OBJ]_set_[KIND] (object, value, GrB_Field field) ; + GrB_Info GrB_[OBJ]_set_VOID (object, void *value, GrB_Field field, size_t s) ; \end{verbatim}} + +The \verb'[KIND]' suffix defines the type of second parameter, and can be: + \verb'Scalar' (for \verb'GrB_Scalar'), + \verb'String' (for \verb'char *'), + \verb'INT32' (for \verb'int32_t'), and + \verb'SIZE' (for \verb'size_t *' for \verb'GrB_get' only), and + \verb'VOID' (for \verb'void *'). + +The tables below list all the valid fields that can be used for each object. +Each table contains four columns: (1) the \verb'GrB_Field', +(2) a column labelled R/W, (3) a column defining the C type, and a description. +For the R/W column: + +\begin{itemize} +\item If the R/W column of a table is R, then the value can be read by \verb'GrB_get' + but not written by \verb'GrB_set'. +\item R/W means that both \verb'GrB_get' and \verb'GrB_set' can be used any number of times, + with different values. +\item R/W1 means that \verb'GrB_get' can be done multiple times, + but \verb'GrB_set' can be used only once. + Subsequent calls to \verb'GrB_set' return the error code \verb'GrB_ALREADY_SET'. +\item W means that only \verb'GrB_set' can be used (any number of times), + but \verb'GrB_get' cannot be done. +\end{itemize} + +The second parameter (\verb'value') of \verb'GrB_get' and \verb'GrB_set' can take on several +different C types, and it can also be a \verb'GrB_Scalar' that holds a value +with the given C type (or that can be typecasted to the given C type): + +\begin{itemize} +\item \verb'int32_t': + For \verb'GrB_set' the \verb'value' parameter is \verb'int32_t'. + For \verb'GrB_get' the \verb'value' parameter is \verb'int32_t *.' + The following example sets the global number of threads, and then + retrieves that \verb'value' into \verb'nthreads'. + + {\footnotesize + \begin{verbatim} + GrB_set (GrB_GLOBAL, 8, GxB_NTHREADS) ; + int32_t nthreads ; + GrB_get (GrB_GLOBAL, &nthreads, GxB_NTHREADS) ; + printf ("nthreads: %d\n", nthreads) ; \end{verbatim} } + + A \verb'GrB_Scalar' can also be used for an \verb'int32_t' \verb'value'. + For \verb'GrB_set', the scalar must not be empty. + Here is the same example but using a \verb'GrB_Scalar' instead: + + {\footnotesize + \begin{verbatim} + GrB_Scalar s ; + GrB_Scalar_new (s, GrB_INT32) ; + GrB_Scalar_setElement (s, 8) ; + GrB_set (GrB_GLOBAL, s, GxB_NTHREADS) ; + GrB_get (GrB_GLOBAL, s, GxB_NTHREADS) ; + int32_t nthreads ; + GrB_Scalar_extractElement (&nthreads, s) ; + printf ("nthreads: %d\n", nthreads) ; \end{verbatim} } + +\item \verb'char *': + The \verb'value' parameter is \verb'char *' for both \verb'GrB_get' and + \verb'GrB_set'. A \verb'GrB_Scalar' cannot be used. The size of the + string required for \verb'GrB_get' is given by using a \verb'size_t *' + parameter with the same field. For example: + + {\footnotesize + \begin{verbatim} + size_t len ; + GrB_get (GrB_GLOBAL, &len, GrB_NAME) ; + char *name = malloc (len) ; + GrB_get (GrB_GLOBAL, name, GrB_NAME) ; + printf ("The library is: %s\n", name) ; + free (name) ; \end{verbatim} } + + To get the current JIT C compiler and then set it to something else: + + {\footnotesize + \begin{verbatim} + size_t len ; + GrB_get (GrB_GLOBAL, &len, GxB_JIT_C_COMPILER_NAME) ; + char *compiler = malloc (len) ; + GrB_get (GrB_GLOBAL, compiler, GxB_JIT_C_COMPILER_NAME) ; + printf ("The current JIT compiler is: %s\n", compiler) ; + GrB_set (GrB_GLOBAL, "gcc", GxB_JIT_C_COMPILER_NAME) ; + GrB_get (GrB_GLOBAL, &len, GxB_JIT_C_COMPILER_NAME) ; + char *new_compiler = malloc (len) ; + GrB_get (GrB_GLOBAL, new_compiler, GxB_JIT_C_COMPILER_NAME) ; + printf ("The new JIT compiler is: %s\n", new_compiler) ; + free (compiler) ; + free (new_compiler) ; \end{verbatim} } + +\item Other scalar data types (typically \verb'double'): + Only a \verb'GrB_Scalar' can be used. When using \verb'GrB_set' with a + \verb'GrB_Scalar', the scalar cannot be empty. For example, to get then + set the global \verb'GxB_HYPER_SWITCH' parameter to 0.3: + + {\footnotesize + \begin{verbatim} + GrB_Scalar s ; + GrB_Scalar_new (s, GrB_FP64) ; + GrB_get (GrB_GLOBAL, s, GxB_HYPER_SWITCH) ; + double hs ; + GrB_Scalar_extractElement (&hs, s) ; + printf ("current hyper_switch: %g\n", hs) ; + GrB_Scalar_setElement (s, 0.3) ; + GrB_set (GrB_GLOBAL, s, GxB_HYPER_SWITCH) ; \end{verbatim} } + +\item \verb'void *': + This type is used for all other cases. + For \verb'GrB_get', the array must have the right size, just like a + \verb'char *' string. Use the same field first, but with + \verb'size_t *value' as the second parameter to obtain the size of the + \verb'void *' array, then use \verb'GrB_get' with a \verb'void *' array of + the right size. In some cases, the size is always the same. For example, + to query the operator of a monoid: + + {\footnotesize + \begin{verbatim} + GrB_BinaryOp op ; + GrB_get (GrB_PLUS_MONOID_FP64, (void *) &op, GxB_MONOID_OPERATOR) ; + assert (op == GrB_PLUS_FP64) ; \end{verbatim} } + + For \verb'GrB_set', a fourth parameter is required to tell GraphBLAS the + size of the input array. + +\end{itemize} + +%------------------------------------------------------------------------------- +\subsection{Enum types for get/set: {\sf GrB\_Field}, {\sf GrB\_Orientation}, +and {\sf GrB\_Type\_Code}} +\label{get_set_enums} +%------------------------------------------------------------------------------- + +The get/set methods share a \verb'GrB_Field' enum type to specify which +component of the object is to be set or retrieved. +fields. + +{\footnotesize +\begin{verbatim} +typedef enum +{ + // GrB_Descriptor only: + GrB_OUTP_FIELD = 0, // descriptor for output of a method + GrB_MASK_FIELD = 1, // descriptor for the mask input of a method + GrB_INP0_FIELD = 2, // descriptor for the first input of a method + GrB_INP1_FIELD = 3, // descriptor for the second input of a method + + // all objects, including GrB_GLOBAL: + GrB_NAME = 10, // name of the object, as a string + + // GrB_GLOBAL only: + GrB_LIBRARY_VER_MAJOR = 11, // SuiteSparse:GraphBLAS version + GrB_LIBRARY_VER_MINOR = 12, + GrB_LIBRARY_VER_PATCH = 13, + GrB_API_VER_MAJOR = 14, // C API version + GrB_API_VER_MINOR = 15, + GrB_API_VER_PATCH = 16, + GrB_BLOCKING_MODE = 17, // GrB_Mode + + // GrB_GLOBAL, GrB_Matrix, GrB_Vector, GrB_Scalar (and void * serialize?): + GrB_STORAGE_ORIENTATION_HINT = 100, // GrB_Orientation + + // GrB_Matrix, GrB_Vector, GrB_Scalar (and void * serialize): + GrB_EL_TYPE_CODE = 102, // a GrB_Type_code (see below) + GrB_EL_TYPE_STRING = 106, // name of the type + + // GrB_*Op, GrB_Monoid, and GrB_Semiring: + GrB_INP1_TYPE_CODE = 103, // GrB_Type_code + GrB_INP2_TYPE_CODE = 104, + GrB_OUTP_TYPE_CODE = 105, + GrB_INP1_TYPE_STRING = 107, // name of the type, as a string + GrB_INP2_TYPE_STRING = 108, + GrB_OUTP_TYPE_STRING = 109, + + // GrB_Type (readable only): + GrB_SIZE = 110, // size of the type + + // GrB_Type, GrB_UnaryOp, GrB_BinaryOp, and GrB_IndexUnaryOp: + GxB_JIT_C_NAME = 7041, // C type or function name + GxB_JIT_C_DEFINITION = 7042, // C typedef or function definition + + // GrB_Monoid and GrB_Semiring: + GxB_MONOID_IDENTITY = 7043, // monoid identity value + GxB_MONOID_TERMINAL = 7044, // monoid terminal value + GxB_MONOID_OPERATOR = 7045, // monoid binary operator + + // GrB_Semiring only: + GxB_SEMIRING_MONOID = 7046, // semiring monoid + GxB_SEMIRING_MULTIPLY = 7047, // semiring multiplicative op +} +GrB_Field ; + +#define GxB_NTHREADS 7086 +#define GxB_CHUNK 7087 + +typedef enum // more SuiteSparse extensions for GrB_Field: +{ + + // GrB_get/GrB_set for GrB_Matrix and GrB_GLOBAL: + GxB_HYPER_SWITCH = 7000, // switch to hypersparse (double value) + GxB_HYPER_HASH = 7048, // hyper_hash control (int64 value) + GxB_BITMAP_SWITCH = 7001, // switch to bitmap (double value) + + // GrB_get for GrB_GLOBAL: + GxB_LIBRARY_DATE = 7006, // date of the library (char *) + GxB_LIBRARY_ABOUT = 7007, // about the library (char *) + GxB_LIBRARY_URL = 7008, // URL for the library (char *) + GxB_LIBRARY_LICENSE = 7009, // license of the library (char *) + GxB_LIBRARY_COMPILE_DATE = 7010, // date library was compiled (char *) + GxB_LIBRARY_COMPILE_TIME = 7011, // time library was compiled (char *) + GxB_API_DATE = 7013, // date of the API (char *) + GxB_API_ABOUT = 7014, // about the API (char *) + GxB_API_URL = 7015, // URL for the API (char *) + GxB_COMPILER_VERSION = 7016, // compiler version (3 int's) + GxB_COMPILER_NAME = 7017, // compiler name (char *) + GxB_LIBRARY_OPENMP = 7018, // library compiled with OpenMP + GxB_MALLOC_FUNCTION = 7037, // malloc function pointer + GxB_CALLOC_FUNCTION = 7038, // calloc function pointer + GxB_REALLOC_FUNCTION = 7039, // realloc function pointer + GxB_FREE_FUNCTION = 7040, // free function pointer + + // GrB_get/GrB_set for GrB_GLOBAL: + GxB_GLOBAL_NTHREADS = GxB_NTHREADS, // max number of threads to use + GxB_GLOBAL_CHUNK = GxB_CHUNK, // chunk size for small problems. + GxB_BURBLE = 7019, // diagnostic output (bool *) + GxB_PRINTF = 7020, // printf function diagnostic output + GxB_FLUSH = 7021, // flush function diagnostic output + GxB_PRINT_1BASED = 7023, // print matrices as 0-based or 1-based + GxB_JIT_C_COMPILER_NAME = 7024, // CPU JIT C compiler name + GxB_JIT_C_COMPILER_FLAGS = 7025, // CPU JIT C compiler flags + GxB_JIT_C_LINKER_FLAGS = 7026, // CPU JIT C linker flags + GxB_JIT_C_LIBRARIES = 7027, // CPU JIT C libraries + GxB_JIT_C_PREFACE = 7028, // CPU JIT C preface + GxB_JIT_C_CONTROL = 7029, // CPU JIT C control + GxB_JIT_CACHE_PATH = 7030, // CPU/CUDA JIT path for compiled kernels + GxB_JIT_C_CMAKE_LIBS = 7031, // CPU JIT C libraries when using cmake + GxB_JIT_USE_CMAKE = 7032, // CPU JIT: use cmake or direct compile + GxB_JIT_ERROR_LOG = 7033, // CPU JIT: error log file + + // GrB_get for GrB_Matrix: + GxB_SPARSITY_STATUS = 7034, // hyper, sparse, bitmap or full (1,2,4,8) + + // GrB_get/GrB_set for GrB_Matrix: + GxB_SPARSITY_CONTROL = 7036, // sparsity control: 0 to 15; see below + +} GxB_Option_Field ; + +typedef enum +{ + GrB_ROWMAJOR = 0, + GrB_COLMAJOR = 1, + GrB_BOTH = 2, + GrB_UNKNOWN = 3, +} +GrB_Orientation ; + +typedef enum +{ + GrB_UDT_CODE = 0, // user-defined type + GrB_BOOL_CODE = 1, // GraphBLAS: GrB_BOOL C: bool + GrB_INT8_CODE = 2, // GraphBLAS: GrB_INT8 C: int8_t + GrB_UINT8_CODE = 3, // GraphBLAS: GrB_UINT8 C: uint8_t + GrB_INT16_CODE = 4, // GraphBLAS: GrB_INT16 C: int16_t + GrB_UINT16_CODE = 5, // GraphBLAS: GrB_UINT16 C: uint16_t + GrB_INT32_CODE = 6, // GraphBLAS: GrB_INT32 C: int32_t + GrB_UINT32_CODE = 7, // GraphBLAS: GrB_UINT32 C: uint32_t + GrB_INT64_CODE = 8, // GraphBLAS: GrB_INT64 C: int64_t + GrB_UINT64_CODE = 9, // GraphBLAS: GrB_UINT64 C: uint64_t + GrB_FP32_CODE = 10, // GraphBLAS: GrB_FP32 C: float + GrB_FP64_CODE = 11, // GraphBLAS: GrB_FP64 C: double + GxB_FC32_CODE = 7070, // GraphBLAS: GxB_FC32 C: float complex + GxB_FC64_CODE = 7071, // GraphBLAS: GxB_FC64 C: double complex +} +GrB_Type_Code ; \end{verbatim}} + + +%------------------------------------------------------------------------------- +\subsection{Global Options ({\sf GrB\_Global})} +\label{get_set_global} +%------------------------------------------------------------------------------- + +A single object \verb'GrB_GLOBAL' whose type is \verb'GrB_Global' is used to +denote global settings to read or modify. To use it with \verb'GrB_get' and +\verb'GrB_set', pass in \verb'GrB_GLOBAL' as the first parameter. + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Global g, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Global g, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Global g, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Global g, size_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Global g, void * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Global g, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Global g, char * value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Global g, int32_t value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Global g, void * value, GrB_Field f, size_t s) ; +\end{verbatim} +}\end{mdframed} + + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.5in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_LIBRARY_VER_MAJOR' & R & \verb'int32_t'& major version of the library \\ +\verb'GrB_LIBRARY_VER_MINOR' & R & \verb'int32_t'& minor version of the library \\ +\verb'GrB_LIBRARY_VER_PATCH' & R & \verb'int32_t'& patch version of the library \\ +\verb'GrB_API_VER_MAJOR' & R & \verb'int32_t'& major version of the API \\ +\verb'GrB_API_VER_MINOR' & R & \verb'int32_t'& major version of the API \\ +\verb'GrB_API_VER_PATCH' & R & \verb'int32_t'& major version of the API \\ +\verb'GrB_BLOCKING_MODE' & R & \verb'int32_t'& blocking mode (\verb'GrB_BLOCKING' \newline + or \verb'GrB_NONBLOCKING') \\ +\verb'GxB_LIBRARY_OPENMP' & R & \verb'int32_t'& if OpenMP is in use (true/false) \\ +\hline +\end{tabular} +} +\vspace{0.05in} + +\vspace{0.1in} +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.5in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_STORAGE_ORIENTATION_HINT' & R/W & \verb'int32_t'& see \verb'GrB_Orientation': default + format for matrices. \\ +% Matrices are held by row, unless this +% value is set to \verb'GrB_COLMAJOR'. \\ +\verb'GxB_NTHREADS' & R/W & \verb'int32_t'& number of OpenMP threads used. \newline + See Section~\ref{omp_parallelism}. \\ +% \verb'GxB_GPU_ID' & R/W & \verb'int32_t'& which GPU to use \\ +\verb'GxB_BURBLE' & R/W & \verb'int32_t'& diagnostic output (true/false). \newline + See Section~\ref{diag}. \\ +\verb'GxB_PRINT_1BASED' & R/W & \verb'int32_t'& matrices printed as 1-based or 0-based \\ +\verb'GxB_JIT_C_CONTROL' & R/W & \verb'int32_t'& see Section~\ref{jit} \\ +\verb'GxB_JIT_USE_CMAKE' & R/W & \verb'int32_t'& see Section~\ref{jit} \\ +\hline +\verb'GxB_HYPER_SWITCH' & R/W & \verb'double' & global hypersparsity control. \newline + See Section~\ref{hypersparse}. \\ +\verb'GxB_HYPER_HASH' & R/W & \verb'int64_t' & global hypersparsity (hyper-hash) + control \\ +\verb'GxB_CHUNK' & R/W & \verb'double' & global chunk size for parallel task creation. + See Section~\ref{omp_parallelism}. \\ +\hline +\verb'GrB_NAME' & R & \verb'char *' & name of the library \newline + (\verb'"SuiteSparse:GraphBLAS"') \\ +\verb'GxB_LIBRARY_DATE' & R & \verb'char *' & library release date \\ +\verb'GxB_LIBRARY_ABOUT' & R & \verb'char *' & details about the library \\ +\verb'GxB_LIBRARY_LICENSE' & R & \verb'char *' & license of the library \\ +\verb'GxB_LIBRARY_COMPILE_DATE' & R & \verb'char *' & date the library was compiled \\ +\verb'GxB_LIBRARY_COMPILE_TIME' & R & \verb'char *' & time the library was compiled \\ +\verb'GxB_LIBRARY_URL' & R & \verb'char *' & URL for the library \\ +\verb'GxB_API_DATE' & R & \verb'char *' & C API release date \\ +\verb'GxB_API_ABOUT' & R & \verb'char *' & about the C API \\ +\verb'GxB_API_URL' & R & \verb'char *' & URL for the C API \\ +\verb'GxB_COMPILER_NAME' & R & \verb'char *' & name of the compiler used to compile the library \\ +\hline +\verb'GxB_JIT_C_COMPILER_NAME' & R/W & \verb'char *' & See Section~\ref{jit} \\ +\verb'GxB_JIT_C_COMPILER_FLAGS' & R/W & \verb'char *' & " \\ +\verb'GxB_JIT_C_LINKER_FLAGS' & R/W & \verb'char *' & " \\ +\verb'GxB_JIT_C_LIBRARIES' & R/W & \verb'char *' & " \\ +\verb'GxB_JIT_C_CMAKE_LIBS' & R/W & \verb'char *' & " \\ +\verb'GxB_JIT_C_PREFACE' & R/W & \verb'char *' & " \\ +\verb'GxB_JIT_ERROR_LOG' & R/W & \verb'char *' & " \\ +\verb'GxB_JIT_CACHE_PATH' & R/W & \verb'char *' & " \\ +\hline +\end{tabular} +} + +\vspace{0.1in} +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.5in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\verb'GxB_BITMAP_SWITCH' & R/W & \verb'void *' & \verb'double' array of size \newline + \verb'GxB_NBITMAP_SWITCH'. \newline + See Section~\ref{bitmap_switch}. \\ +\verb'GxB_COMPILER_VERSION' & R & \verb'void *' & \verb'int32_t' array of size 3. + The version of the compiler used to + compile the library. \\ +\verb'GxB_PRINTF' & W & \verb'void *' & pointer to \verb'printf' function for diagnostic output. + See Section~\ref{diag}. \\ +\verb'GxB_FLUSH' & W & \verb'void *' & pointer to \verb'flush' function for diagnostic output. + See Section~\ref{diag}. \\ +\verb'GxB_MALLOC_FUNCTION' & R & \verb'void *' & malloc function \\ +\verb'GxB_CALLOC_FUNCTION' & R & \verb'void *' & calloc function \\ +\verb'GxB_REALLOC_FUNCTION' & R & \verb'void *' & realloc function \\ +\verb'GxB_FREE_FUNCTION' & R & \verb'void *' & free function \\ +\hline +\end{tabular} +} + +% \newpage +%------------------------------------------------------------------------------- +\subsubsection{Global diagnostic settings} +\label{diag} +%------------------------------------------------------------------------------- + +\verb'GrB_set (GrB_GLOBAL, ..., GxB_BURBLE)' controls the burble setting. It can also be +controlled via \verb'GrB.burble(b)' in the MATLAB/Octave interface. + +{\footnotesize +\begin{verbatim} + GrB_set (GrB_GLOBAL, true, GxB_BURBLE) ; // enable burble + GrB_set (GrB_GLOBAL, false, GxB_BURBLE) ; // disable burble \end{verbatim}} + +If enabled, SuiteSparse:GraphBLAS reports which internal kernels it uses, and +how much time is spent. If you see the word \verb'generic', it means that +SuiteSparse:GraphBLAS was unable to use its JIT kernels, or its faster kernels +in \verb'Source/FactoryKernels', but used a generic kernel that relies on +function pointers. This is done for user-defined types and operators when they +cannot be used in the JIT, and when typecasting is performed. Generic kernels +are typically slower than the JIT kernels or kernels in +\verb'Source/FactoryKernels'. + +If you see a lot of \verb'wait' statements, it may mean that a lot of time is +spent finishing a matrix or vector. This may be the result of an inefficient +use of the \verb'setElement' and \verb'assign' methods. If this occurs you +might try changing the sparsity format of a vector or matrix to +\verb'GxB_BITMAP', assuming there's enough space for it. + +The following setting allows the user application to change the +function used to print diagnostic output: + +{\small +\begin{verbatim} + GrB_set (GrB_GLOBAL, (void *) printf, GxB_PRINTF, sizeof (void *)) ; \end{verbatim} } + +This also controls the output of the +\verb'GxB_*print' functions. By default this parameter is \verb'NULL', in +which case the C11 \verb'printf' function is used. The parameter is a +function pointer with the same signature as the C11 \verb'printf' +function. The MATLAB/Octave interface to GraphBLAS sets it to \verb'mexPrintf' +so that GraphBLAS can print to the MATLAB/Octave Command Window. + +After each call to the \verb'printf' function, an optional +\verb'flush' function is called, which is \verb'NULL' by default. If +\verb'NULL', the function is not used. This can be changed with: + +{\small +\begin{verbatim} + GrB_set (GrB_GLOBAL, (void *) flush, GxB_FLUSH, sizeof (void *)) ; \end{verbatim} } + +The \verb'flush' function takes no +arguments, and returns an \verb'int' which is 0 if successful, or any nonzero +value on failure (the same output as the C11 \verb'fflush' function, +except that \verb'flush' has no inputs). + +%------------------------------------------------------------------------------- +\subsubsection{OpenMP parallelism} +%------------------------------------------------------------------------------- +\label{omp_parallelism} + +SuiteSparse:GraphBLAS is a parallel library, based on OpenMP. By +default, all GraphBLAS operations will use up to the maximum number of threads +specified by the \verb'omp_get_max_threads' OpenMP function. For small +problems, GraphBLAS may choose to use fewer threads, using two parameters: the +maximum number of threads to use (which may differ from the +\verb'omp_get_max_threads' value), and a parameter called the \verb'chunk'. +Suppose \verb'work' is a measure of the work an operation needs to perform (say +the number of entries in the two input matrices for \verb'GrB_eWiseAdd'). No +more than \verb'floor(work/chunk)' threads will be used (or one thread if the +ratio is less than 1). + +\verb'GxB_NTHREADS' controls how many threads a method uses. + By default (if set to zero, or \verb'GrB_DEFAULT'), all available threads + are used. The maximum available threads is controlled by the global + setting, which is \verb'omp_get_max_threads ( )' by default. If set to + some positive integer \verb'nthreads' less than this maximum, at most + \verb'nthreads' threads will be used. + +\verb'GxB_CHUNK' is a \verb'double' value that controls how many threads + a method uses for small problems. +The default \verb'chunk' value is 65,536, but this may change in future +versions, or it may be modified when GraphBLAS is installed on a particular +machine. + +Both parameters can be set in two ways: + +\begin{itemize} + +\item Globally: If the following methods are used, then all subsequent +GraphBLAS operations will use these settings. Note the typecast, +\verb'(double)' \verb'chunk'. This is necessary if a literal constant such as +\verb'20000' is passed as this argument. The type of the constant must be +\verb'double'. + + {\footnotesize + \begin{verbatim} + int32_t nthreads_max = 40 ; + GrB_set (GrB_GLOBAL, nthreads_max, GxB_NTHREADS) ; + GrB_Scalar_new (&s, GrB_FP64) ; + GrB_Scalar_setElement (s, (double) 20000) ; + GrB_set (GrB_GLOBAL, s, GxB_CHUNK) ; \end{verbatim} } + +\item Context: this object can be used to choose a different number of +threads used in calls to GraphBLAS from different user threads, exploiting +nested parallelism. Refer to Section~\ref{context}. If a thread has engaged a +context object, it ignores the global settings for \verb'GxB_NTHREADS' and +\verb'GxB_CHUNK', and uses the settings in its own context instead. + +\end{itemize} + +The smaller of \verb'nthreads_max' and \verb'floor(work/chunk)' is used for any +given GraphBLAS operation, except that a single thread is used if this value is +zero or less. + +If either parameter is set to \verb'GrB_DEFAULT', then default values are used. +The default for \verb'nthreads_max' is the return value from +\verb'omp_get_max_threads', and the default chunk size is currently 65,536. + +If a descriptor value for either parameter is left at its default, or set to +\verb'GrB_DEFAULT', then the global setting is used. This global setting may +have been modified from its default, and this modified value will be used. + +For example, suppose \verb'omp_get_max_threads' reports 8 threads. If \newline +\verb'GrB_set (GrB_GLOBAL, 4, GxB_NTHREADS)' is used, then the global setting is four +threads, not eight. + +GraphBLAS may be compiled without OpenMP, by setting \verb'-DNOPENMP=1'. +The library will be thread-safe, with one exception. \verb'GrB_wait' is +intended to provide thread-safety by flushing the cache of one user thread +so the object can be safely read by another thread. This is accomplished +with \verb'pragma omp flush', but if OpenMP is not available, this does +nothing. If OpenMP is not available or \verb'-DNOPEMP=1' is used, then +user applications need to ensure their own thread safety when one user thread +computes a result that is then read by another thread. + +You can query GraphBLAS at run-time to ask if it was compiled with OpenMP: + +{\small +\begin{verbatim} + bool have_openmp ; + GrB_get (GrB_GLOBAL, &have_openmp, GxB_LIBRARY_OPENMP) ; + if (!have_openmp) printf ("GraphBLAS not compiled with OpenMP\n") : \end{verbatim}} + +Compiling GraphBLAS without OpenMP is not recommended for installation in a +package manager (Linux, conda-forge, spack, brew, vcpkg, etc). + +%------------------------------------------------------------------------------- +\subsubsection{Other global options} +%------------------------------------------------------------------------------- + +\verb'GrB_BLOCKING_MODE' can only be queried by \verb'GrB_get'; it cannot be +modified by \verb'GrB_set'. The mode is the value passed to \verb'GrB_init' +(blocking or non-blocking). + +All threads in the same user application share the same global options, +including hypersparsity, bitmap options, and CSR/CSC format determined by +\verb'GrB_set', and the blocking mode determined by \verb'GrB_init'. +Specific format and hypersparsity parameters of each matrix are specific to +that matrix and can be independently changed. + +The \verb'GrB_LIBRARY_*' and \verb'GxB_LIBRARY_*' options can be used to query +the current implementation of SuiteSparse:GraphBLAS. The \verb'GrB_API_*' and +\verb'GxB_API_*' options can be used to query the current GraphBLAS C API +Specification. + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_Type} Options} +\label{get_set_type} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Type t, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Type t, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Type t, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Type t, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Type t, char * value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.85in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_EL_TYPE_CODE' & R & \verb'int32_t'& type code (see \verb'GrB_Type_Code') \\ +\verb'GrB_SIZE' & R & \verb'size_t' & \verb'sizeof' the type \\ +\hline +\verb'GrB_NAME' & R/W1 & \verb'char *' & % GrB_ALREADY_SET (type) + name of the type. For built-in types, this returns the GraphBLAS + name (\verb'"GrB_FP32"' for \verb'GrB_FP32', for example). + For user-defined types, the name can be any string of any length. It is + not used by the JIT. It can be set at most once. \\ +\verb'GxB_JIT_C_NAME' & R/W1 & \verb'char *' & + This must be a valid name of a C type to enable its use in the JIT. For + built-in types, this returns the C name of the type (\verb'"float"' for + \verb'GrB_FP32', for example). The length of the name can be at most + \verb'GxB_MAX_NAME_LEN', including the \verb'nul' terminating byte. It can + be set at most once. \\ +\verb'GxB_JIT_C_DEFINITION' & R/W1 & \verb'char *' & + type definition, as a C \verb'typedef'; + built-in types return an empty string. + It can be set at most once. \\ +\hline +\end{tabular} +} + +Built-in types cannot be modified by \verb'GrB_set'. User-defined types can be +used without setting their name or definition, but they can be used in JIT +kernels only when both the JIT C name and the definition are set. + +To use the JIT, all operators, monoids, and semirings that access this type +must be defined after the user-defined type has been given both a name and a +definition. GraphBLAS can use an operator that uses a type without a name, +but it cannot use the JIT, even if the type is given a name later on after +the operator is created. + +The size of the type can be returned as a \verb'size_t' C scalar, or as a +\verb'GrB_Scalar', normally of type \verb'GrB_UINT64', with the examples below. + +{\footnotesize +\begin{verbatim} + size_t size ; + GrB_get (GrB_FP32, &size, GrB_SIZE) ; + assert (size == sizeof (float)) ; + + GrB_Scalar s ; + GrB_Scalar_new (&s, GrB_UINT64) ; + GrB_get (GrB_FP32, s, GrB_SIZE) ; + GrB_Scalar_extractElement (&size, s) ; + assert (size == sizeof (float)) ; \end{verbatim}} + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_UnaryOp} Options} +\label{get_set_unop} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_UnaryOp op, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_UnaryOp op, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_UnaryOp op, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_UnaryOp op, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_UnaryOp op, char * value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.8in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_INP0_TYPE_CODE' & R & \verb'int32_t'& input type code (see \verb'GrB_Type_code') \\ +\verb'GrB_OUTP_TYPE_CODE' & R & \verb'int32_t'& output type code \\ +\verb'GrB_INP0_TYPE_STRING' & R & \verb'char *' & name of the input type \\ +\verb'GrB_OUTP_TYPE_STRING' & R & \verb'char *' & name of the output type \\ +\hline +\verb'GrB_NAME' & R/W1 & \verb'char *' & % GrB_ALREADY_SET (unop) + name of the operator. For built-in operators, this returns the GraphBLAS + name (\verb'"GrB_LNOT"' for \verb'GrB_LNOT', for example). + For user-defined operators, the name can be any string of any length. It + is not used by the JIT. It can be set at most once. \\ +\verb'GxB_JIT_C_NAME' & R/W1 & \verb'char *' & + This must be a valid name of a C function to enable its use in the JIT. + The length of the name can be at most \verb'GxB_MAX_NAME_LEN', including + the \verb'nul' terminating byte. It can be set at most once. \\ +\verb'GxB_JIT_C_DEFINITION' & R/W1 & \verb'char *' & + definition for a user-defined operator, as a C function; built-in operators + return an empty string. It can be set at most once. \\ +\hline +\end{tabular} +} + +Built-in operators cannot be modified by \verb'GrB_set'. User-defined +operators can be used without setting their name or definition, but they can be +used in JIT kernels only when both the JIT C name and the definition are set. + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_IndexUnaryOp} Options} +\label{get_set_idxunop} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_IndexUnaryOp op, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_IndexUnaryOp op, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_IndexUnaryOp op, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_IndexUnaryOp op, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_IndexUnaryOp op, char * value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.8in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_INP0_TYPE_CODE' & R & \verb'int32_t'& 1st input type code (see \verb'GrB_Type_code') \\ +\verb'GrB_INP1_TYPE_CODE' & R & \verb'int32_t'& 2nd input type code \\ +\verb'GrB_OUTP_TYPE_CODE' & R & \verb'int32_t'& output type code \\ +\verb'GrB_INP0_TYPE_STRING' & R & \verb'char *' & name of the 1st input type \\ +\verb'GrB_INP1_TYPE_STRING' & R & \verb'char *' & name of the 2nd input type \\ +\verb'GrB_OUTP_TYPE_STRING' & R & \verb'char *' & name of the output type \\ +\hline +\verb'GrB_NAME' & R/W1 & \verb'char *' & % GrB_ALREADY_SET (idxunop) + name of the operator. For built-in operators, this returns the GraphBLAS + name (\verb'"GrB_TRIL"' for \verb'GrB_TRIL', for example). + For user-defined operators, the name can be any string of any length. It + is not used by the JIT. It can be set at most once. \\ +\verb'GxB_JIT_C_NAME' & R/W1 & \verb'char *' & + This must be a valid name of a C function to enable its use in the JIT. + The length of the name can be at most \verb'GxB_MAX_NAME_LEN', including + the \verb'nul' terminating byte. It can be set at most once. \\ +\verb'GxB_JIT_C_DEFINITION' & R/W1 & \verb'char *' & + definition for a user-defined operator, as a C function; built-in operators + return an empty string. It can be set at most once. \\ +\hline +\end{tabular} +} + +Built-in operators cannot be modified by \verb'GrB_set'. User-defined +operators can be used without setting their name or definition, but they can be +used in JIT kernels only when both the JIT C name and the definition are set. + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_BinaryOp} Options} +\label{get_set_binop} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_BinaryOp op, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_BinaryOp op, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_BinaryOp op, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_BinaryOp op, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_BinaryOp op, char * value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.8in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_INP0_TYPE_CODE' & R & \verb'int32_t'& 1st input type code (see \verb'GrB_Type_code') \\ +\verb'GrB_INP1_TYPE_CODE' & R & \verb'int32_t'& 2nd input type code \\ +\verb'GrB_OUTP_TYPE_CODE' & R & \verb'int32_t'& output type code \\ +\verb'GrB_INP0_TYPE_STRING' & R & \verb'char *' & name of the 1st input type \\ +\verb'GrB_INP1_TYPE_STRING' & R & \verb'char *' & name of the 2nd input type \\ +\verb'GrB_OUTP_TYPE_STRING' & R & \verb'char *' & name of the output type \\ +\hline +\verb'GrB_NAME' & R/W1 & \verb'char *' & % GrB_ALREADY_SET (binop) + name of the operator. For built-in operators, this returns the GraphBLAS + name (\verb'"GrB_LOR"' for \verb'GrB_LOR', for example). + For user-defined operators, the name can be any string of any length. It + is not used by the JIT. It can be set at most once. \\ +\verb'GxB_JIT_C_NAME' & R/W1 & \verb'char *' & + This must be a valid name of a C function to enable its use in the JIT. + The length of the name can be at most \verb'GxB_MAX_NAME_LEN', including + the \verb'nul' terminating byte. It can be set at most once. \\ +\verb'GxB_JIT_C_DEFINITION' & R/W1 & \verb'char *' & + definition for a user-defined operator, as a C function; built-in operators + return an empty string. It can be set at most once. \\ +\hline +\end{tabular} +} + +Built-in operators cannot be modified by \verb'GrB_set'. User-defined +operators can be used without setting their name or definition, but they can be +used in JIT kernels only when both the JIT C name and the definition are set. + +To use the JIT, all monoids and semirings that access this binary operator must +be defined after the user-defined operator has been given both a name and a +definition. GraphBLAS can use a monoid or semiring that uses a binary operator +without a name, but it cannot use the JIT, even if the operator is given a name +later on after the operator is created. + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_Monoid} Options} +\label{get_set_monoid} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Monoid monoid, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Monoid monoid, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Monoid monoid, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Monoid monoid, size_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Monoid monoid, void * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Monoid monoid, char * value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.5in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_INP0_TYPE_CODE' & R & \verb'int32_t'& 1st input type code \newline + (see \verb'GrB_Type_code') \\ +\verb'GrB_INP1_TYPE_CODE' & R & \verb'int32_t'& 2nd input type code \\ +\verb'GrB_OUTP_TYPE_CODE' & R & \verb'int32_t'& output type code \\ +\verb'GrB_INP0_TYPE_STRING' & R & \verb'char *' & name of the 1st input type \\ +\verb'GrB_INP1_TYPE_STRING' & R & \verb'char *' & name of the 2nd input type \\ +\verb'GrB_OUTP_TYPE_STRING' & R & \verb'char *' & name of the output type \\ +\hline +\verb'GrB_NAME' & R/W1 & \verb'char *' & % GrB_ALREADY_SET (monoid) + name of the monoid. For built-in monoids, this returns the GraphBLAS + name (\verb'"GrB_LOR_MONOID_BOOL"' for \verb'GrB_LOR_MONOID_BOOL', for example). + For user-defined monoids, the name can be any string of any length. It is + not used by the JIT. It can be set at most once. \\ +\hline +\verb'GxB_MONOID_IDENTITY' & R & \verb'GrB_Scalar' & + identity value of the monoid. The type of the \verb'GrB_Scalar' + must match the monoid type exactly. \\ +\verb'GxB_MONOID_TERMINAL' & R & \verb'GrB_Scalar' & + terminal value of a terminal monoid. The type of the \verb'GrB_Scalar' + must match the monoid type exactly. If the monoid is not terminal, + the \verb'GrB_Scalar' is returned with no entry. \\ +\hline +\verb'GxB_MONOID_OPERATOR' & R & \verb'void *' & + binary operator of the monoid, as a \verb'GrB_BinaryOp' \\ +\hline +\end{tabular} +} + +Built-in monoids cannot be modified by \verb'GrB_set'. + +For \verb'GxB_MONOID_OPERATOR', +the \verb'op' is returned as an alias, not as a new object. For example, +if a monoid is created with a user-defined binary operator, the following usage +returns a shallow copy of the operator: + + {\footnotesize + \begin{verbatim} + GrB_BinaryOp binop ; + GrB_BinaryOp_new (&binop, func, GrB_BOOL, GrB_BOOL, GrB_BOOL) ; + GrB_Monoid monoid ; + GrB_Monoid_new (&monoid, binop, (bool) false) ; \end{verbatim} } + +With the above objects defined, the following two code snippets do the same thing: + + {\footnotesize + \begin{verbatim} + // getting an alias to the binary operator directly: + GrB_BinaryOp op ; + op = binop ; \end{verbatim} } + + {\footnotesize + \begin{verbatim} + // getting an alias to the binary operator using GrB_get: + GrB_BinaryOp op ; + GrB_get (monoid, (void *) &op, GxB_MONOID_OPERATOR) ; + assert (op == binop) ; \end{verbatim} } + +As a result, it is not valid to free both the \verb'op' and the \verb'binop', +since they are the same object. This usage returns the built-in \verb'GrB_LOR' +operator of the corresponding built-in monoid: + + {\footnotesize + \begin{verbatim} + GrB_BinaryOp op ; + GrB_get (GrB_LOR_MONOID, (void *) &op, GxB_MONOID_OPERATOR) ; + assert (op == GrB_LOR) ; \end{verbatim} } + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_Semiring} Options} +\label{get_set_semiring} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Semiring semiring, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Semiring semiring, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Semiring semiring, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Semiring semiring, size_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Semiring semiring, void * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Semiring semiring, GrB_Scalar value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.8in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_INP0_TYPE_CODE' & R & \verb'int32_t'& 1st input type code (see \verb'GrB_Type_code') + of the multiplicative operator \\ +\verb'GrB_INP1_TYPE_CODE' & R & \verb'int32_t'& 2nd input type code + of the multiplicative operator \\ +\verb'GrB_OUTP_TYPE_CODE' & R & \verb'int32_t'& output type code + of the multiplicative operator, + and the monoid type. \\ +\verb'GrB_INP0_TYPE_STRING' & R & \verb'char *' & name of the 1st input type + of the multiplicative operator \\ +\verb'GrB_INP1_TYPE_STRING' & R & \verb'char *' & name of the 2nd input type + of the multiplicative operator \\ +\verb'GrB_OUTP_TYPE_STRING' & R & \verb'char *' & name of the output type + of the multiplicative operator, + and the monoid type. \\ +\hline +\verb'GrB_NAME' & R/W1 & \verb'char *' & % GrB_ALREADY_SET (semiring) + name of the semiring. For built-in semirings, this returns the GraphBLAS + name (\verb'"GrB_LOR_LAND_SEMIRING_BOOL"' for \verb'GrB_LOR_LAND_SEMIRING_BOOL', + for example). For user-defined semirings, the name can be any string of any + length. It is not used by the JIT. It can be set at most once. \\ +\hline +\end{tabular} +} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.5in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GxB_MONOID_IDENTITY' & R & \verb'GrB_Scalar' & + identity value of the monoid. The type of the \verb'GrB_Scalar' + must match the monoid type exactly. \\ +\verb'GxB_MONOID_TERMINAL' & R & \verb'GrB_Scalar' & + terminal value of a terminal monoid. The type of the \verb'GrB_Scalar' + must match the monoid type exactly. If the monoid is not terminal, + the \verb'GrB_Scalar' is returned with no entry. \\ +\hline +\verb'GxB_MONOID_OPERATOR' & R & \verb'void *' & + binary operator of the monoid, as a \verb'GrB_BinaryOp'; + See Section~\ref{get_set_monoid} \\ +\verb'GxB_SEMIRING_MONOID' & R & \verb'void *' & + monoid of the semiring, as a \verb'GrB_Monoid' \\ +\verb'GxB_SEMIRING_MULTIPLY' & R & \verb'void *' & + multiplicative operator of the semiring, as a \verb'GrB_BinaryOp' \\ +\hline +\end{tabular} +} + +Built-in semirings cannot be modified by \verb'GrB_set'. + +The \verb'GxB_SEMIRING_MONOID' option returns the \verb'GrB_Monoid' of the +semiring. The \verb'GxB_SEMIRING_MULTIPLY' option returns the +\verb'GrB_BinaryOp' for the multiplicative operator of the semiring. For +example: + + {\footnotesize + \begin{verbatim} + // getting an alias to the monoid and multiply operator using GrB_get: + GrB_BinaryOp op ; + GrB_Monoid mon ; + GrB_Semiring semiring = GrB_PLUS_TIMES_FP32 ; + GrB_get (semiring, (void *) &mon, GxB_SEMIRING_MONOID) ; + GrB_get (semiring, (void *) &op, GxB_SEMIRING_MULTIPLY) ; + assert (op == GrB_TIMES_FP32) ; + assert (mon == GrB_PLUS_MONOID_FP32) ; \end{verbatim} } + +The binary op and monoid returned are aliases, not new objects. + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_Matrix} Options} +\label{get_set_matrix} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Matrix A, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Matrix A, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Matrix A, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Matrix A, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Matrix A, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Matrix A, char * value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Matrix A, int32_t value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.2in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_STORAGE_ORIENTATION_HINT' & R/W & \verb'int32_t'& See \verb'GrB_Orientation', \newline + and Section~\ref{storage_orientation}. \\ +\verb'GrB_EL_TYPE_CODE' & R & \verb'int32_t'& matrix type \\ +\verb'GxB_SPARSITY_CONTROL' & R/W & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\verb'GxB_SPARSITY_STATUS' & R & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\hline +\verb'GrB_NAME' & R/W & \verb'char *' & name of the matrix. + This can be set any number of times. \\ +\verb'GrB_EL_TYPE_STRING' & R & \verb'char *' & name of the type of the matrix. \\ +\verb'GxB_JIT_C_NAME' & R & \verb'char *' & JIT C name of the type of the matrix. \\ +\hline +\verb'GxB_HYPER_SWITCH' & R/W & \verb'double' & See Section~\ref{hypersparse} \\ +\verb'GxB_BITMAP_SWITCH' & R/W & \verb'double' & See Section~\ref{bitmap_switch} \\ +\hline +\end{tabular} +} + +%------------------------------------------------------------------------------- +\subsubsection{Storing a matrix by row or by column} +\label{storage_orientation} +%------------------------------------------------------------------------------- + +The GraphBLAS \verb'GrB_Matrix' is entirely opaque to the user application, and +the GraphBLAS API does not specify how the matrix should be stored. However, +choices made in how the matrix is represented in a particular implementation, +such as SuiteSparse:GraphBLAS, can have a large impact on performance. + +Many graph algorithms are just as fast in any format, but some algorithms are +much faster in one format or the other. For example, suppose the user +application stores a directed graph as a matrix \verb'A', with the edge $(i,j)$ +represented as the value \verb'A(i,j)', and the application makes many accesses +to the $i$th row of the matrix, with \verb'GrB_Col_extract' +\verb'(w,...,A,GrB_ALL,...,i,desc)' with the transposed descriptor +(\verb'GrB_INP0' set to \verb'GrB_TRAN'). If the matrix is stored by column +this can be extremely slow, just like the expression \verb'w=A(i,:)' in MATLAB, +where \verb'i' is a scalar. Since this is a typical use-case in graph +algorithms, the default format in SuiteSparse:GraphBLAS is to store its +matrices by row, in Compressed Sparse Row format (CSR). + +MATLAB stores its sparse matrices by column, in ``non-hypersparse'' format, in +what is called the Compressed Sparse Column format, or CSC for short. An +\verb'm'-by-\verb'n' matrix in MATLAB is represented as a set of \verb'n' +column vectors, each with a sorted list of row indices and values of the +nonzero entries in that column. As a result, \verb'w=A(:,j)' is very fast in +MATLAB, since the result is already held in the data structure a single list, +the $j$th column vector. However, \verb'w=A(i,:)' is very slow in MATLAB, +since every column in the matrix has to be searched to see if it contains row +\verb'i'. In MATLAB, if many such accesses are made, it is much better to +transpose the matrix (say \verb"AT=A'") and then use \verb"w=AT(:,i)" instead. +This can have a dramatic impact on the performance of MATLAB. + +Likewise, if \verb'u' is a very sparse column vector and \verb'A' is stored by +column, then \verb"w=u'*A" (via \verb'GrB_vxm') is slower than \verb'w=A*u' +(via \verb'GrB_mxv'). The opposite is true if the matrix is stored by row. + +SuiteSparse:GraphBLAS stores its matrices by row, by default (with one +exception described below). However, it can also be instructed to store any +selected matrices, or all matrices, by column instead (just like MATLAB), so +that \verb'w=A(:,j)' (via \verb'GrB_Col_extract') is very fast. The change in +data format has no effect on the result, just the time and memory usage. To +use a column-oriented format by default, the following can be done in a user +application that tends to access its matrices by column. + + {\footnotesize + \begin{verbatim} + GrB_init (...) ; + // just after GrB_init: do the following: + GrB_set (GrB_GLOBAL, GrB_COLMAJOR, GrB_STORAGE_ORIENTATION_HINT) ; \end{verbatim} } + +If this is done, and no other \verb'GrB_set' calls are made with \newline +\verb'GrB_STORAGE_ORIENATION_HINT', all matrices will be stored by column. +The default format is \verb'GrB_ROWMAJOR'. + +All vectors (\verb'GrB_Vector') are held by column, and this cannot be changed. + +By default, matrices of size \verb'm-by-1' are held by column, regardless of +the global setting described above. Matrices of size \verb'1-by-n' with +\verb'n' not equal to 1 are held by row, regardless of the global setting. +The global setting only affects matrices with both \verb'm > 1' and \verb'n > 1'. +Empty matrices (\verb'0-by-0') are also controlled by the global setting. + +After creating a matrix with \verb'GrB_Matrix_new (&A, ...)', +its format can be changed arbitrarily with: + + {\footnotesize + \begin{verbatim} + GrB_set (A, GrB_COLMAJOR, GrB_STORAGE_ORIENTATION_HINT) ; + GrB_set (A, GrB_ROWMAJOR, GrB_STORAGE_ORIENTATION_HINT) ; \end{verbatim} } + +If set to other values (\verb'GrB_BOTH' or \verb'GrB_UNKNOWN'), the +format is changed to \verb'GrB_ROWMAJOR'. + +With this setting, even an \verb'm-by-1' matrix can then be changed to be held +by row, for example. Likewise, once a \verb'1-by-n' matrix is created, it can +be converted to column-oriented format. + +%------------------------------------------------------------------------------- +\subsubsection{Hypersparse matrices} +\label{hypersparse} +%------------------------------------------------------------------------------- + +MATLAB can store an \verb'm'-by-\verb'n' matrix with a very large value of +\verb'm', since a CSC data structure takes $O(n+|{\bf A}|)$ memory, independent +of \verb'm', where $|{\bf A}|$ is the number of nonzeros in the matrix. It +cannot store a matrix with a huge \verb'n', and this structure is also +inefficient when $|{\bf A}|$ is much smaller than \verb'n'. In contrast, +SuiteSparse:GraphBLAS can store its matrices in {\em hypersparse} format, +taking only $O(|{\bf A}|)$ memory, independent of how it is stored (by row or +by column) and independent of both \verb'm' and \verb'n' +\cite{BulucGilbert08,BulucGilbert12}. + +In both the CSR and CSC formats, the matrix is held as a set of sparse vectors. +In non-hypersparse format, the set of sparse vectors is itself dense; all +vectors are present, even if they are empty. For example, an +\verb'm'-by-\verb'n' matrix in non-hypersparse CSC format contains \verb'n' +sparse vectors. Each column vector takes at least one integer to represent, +even for a column with no entries. This allows for quick lookup for a +particular vector, but the memory required is $O(n+|{\bf A}|)$. With a +hypersparse CSC format, the set of vectors itself is sparse, and columns with +no entries take no memory at all. The drawback of the hypersparse format is +that finding an arbitrary column vector \verb'j', such as for the computation +\verb'C=A(:,j)', takes $O(\log k)$ time if there $k \le n$ vectors in the data +structure. One advantage of the hypersparse structure is the memory required +for an \verb'm'-by-\verb'n' hypersparse CSC matrix is only $O(|{\bf A}|)$, +independent of \verb'm' and \verb'n'. Algorithms that must visit all non-empty +columns of a matrix are much faster when working with hypersparse matrices, +since empty columns can be skipped. + +The \verb'hyper_switch' parameter controls the hypersparsity of the internal +data structure for a matrix. The parameter is typically in the range 0 to 1. +The default is \verb'hyper_switch' = \verb'GxB_HYPER_DEFAULT', which is an +\verb'extern' \verb'const' \verb'double' value, currently set to 0.0625, or +1/16. This default ratio may change in the future. + +The \verb'hyper_switch' determines how the matrix is converted between the +hypersparse and non-hypersparse formats. Let $n$ be the number of columns of a +CSC matrix, or the number of rows of a CSR matrix. The matrix can have at most +$n$ non-empty vectors. + +Let $k$ be the actual number of non-empty vectors. That is, for the CSC +format, $k \le n$ is the number of columns that have at least one entry. Let +$h$ be the value of \verb'hyper_switch'. + +If a matrix is currently hypersparse, it can be converted to non-hypersparse if +the either condition $n \le 1$ or $k > 2nh$ holds, or both. Otherwise, it +stays hypersparse. Note that if $n \le 1$ the matrix is always stored as +non-hypersparse. + +If currently non-hypersparse, it can be converted to hypersparse if +both conditions $n > 1$ and $k \le nh$ hold. Otherwise, it stays +non-hypersparse. Note that if $n \le 1$ the matrix always remains +non-hypersparse. + +The default value of \verb'hyper_switch' is assigned at startup by +\verb'GrB_init', and can then be modified globally with \verb'GrB_set'. All +new matrices are created with the same \verb'hyper_switch', determined by the +global value. Once a particular matrix \verb'A' has been constructed, its +hypersparsity ratio can be modified from the default with: + + {\footnotesize + \begin{verbatim} + double hyper_switch = 0.2 ; + GrB_set (A, hyper_switch, GxB_HYPER_SWITCH) ; \end{verbatim}} + +To force a matrix to always be non-hypersparse, use \verb'hyper_switch' equal to +\verb'GxB_NEVER_HYPER'. To force a matrix to always stay hypersparse, set +\verb'hyper_switch' to \verb'GxB_ALWAYS_HYPER'. + +A \verb'GrB_Matrix' can thus be held in one of four formats: any combination of +hyper/non-hyper and CSR/CSC. All \verb'GrB_Vector' objects are always stored +in non-hypersparse CSC format. + +A new matrix created via \verb'GrB_Matrix_new' starts with $k=0$ and is created +in hypersparse form by default unless $n \le 1$ or if $h<0$, where $h$ is the +global \verb'hyper_switch' value. The matrix is created in either +\verb'GrB_ROWMAJOR' or \verb'GrB_COLMAJOR' format, as determined by the last call +to +\verb'GrB_set(GrB_GLOBAL,' \verb'..., GrB_STORAGE_ORIENTATION_HINT,...)' or \verb'GrB_init'. + +A new matrix \verb'C' created via \verb'GrB_dup (&C,A)' inherits the CSR/CSC +format, hypersparsity format, and \verb'hyper_switch' from \verb'A'. + +%------------------------------------------------------------------------------- +\subsubsection{Bitmap matrices} +\label{bitmap_switch} +%------------------------------------------------------------------------------- + +By default, SuiteSparse:GraphBLAS switches between all four formats +(hypersparse, sparse, bitmap, and full) automatically. Let $d = |{\bf A}|/mn$ +for an $m$-by-$n$ matrix $\bf A$ with $|{\bf A}|$ entries. If the matrix is +currently in sparse or hypersparse format, and is modified so that $d$ exceeds +a given threshold, it is converted into bitmap format. The default threshold +is controlled by the \verb'GxB_BITMAP_SWITCH' setting, which can be set +globally, or for a particular matrix or vector. + +The default value of the switch to bitmap format depends on $\min(m,n)$, for a +matrix of size $m$-by-$n$. For the global setting, the bitmap switch is a +\verb'double' array of size \verb'GxB_NBITMAP_SWITCH'. The defaults are given +below: + +\vspace{0.2in} +{\small +\begin{tabular}{lll} +parameter & default & matrix sizes \\ +\hline +\verb'bitmap_switch [0]' & 0.04 & $\min(m,n) = 1$ (and all vectors) \\ +\verb'bitmap_switch [1]' & 0.05 & $\min(m,n) = 2$ \\ +\verb'bitmap_switch [2]' & 0.06 & $\min(m,n) = 3$ to 4 \\ +\verb'bitmap_switch [3]' & 0.08 & $\min(m,n) = 5$ to 8 \\ +\verb'bitmap_switch [4]' & 0.10 & $\min(m,n) = 9$ to 16\\ +\verb'bitmap_switch [5]' & 0.20 & $\min(m,n) = 17$ to 32\\ +\verb'bitmap_switch [6]' & 0.30 & $\min(m,n) = 33$ to 64 \\ +\verb'bitmap_switch [7]' & 0.40 & $\min(m,n) > 64$ \\ +\end{tabular} +} +\vspace{0.2in} + +That is, by default a \verb'GrB_Vector' is held in bitmap format if its density +exceeds 4\%. To change the global settings, do the following: + +{\footnotesize +\begin{verbatim} + double bswitch [GxB_NBITMAP_SWITCH] = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8 } ; + GrB_set (GrB_GLOBAL, (void *) bswitch, GxB_BITMAP_SWITCH, + GxB_NBITMAP_SWITCH * sizeof (double)) ; +\end{verbatim} +} + +If the matrix is currently in bitmap format, it is converted to full if all +entries are present, or to sparse/hypersparse if $d$ drops below $b/2$, if its +bitmap switch is $b$. A matrix or vector with $d$ between $b/2$ and $b$ +remains in its current format. + +%------------------------------------------------------------------------------- +\subsubsection{Sparsity status} +\label{sparsity_status} +%------------------------------------------------------------------------------- + +The sparsity status of a matrix can be queried with the following, which +returns a value of \verb'GxB_HYPERSPARSE' (1), \verb'GxB_SPARSE' (2), +\verb'GxB_BITMAP' (4), or \verb'GxB_FULL' (8). + +{\footnotesize +\begin{verbatim} + int32_t sparsity ; + GrB_get (A, &sparsity, GxB_SPARSITY_STATUS) ; \end{verbatim}} + +The sparsity format of a matrix can be controlled with the field set to +\verb'GxB_SPARSITY_CONTROL', for which the \verb'value' can be any mix (a sum or bitwise +or) of \verb'GxB_HYPERSPARSE', \verb'GxB_SPARSE', \verb'GxB_BITMAP', and +\verb'GxB_FULL'. By default, a matrix or vector can be held in any format, +with the default setting \verb'GxB_AUTO_SPARSITY', which is equal to +\verb'GxB_HYPERSPARSE' + \verb'GxB_SPARSE' + \verb'GxB_BITMAP' + +\verb'GxB_FULL' (15). To enable a matrix to take on just \verb'GxB_SPARSE' or +\verb'GxB_FULL' formats, but not \verb'GxB_HYPERSPARSE' or \verb'GxB_BITMAP', +for example, use the following: + +{\footnotesize +\begin{verbatim} + GrB_set (A, GxB_SPARSE + GxB_FULL, GxB_SPARSITY_CONTROL) ; \end{verbatim}} + +In this case, SuiteSparse:GraphBLAS will hold the matrix in sparse format +(\verb'CSR' or \verb'CSC', depending on its +\verb'GrB_STORAGE_ORIENTATION_HINT'), unless all entries are present, in which +case it will be converted to full format. + +Only the least significant 4 bits of the sparsity control are considered, so +the formats can be bitwise negated. For example, to allow for any format +except full: + +{\footnotesize +\begin{verbatim} + GrB_set (A, ~GxB_FULL, GxB_SPARSITY_CONTROL) ; \end{verbatim}} + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_Vector} Options} +\label{get_set_vector} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Vector v, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Vector v, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Vector v, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Vector v, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Vector v, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Vector v, char * value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Vector v, int32_t value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{3in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_EL_TYPE_CODE' & R & \verb'int32_t'& vector type \\ +\verb'GxB_SPARSITY_CONTROL' & R/W & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\verb'GxB_SPARSITY_STATUS' & R & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\hline +\verb'GrB_NAME' & R/W & \verb'char *' & name of the vector. \\ +% This can be set any number of times. \\ +\verb'GrB_EL_TYPE_STRING' & R & \verb'char *' & name of the type of the vector. \\ +\verb'GxB_JIT_C_NAME' & R & \verb'char *' & JIT C name of the type of the vector. \\ +\hline +\verb'GxB_BITMAP_SWITCH' & R/W & \verb'double' & See Section~\ref{bitmap_switch} \\ +\hline +\end{tabular} +} + +See Section~\ref{get_set_matrix}; a \verb'GrB_Vector' is treated as if it were +an $n$-by-1 matrix, and is always in column major form. It is never +hypersparse. + +%------------------------------------------------------------------------------- +% \newpage +\subsection{{\sf GrB\_Scalar} Options} +\label{get_set_scalar} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Scalar s, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Scalar s, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Scalar s, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Scalar s, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Scalar s, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Scalar s, char * value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Scalar s, int32_t value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{3in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline + +\verb'GrB_EL_TYPE_CODE' & R & \verb'int32_t'& scalar type \\ +\verb'GxB_SPARSITY_STATUS' & R & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\hline +\verb'GrB_NAME' & R/W & \verb'char *' & name of the scalar. \\ +% This can be set any number of times. \\ +\verb'GrB_EL_TYPE_STRING' & R & \verb'char *' & name of the type of the scalar. \\ +\verb'GxB_JIT_C_NAME' & R & \verb'char *' & JIT C name of the type of the scalar. \\ +\hline +\end{tabular} +} +\vspace{0.1in} + +See Section~\ref{get_set_matrix}; a \verb'GrB_Scalar' is treated as if it were +a 1-by-1 matrix, and is always in column major form. It is never hypersparse. + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GrB\_Descriptor} Options} +\label{get_set_descriptor} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GrB_Descriptor desc, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Descriptor desc, char * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Descriptor desc, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GrB_Descriptor desc, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GrB_Descriptor desc, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Descriptor desc, char * value, GrB_Field f) ; +GrB_Info GrB_set (GrB_Descriptor desc, int32_t value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{3.3in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_OUTP' & R/W & \verb'int32_t'& \verb'GrB_DEFAULT' or \verb'GrB_REPLACE' \\ +\verb'GrB_MASK' & R/W & \verb'int32_t'& \verb'GrB_DEFAULT', \verb'GrB_COMP', \verb'GrB_STRUCTURE', or + \newline \verb'GrB_COMP_STRUCTURE' \\ +\verb'GrB_INP0' & R/W & \verb'int32_t'& \verb'GrB_DEFAULT' or \verb'GrB_TRAN' \\ +\verb'GrB_INP1' & R/W & \verb'int32_t'& \verb'GrB_DEFAULT' or \verb'GrB_TRAN' \\ +\verb'GxB_AxB_METHOD' & R/W & \verb'int32_t'& Method used by \verb'GrB_mxm' (\verb'GrB_DEFAULT', \newline + \verb'GxB_AxB_GUSTAVSON'. \verb'GxB_AxB_HASH', \newline + \verb'GxB_AxB_SAXPY', or \verb'GxB_AxB_DOT'). \\ +\verb'GxB_SORT' & R/W & \verb'int32_t'& if true, \verb'GrB_mxm' returns its output in sorted form. \\ +\verb'GxB_COMPRESSION' & R/W & \verb'int32_t'& compression method for serialize methods. \\ +\verb'GxB_IMPORT' & R/W & \verb'int32_t'& \verb'GxB_FAST_IMPORT' or \verb'GxB_SECURE_IMPORT' for \verb'GxB*_pack*' methods. \\ +\hline +\verb'GrB_NAME' & R/W & \verb'char *' & name of the descriptor. + This can be set any number of times for user-defined descriptors. Built-in + descriptors have the same name as the variable name (\verb'"GrB_DESC_T1"' + for the \verb'GrB_DESC_T1' descriptor, for example) \\ +\hline +\end{tabular} +} + +The following table describes each option. +See Section~\ref{descriptor} for more details. + +\vspace{0.2in} +\noindent +{\footnotesize +\begin{tabular}{|l|p{2.4in}|p{2.2in}|} +\hline +Descriptor & Default & Non-default \\ +field & & \\ +\hline + +\verb'GrB_OUTP' + & \verb'GrB_DEFAULT': + The output matrix is not cleared. The operation computes + ${\bf C \langle M \rangle = C \odot T}$. + & \verb'GrB_REPLACE': + After computing ${\bf Z=C\odot T}$, + the output {\bf C} is cleared of all entries. + Then ${\bf C \langle M \rangle = Z}$ is performed. \\ + +\hline + +\verb'GrB_MASK' + & \verb'GrB_DEFAULT': + The Mask is not complemented. \verb'Mask(i,j)=1' means the value $C_{ij}$ + can be modified by the operation, while \verb'Mask(i,j)=0' means the value + $C_{ij}$ shall not be modified by the operation. + & \verb'GrB_COMP': + The Mask is complemented. \verb'Mask(i,j)=0' means the value $C_{ij}$ + can be modified by the operation, while \verb'Mask(i,j)=1' means the value + $C_{ij}$ shall not be modified by the operation. \\ + & + & \verb'GrB_STRUCTURE': + The values of the Mask are ignored. If \verb'Mask(i,j)' is an entry + in the \verb'Mask' matrix, it is treated as if \verb'Mask(i,j)=1'. + The two options \verb'GrB_COMP' and \verb'GrB_STRUCTURE' can be + combined, with two subsequent calls, or with a single call with the setting + \verb'GrB_COMP+GrB_STRUCTURE'. \\ + +\hline + +\verb'GrB_INP0' + & \verb'GrB_DEFAULT': + The first input is not transposed prior to using it in the operation. + & \verb'GrB_TRAN': + The first input is transposed prior to using it in the operation. Only + matrices are transposed, never vectors. \\ + +\hline + +\verb'GrB_INP1' + & \verb'GrB_DEFAULT': + The second input is not transposed prior to using it in the operation. + & \verb'GrB_TRAN': + The second input is transposed prior to using it in the operation. Only + matrices are transposed, never vectors. \\ + +\hline + +\verb'GxB_AxB_METHOD' + & \verb'GrB_DEFAULT': + The method for \verb'C=A*B' is selected automatically. + & \verb'GxB_AxB_'{\em method}: The selected method is used to compute + \verb'C=A*B'. \\ + +\hline + +\verb'GxB_SORT' + & \verb'GrB_DEFAULT': + The computation of \verb'C=A*B' may leave \verb'C' in a jumbled state; + \verb'GrB_wait' will finalize the matrix. + & any nonzero value: \verb'C=A*B' always returns \verb'C' in final, + sorted form. \\ + +\hline + +\verb'GxB_COMPRESION' + & \verb'GrB_DEFAULT': + Serialize methods will use the default method, ZSTD (level 1) + & See Section~\ref{serialize_deserialize} \\ + +\hline + +\verb'GxB_IMPORT' + & \verb'GrB_DEFAULT': fast import + & \verb'GxB_SECURE_IMPORT': secure import \\ + +\hline +\end{tabular} +} + + +%------------------------------------------------------------------------------- +\newpage +\subsection{{\sf GxB\_Context} Options} +\label{get_set_context} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (GxB_Context Context, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_get (GxB_Context Context, char * value, GrB_Field f) ; +GrB_Info GrB_get (GxB_Context Context, int32_t * value, GrB_Field f) ; +GrB_Info GrB_get (GxB_Context Context, size_t * value, GrB_Field f) ; + +GrB_Info GrB_set (GxB_Context Context, GrB_Scalar value, GrB_Field f) ; +GrB_Info GrB_set (GxB_Context Context, char * value, GrB_Field f) ; +GrB_Info GrB_set (GxB_Context Context, int32_t value, GrB_Field f) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{3.5in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GxB_NTHREADS' & R/W & \verb'int32_t' & number of OpenMP threads to use; + See Section~\ref{omp_parallelism} \\ +\verb'GxB_CHUNK' & R/W & \verb'double' & chunk factor for task creation; + See Section~\ref{omp_parallelism} \\ +\hline +\verb'GrB_NAME' & R/W & \verb'char *' & name of the context. + This can be set any number of times for user-defined contexts. Built-in + contexts have the same name as the variable name (\verb'"GxB_CONTEXT_WORLD"' + for the \verb'GxB_CONTEXT_WORLD' context, for example) \\ +\hline +\end{tabular} +} + +NOTE: the non-polymorphic names for this method are +\verb'GxB_Context_get_[KIND]' and \verb'GxB_Context_set_[KIND]', where +\verb'KIND' can be: + \verb'Scalar' (for \verb'GrB_Scalar'), + \verb'String' (for \verb'char *'), + \verb'INT' (for \verb'int32_t'), and + \verb'SIZE' (for \verb'size_t *' for \verb'GrB_get' only), and + \verb'VOID' (for \verb'void *'). +The non-polymorphic suffix of \verb'INT' is used here instead of +\verb'INT32' because \verb'GxB_Context_*_INT32' appear as historical methods +in version v8.0 and earlier, which are now deprecated. + +For the \verb'int32_t' type, the use of the polymorphic \verb'GrB_set' and +\verb'GrB_get' accesses the correct version of this method. When using +non-polymorphic methods, the use of \verb'GxB_Context_get_INT' and +\verb'GxB_Context_set_INT' is recommended. + +%------------------------------------------------------------------------------- +\newpage +\subsection{Options for inspecting a serialized blob} +\label{get_set_blob} +%------------------------------------------------------------------------------- + +\begin{mdframed}[userdefinedwidth=6.5in] +{\footnotesize +\begin{verbatim} +GrB_Info GrB_get (const void *blob, GrB_Scalar value, GrB_Field f, size_t blobsize) ; +GrB_Info GrB_get (const void *blob, char * value, GrB_Field f, size_t blobsize) ; +GrB_Info GrB_get (const void *blob, int32_t * value, GrB_Field f, size_t blobsize) ; +GrB_Info GrB_get (const void *blob, size_t * value, GrB_Field f, size_t blobsize) ; +\end{verbatim} +}\end{mdframed} + +\noindent +{\small +\begin{tabular}{|l|l|l|p{2.2in}|} +\hline +\verb'GrB_Field' & R/W & C type & description \\ +\hline +\verb'GrB_STORAGE_ORIENTATION_HINT' & R & \verb'int32_t'& See \verb'GrB_Orientation', \newline + and Section~\ref{storage_orientation}. \\ +\verb'GrB_EL_TYPE_CODE' & R & \verb'int32_t'& type of matrix in the blob \\ +\verb'GxB_SPARSITY_CONTROL' & R & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\verb'GxB_SPARSITY_STATUS' & R & \verb'int32_t'& See Section~\ref{sparsity_status} \\ +\hline +\verb'GrB_NAME' & R & \verb'char *' & name of the matrix in the blob. \\ +\verb'GrB_EL_TYPE_STRING' & R & \verb'char *' & name of the type of the matrix in the blob. \\ +\verb'GxB_JIT_C_NAME' & R & \verb'char *' & JIT C name of the type of the matrix in the blob. \\ +\hline +\verb'GxB_HYPER_SWITCH' & R & \verb'double' & See Section~\ref{hypersparse} \\ +\verb'GxB_BITMAP_SWITCH' & R & \verb'double' & See Section~\ref{bitmap_switch} \\ +\hline +\end{tabular} +} + +The \verb'GrB_Matrix_serialize' and \verb'GxB_Matrix_serialize' methods create +a {\em blob} as a single array of bytes that contains all content of a +\verb'GrB_Matrix'. These \verb'GrB_get' methods can query a blob for the same +values that can be queried for a \verb'GrB_Matrix'. The blob cannot be +modified by \verb'GrB_set'. + +Note that these \verb'GrB_get' methods add a fourth parameter, the size of +the blob. All other \verb'GrB_get' methods have just three parameters: +the object, the value, and the field. + diff --git a/GraphBLAS/Doc/GraphBLAS_API_C_2.0.0.pdf b/GraphBLAS/Doc/GraphBLAS_API_C_2.0.0.pdf deleted file mode 100644 index 73e1d0efa6..0000000000 Binary files a/GraphBLAS/Doc/GraphBLAS_API_C_2.0.0.pdf and /dev/null differ diff --git a/GraphBLAS/Doc/GraphBLAS_API_C_2.1.0.pdf b/GraphBLAS/Doc/GraphBLAS_API_C_2.1.0.pdf new file mode 100644 index 0000000000..0a6eba5cbc Binary files /dev/null and b/GraphBLAS/Doc/GraphBLAS_API_C_2.1.0.pdf differ diff --git a/GraphBLAS/Doc/GraphBLAS_API_version.tex b/GraphBLAS/Doc/GraphBLAS_API_version.tex index 12852497bd..f25dcc8067 100644 --- a/GraphBLAS/Doc/GraphBLAS_API_version.tex +++ b/GraphBLAS/Doc/GraphBLAS_API_version.tex @@ -1,3 +1,3 @@ % GraphBLAS C API Specification version, at graphblas.org -2.0.0 -(Nov 15, 2021)% +2.1.0 +(Dec 22, 2023)% diff --git a/GraphBLAS/Doc/GraphBLAS_UserGuide.bib b/GraphBLAS/Doc/GraphBLAS_UserGuide.bib index 5e162513e2..404ad3958d 100644 --- a/GraphBLAS/Doc/GraphBLAS_UserGuide.bib +++ b/GraphBLAS/Doc/GraphBLAS_UserGuide.bib @@ -182,6 +182,7 @@ @article{Davis23 keywords = {Graph algorithms, GraphBLAS, sparse matrices} } + @book{Higham, author={Higham, N.}, title={Accuracy and Stability of Numerical Algorithms}, diff --git a/GraphBLAS/Doc/GraphBLAS_UserGuide.pdf b/GraphBLAS/Doc/GraphBLAS_UserGuide.pdf index 74569b96db..093f7018f3 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 dab829db52..1323de157a 100644 --- a/GraphBLAS/Doc/GraphBLAS_UserGuide.tex +++ b/GraphBLAS/Doc/GraphBLAS_UserGuide.tex @@ -84,6 +84,8 @@ Version 8.0 adds several new features, in particular a JIT for compiling kernels at run-time, and a new \verb'GxB_Context' object. See Sections~\ref{context} and \ref{jit} for details. +Version 9.0 adds the \verb'GrB_get' and \verb'GrB_set' methods; +see Section~\ref{options}. \end{abstract} @@ -628,7 +630,7 @@ \subsection{Typecasting} %====================================================== types, and it follows the rules of the ANSI C language (not MATLAB) wherever the rules of ANSI C are well-defined. -However, unlike MATLAB, the ANSI C11 language specification states that the +However, unlike MATLAB, the C11 language specification states that the results of typecasting a \verb'float' or \verb'double' to an integer type is not always defined. In SuiteSparse:GraphBLAS, whenever C leaves the result undefined the rules used in MATLAB are followed. In particular \verb'+Inf' @@ -747,16 +749,14 @@ \subsection{Notation and list of GraphBLAS operations} %======================== \newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Interfaces to MATLAB, Octave, Python, Julia, Java} %%%%%%%%%%%%%%%%%%%% +\section{Interfaces to MATLAB, Octave, Python, Julia, Go, Java, ...} %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The MATLAB/Octave interface to SuiteSparse:GraphBLAS is included with this distribution, described in Section~\ref{octave}. -It is fully polished, and fully tested, but does have -some limitations that will be addressed in future releases. -Two Python interfaces are now available, as is a -Julia interface. These are not part of the SuiteSparse:GraphBLAS distribution. -See the links below (see Sections \ref{python} and \ref{julia}). +Python, Julia, Go, and Java interfaces are available. +These are not part of the SuiteSparse:GraphBLAS distribution. +See the links below. %=============================================================================== \subsection{MATLAB/Octave Interface} @@ -844,6 +844,21 @@ \subsection{Julia Interface} allow inputs to a function or mexFunction to be modified, so any pending work must be finished before a matrix can be used as input. +%=============================================================================== +\subsection{Go Interface} +%=============================================================================== +\label{go} + +Pascal Costanza (Intel) has a Go interface to GraphBLAS and LAGraph: +\begin{itemize} +\item forGraphBLASGo: \url{https://github.com/intel/forGraphBLASGo}, which +is almost a complete wrapper for SuiteSparse:GraphBLAS. +Documentation is at \url{https://pkg.go.dev/github.com/intel/forGraphBLASGo}. +\item forLAGraphGo: \url{https://github.com/intel/forLAGraphGo}, which is in +progress. Documentation is at +\url{https://pkg.go.dev/github.com/intel/forLAGraphGo}. +\end{itemize} + %=============================================================================== \subsection{Java Interface} %=============================================================================== @@ -1170,7 +1185,7 @@ \subsection{{\sf GrB\_init:} initialize GraphBLAS} %============================ When the user application is finished, exactly one user thread must call \verb'GrB_finalize', after which no user thread may call any \verb'GrB_*' or \verb'GxB_*' function. -The mode of a GraphBLAS session can be queried with \verb'GxB_get'; +The mode of a GraphBLAS session can be queried with \verb'GrB_get'; see Section~\ref{options} for details. %=============================================================================== @@ -1199,7 +1214,7 @@ \subsection{{\sf GrB\_getVersion:} determine the C API Version} %=============== \verb'GrB_getVersion' thus provides a run-time access of the version of the C API Specification supported by the library. -\newpage +% \newpage %=============================================================================== \subsection{{\sf GxB\_init:} initialize with alternate malloc} %================ %=============================================================================== @@ -1212,10 +1227,10 @@ \subsection{{\sf GxB\_init:} initialize with alternate malloc} %================ ( GrB_Mode mode, // blocking or non-blocking mode // pointers to memory management functions. - void * (* user_malloc_function ) (size_t), - void * (* user_calloc_function ) (size_t, size_t), - void * (* user_realloc_function ) (void *, size_t), - void (* user_free_function ) (void *) + void * (* user_malloc_func ) (size_t), + void * (* user_calloc_func ) (size_t, size_t), + void * (* user_realloc_func ) (void *, size_t), + void (* user_free_func ) (void *) ) ; \end{verbatim} }\end{mdframed} @@ -1228,16 +1243,16 @@ \subsection{{\sf GxB\_init:} initialize with alternate malloc} %================ Sections \ref{serialize_deserialize} and \ref{pack_unpack}, since they require the user application and GraphBLAS to use the same memory manager. - -\verb'user_calloc_function' and \verb'user_realloc_function' are optional, and -may be \verb'NULL'. If \verb'NULL', then the \verb'user_malloc_function' is +\verb'user_calloc_func' and \verb'user_realloc_func' are optional, and +may be \verb'NULL'. If \verb'NULL', then the \verb'user_malloc_func' is relied on instead, for all memory allocations. - -These functions can only be set once, when GraphBLAS starts. Either +These functions can only be set once, when GraphBLAS starts. +They can be queried using \verb'GrB_get' (see +Section~\ref{get_set_global}). +Either \verb'GrB_init' or \verb'GxB_init' must be called before any other GraphBLAS operation, but not both. The functions passed to \verb'GxB_init' must be thread-safe. - The following usage is identical to \verb'GrB_init(mode)': {\footnotesize @@ -1284,6 +1299,7 @@ \subsection{{\sf GrB\_Info:} status code returned by GraphBLAS} %=============== \verb'GrB_DIMENSION_MISMATCH' & -6 & matrix dimensions do not match \\ \verb'GrB_OUTPUT_NOT_EMPTY' & -7 & output matrix already has values in it \\ \verb'GrB_NOT_IMPLEMENTED' & -8 & not implemented in SS:GrB \\ +\verb'GrB_ALREADY_SET' & -9 & field already written to \\ \verb'GrB_PANIC' & -101 & unrecoverable error \\ \verb'GrB_OUT_OF_MEMORY' & -102 & out of memory \\ \verb'GrB_INSUFFICIENT_SPACE' & -103 & output array not large enough \\ @@ -1336,10 +1352,7 @@ \subsection{{\sf GrB\_error:} get more details on the last error} %============= SuiteSparse:GraphBLAS reports many helpful details via \verb'GrB_error'. For example, if a row or column index is out of bounds, the report will state what those bounds are. If a matrix dimension is incorrect, the mismatching -dimensions will be provided. \verb'GrB_BinaryOp_new', \verb'GrB_UnaryOp_new', -and \verb'GrB_IndexUnaryOp_new' record the name the function passed to them, and -\verb'GrB_Type_new' records the name of its type parameter, and these are -printed if the user-defined types and operators are used incorrectly. Refer to +dimensions will be provided. Refer to the output of the example programs in the \verb'Demo' and \verb'Test' folder, which intentionally generate errors to illustrate the use of \verb'GrB_error'. @@ -1386,10 +1399,11 @@ \section{GraphBLAS Objects and their Methods} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \label{objects} -GraphBLAS defines ten different objects to represent matrices, vectors, +GraphBLAS defines eleven different objects to represent matrices, vectors, scalars, data types, operators (binary, unary, and index-unary), monoids, -semirings, and a {\em descriptor} object used to specify optional parameters -that modify the behavior of a GraphBLAS operation. +semirings, a {\em descriptor} object used to specify optional parameters +that modify the behavior of a GraphBLAS operation, and a {\em context} +object for controlling computational resources. The GraphBLAS API makes a distinction between {\em methods} and {\em operations}. A method is a function that works on a GraphBLAS object, creating @@ -1413,6 +1427,7 @@ \section{GraphBLAS Objects and their Methods} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \verb'GrB_Vector' & a 1D sparse column vector of any type \\ \verb'GrB_Scalar' & a scalar of any type \\ \verb'GrB_Descriptor'& a collection of parameters that modify an operation \\ +\verb'GxB_Context' & allocating computational resources \\ \hline \end{tabular} } @@ -1467,7 +1482,7 @@ \subsection{The GraphBLAS type: {\sf GrB\_Type}} %============================== } \vspace{0.2in} -The ANSI C11 definitions of \verb'float complex' and \verb'double complex' +The C11 definitions of \verb'float complex' and \verb'double complex' are not always available. The \verb'GraphBLAS.h' header defines them as \verb'GxB_FC32_t' and \verb'GxB_FC64_t', respectively. @@ -1497,8 +1512,8 @@ \subsection{The GraphBLAS type: {\sf GrB\_Type}} %============================== \verb'GxB_Type_new' & create a user-defined type, with name and definition & \ref{type_new_named} \\ \verb'GrB_Type_wait' & wait for a user-defined type & \ref{type_wait} \\ -\verb'GxB_Type_size' & return the size of a type & \ref{type_size} \\ -\verb'GxB_Type_name' & return the name of a type & \ref{type_name} \\ +\verb'GrB_get' & get properties of a type & \ref{get_set_type} \\ +\verb'GrB_set' & set the type name/definitition & \ref{get_set_type} \\ \verb'GxB_Type_from_name'& return the type from its name & \ref{type_from_name} \\ \verb'GrB_Type_free' & free a user-defined type & \ref{type_free} \\ \hline @@ -1532,7 +1547,7 @@ \subsubsection{{\sf GrB\_Type\_new:} create a user-defined type} requirement on the C type is that \verb'sizeof(ctype)' is valid in C, and that the type reside in a contiguous block of memory so that it can be moved with \verb'memcpy'. For example, to create a user-defined type called -\verb'Complex' for double-precision complex values using the ANSI C11 +\verb'Complex' for double-precision complex values using the C11 \verb'double complex' type, the following can be used. A complete example can be found in the \verb'usercomplex.c' and \verb'usercomplex.h' files in the \verb'Demo' folder. @@ -1624,6 +1639,19 @@ \subsubsection{{\sf GxB\_Type\_new:} create a user-defined type (with name and d valid strings for C types but would not have a reliable way to determine the size of the type. +The above example is identical to the following usage, except that +\verb'GrB_Type_new' requires \verb'sizeof_ctype' to be nonzero, and equal +to the size of the C type. + + {\footnotesize + \begin{verbatim} + typedef struct { float x [4][4] ; int color ; } myquaternion ; + GrB_Type MyQtype ; + GxB_Type_new (&MyQtype, sizeof (myquaternion)) ; + GrB_set (MyQtype, "myquaternion", GxB_JIT_C_NAME) ; + GrB_set (MyQtype, "typedef struct { float x [4][4] ; int color ; } myquaternion ;" + GxB_JIT_C_DEFINITION) ; \end{verbatim}} + %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Type\_wait:} wait for a type} %------------------------------------------------------------------------------- @@ -1644,71 +1672,6 @@ \subsubsection{{\sf GrB\_Type\_wait:} wait for a type} non-blocking mode to delay its creation. Currently, SuiteSparse:GraphBLAS currently does nothing except to ensure that \verb'type' is valid. -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Type\_size:} return the size of a type} -%------------------------------------------------------------------------------- -\label{type_size} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Type_size // determine the size of the type -( - size_t *size, // the sizeof the type - GrB_Type type // type to determine the sizeof -) ; -\end{verbatim} -}\end{mdframed} - -This function acts just like \verb'sizeof(type)' in the C language. For -example \verb'GxB_Type_size (&s, GrB_INT32)' sets \verb's' to 4, the same as -\verb'sizeof(int32_t)'. - -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Type\_name:} return the name of a type} -%------------------------------------------------------------------------------- -\label{type_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Type_name // return the name of a GraphBLAS type -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Type type -) ; -\end{verbatim} -}\end{mdframed} - -Returns the name of a type, as a string. For built-in types, the name is -the same as the C type. For example, \verb'GxB_Type_name(type_name,GrB_FP32)' -returns the name as \verb'"float"'. The following table lists the -names of the 13 built-in types. - -\vspace{0.2in} -{\small -\begin{tabular}{ll} -\hline -Type name & GraphBLAS type \\ -\hline - \verb'"bool"' & \verb'GrB_BOOL' \\ - \verb'"int8_t"' & \verb'GrB_INT8' \\ - \verb'"int16_t"' & \verb'GrB_INT16' \\ - \verb'"int32_t"' & \verb'GrB_INT32' \\ - \verb'"int64_t"' & \verb'GrB_INT64' \\ - \verb'"uint8_t"' & \verb'GrB_UINT8' \\ - \verb'"uint16_t"' & \verb'GrB_UINT16' \\ - \verb'"uint32_t"' & \verb'GrB_UINT32' \\ - \verb'"uint64_t"' & \verb'GrB_UINT64' \\ - \verb'"float"' & \verb'GrB_FP32' \\ - \verb'"double"' & \verb'GrB_FP64' \\ - \verb'"float complex"' & \verb'GxB_FC32' \\ - \verb'"double complex"' & \verb'GxB_FC64' \\ -\hline -\end{tabular}} - \newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GxB\_Type\_from\_name:} return the type from its name} @@ -1726,9 +1689,15 @@ \subsubsection{{\sf GxB\_Type\_from\_name:} return the type from its name} \end{verbatim} }\end{mdframed} -Returns the built-in type from the corresponding name of the type. For -example, \verb'GxB_Type_from_name (&type, "bool")' returns \verb'GrB_BOOL'. If -the name is from a user-defined type, the \verb'type' is returned as +Returns the built-in type from the corresponding name of the type. The following +examples both return \verb'type' as \verb'GrB_BOOL'. + +{\footnotesize +\begin{verbatim} + GxB_Type_from_name (&type, "bool") ; + GxB_Type_from_name (&type, "GrB_BOOL") ; }\end{verbatim} } + +If the name is from a user-defined type, the \verb'type' is returned as \verb'NULL'. This is not an error condition. The user application must itself do this translation since GraphBLAS does not keep a registry of all user-defined types. @@ -1752,10 +1721,12 @@ \subsubsection{{\sf GxB\_Type\_from\_name:} return the type from its name} // later on, to query the type of A: size_t typesize ; - GxB_Type_size (&typesize, type) ; // works for any type + GrB_Scalar_new (s, GrB_UINT64) ; + GrB_get (type, s, GrB_SIZE) ; + GrB_Scalar_extractElement (&typesize, GrB_UINT64) ; GrB_Type atype ; char atype_name [GxB_MAX_NAME_LEN] ; - GxB_Matrix_type_name (atype_name, A) ; + GrB_get (A, atype_name, GrB_EL_TYPE_STRING) ; GxB_Type_from_name (&atype, atype_name) ; if (atype == NULL) { @@ -1765,7 +1736,6 @@ \subsubsection{{\sf GxB\_Type\_from\_name:} return the type from its name} else { ... this is now an error ... the type of A is unknown. } }\end{verbatim} } -\newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Type\_free:} free a user-defined type} %------------------------------------------------------------------------------- @@ -1981,7 +1951,7 @@ \subsection{GraphBLAS unary operators: {\sf GrB\_UnaryOp}, $z=f(x)$} %========== User-defined positional operators cannot be defined by \verb'GrB_UnaryOp_new'. \verb'GxB_FREXPX' and \verb'GxB_FREXPE' return the mantissa and exponent, -respectively, from the ANSI C11 \verb'frexp' function. The exponent is +respectively, from the C11 \verb'frexp' function. The exponent is returned as a floating-point value, not an integer. The operators \verb'GxB_EXPM1_FC*' and \verb'GxB_LOG1P_FC*' for complex @@ -2017,8 +1987,8 @@ \subsection{GraphBLAS unary operators: {\sf GrB\_UnaryOp}, $z=f(x)$} %========== \verb'GrB_UnaryOp_new' & create a user-defined unary operator & \ref{unaryop_new} \\ \verb'GxB_UnaryOp_new' & create a named user-defined unary operator & \ref{unaryop_new_named} \\ \verb'GrB_UnaryOp_wait' & wait for a user-defined unary operator & \ref{unaryop_wait} \\ -\verb'GxB_UnaryOp_ztype_name' & return the name of the type of the output $z$ for $z=f(x)$ & \ref{unaryop_ztype_name} \\ -\verb'GxB_UnaryOp_xtype_name' & return the name of the type of the input $x$ for $z=f(x)$ & \ref{unaryop_xtype_name} \\ +\verb'GrB_get' & get properties of an operator & \ref{get_set_unop} \\ +\verb'GrB_set' & set the operator name/definition & \ref{get_set_unop} \\ \verb'GrB_UnaryOp_free' & free a user-defined unary operator & \ref{unaryop_free} \\ \hline \end{tabular} @@ -2114,6 +2084,19 @@ \subsubsection{{\sf GxB\_UnaryOp\_new:} create a named user-defined unary operat function. If the JIT is disabled and the \verb'function' is \verb'NULL', this method returns \verb'GrB_NULL_POINTER'. +The above example is identical to the following usage, except that +\verb'GrB_UnaryOp_new' requires a non-NULL function pointer. + + {\footnotesize + \begin{verbatim} + void square (double *z, double *x) { (*z) = (*x) * (*x) ; } ; + ... + GrB_Type Square ; + GrB_UnaryOp_new (&Square, square, GrB_FP64, GrB_FP64) ; + GrB_set (Square, "square", GxB_JIT_C_NAME) ; + GrB_set (Square, "void square (double *z, double *x) { (*z) = (*x) * (*x) ; } ;", + GxB_JIT_C_DEFINITION) ; \end{verbatim}} + % \newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_UnaryOp\_wait:} wait for a unary operator} @@ -2136,45 +2119,6 @@ \subsubsection{{\sf GrB\_UnaryOp\_wait:} wait for a unary operator} SuiteSparse:GraphBLAS currently does nothing except to ensure that the \verb'unaryop' is valid. -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_UnaryOp\_ztype\_name:} return the name of the type of $z$} -%------------------------------------------------------------------------------- -\label{unaryop_ztype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_UnaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_UnaryOp unaryop // unary operator -) ; -\end{verbatim} -}\end{mdframed} - -\verb'GxB_UnaryOp_ztype_name' returns the name of the \verb'ztype' of the unary -operator, which is the type of $z$ in the function $z=f(x)$. - -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_UnaryOp\_xtype\_name:} return the name of the type of $x$} -%------------------------------------------------------------------------------- -\label{unaryop_xtype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_UnaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_UnaryOp unaryop // unary operator -) ; -\end{verbatim} -}\end{mdframed} - -\verb'GxB_UnaryOp_xtype_name' returns the name of the \verb'xtype' of the unary -operator, which is the type of $x$ in the function $z=f(x)$. - % \newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_UnaryOp\_free:} free a user-defined unary operator} @@ -2355,7 +2299,7 @@ \subsection{GraphBLAS binary operators: {\sf GrB\_BinaryOp}, $z=f(x,y)$} %====== \vspace{0.2in} The following operators are defined for real floating-point types only (\verb'GrB_FP32' and \verb'GrB_FP64'). -They are identical to the ANSI C11 functions of the same name. The last one in the table constructs +They are identical to the C11 functions of the same name. The last one in the table constructs the corresponding complex type. \vspace{0.2in} @@ -2368,10 +2312,10 @@ \subsection{GraphBLAS binary operators: {\sf GrB\_BinaryOp}, $z=f(x,y)$} %====== \hline \verb'GxB_ATAN2_'$F$ & $F \times F \rightarrow F$ & $z = \tan^{-1}(y/x)$ & 4-quadrant arc tangent \\ \verb'GxB_HYPOT_'$F$ & $F \times F \rightarrow F$ & $z = \sqrt{x^2+y^2}$ & hypotenuse \\ -\verb'GxB_FMOD_'$F$ & $F \times F \rightarrow F$ & & ANSI C11 \verb'fmod' \\ -\verb'GxB_REMAINDER_'$F$ & $F \times F \rightarrow F$ & & ANSI C11 \verb'remainder' \\ -\verb'GxB_LDEXP_'$F$ & $F \times F \rightarrow F$ & & ANSI C11 \verb'ldexp' \\ -\verb'GxB_COPYSIGN_'$F$ & $F \times F \rightarrow F$ & & ANSI C11 \verb'copysign' \\ +\verb'GxB_FMOD_'$F$ & $F \times F \rightarrow F$ & & C11 \verb'fmod' \\ +\verb'GxB_REMAINDER_'$F$ & $F \times F \rightarrow F$ & & C11 \verb'remainder' \\ +\verb'GxB_LDEXP_'$F$ & $F \times F \rightarrow F$ & & C11 \verb'ldexp' \\ +\verb'GxB_COPYSIGN_'$F$ & $F \times F \rightarrow F$ & & C11 \verb'copysign' \\ \hline \verb'GxB_CMPLX_'$F$ & $F \times F \rightarrow Z$ & $z = x + y \times i$ & complex from real \& imag \\ \hline @@ -2515,9 +2459,8 @@ \subsection{GraphBLAS binary operators: {\sf GrB\_BinaryOp}, $z=f(x,y)$} %====== \verb'GrB_BinaryOp_new' & create a user-defined binary operator & \ref{binaryop_new} \\ \verb'GxB_BinaryOp_new' & create a named user-defined binary operator & \ref{binaryop_new_named} \\ \verb'GrB_BinaryOp_wait' & wait for a user-defined binary operator & \ref{binaryop_wait} \\ -\verb'GxB_BinaryOp_ztype_name' & return the type of the output $z$ for $z=f(x,y)$ & \ref{binaryop_ztype_name} \\ -\verb'GxB_BinaryOp_xtype_name' & return the type of the input $x$ for $z=f(x,y)$ & \ref{binaryop_xtype_name} \\ -\verb'GxB_BinaryOp_ytype_name' & return the type of the input $y$ for $z=f(x,y)$ & \ref{binaryop_ytype_name} \\ +\verb'GrB_get' & get properties of an operator & \ref{get_set_binop} \\ +\verb'GrB_set' & set the operator name/definition & \ref{get_set_binop} \\ \verb'GrB_BinaryOp_free' & free a user-defined binary operator & \ref{binaryop_free} \\ \hline \end{tabular} @@ -2612,6 +2555,20 @@ \subsubsection{{\sf GxB\_BinaryOp\_new:} create a named user-defined binary oper If the JIT is disabled and the \verb'function' is \verb'NULL', this method returns \verb'GrB_NULL_POINTER'. +The above example is identical to the following usage, except that +\verb'GrB_BinaryOp_new' requires a non-NULL function pointer. + +{\footnotesize +\begin{verbatim} +void absdiff (double *z, double *x, double *y) { (*z) = fabs ((*x) - (*y)) ; } ; +... +GrB_Type AbsDiff ; +GrB_BinaryOp_new (&AbsDiff, absdiff, GrB_FP64, GrB_FP64, GrB_FP64) ; +GrB_set (AbsDiff, "absdiff", GxB_JIT_C_NAME) ; +GrB_set (AbsDiff, + "void absdiff (double *z, double *x, double *y) { (*z) = fabs ((*x) - (*y)) ; }", + GxB_JIT_C_DEFINITION) ;\end{verbatim}} + %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_BinaryOp\_wait:} wait for a binary operator} %------------------------------------------------------------------------------- @@ -2633,67 +2590,6 @@ \subsubsection{{\sf GrB\_BinaryOp\_wait:} wait for a binary operator} SuiteSparse:GraphBLAS currently does nothing for except to ensure that the \verb'binaryop' is valid. -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_BinaryOp\_ztype\_name:} return the name of the type of $z$} -%------------------------------------------------------------------------------- -\label{binaryop_ztype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_BinaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_BinaryOp_ztype_name' -returns name of the \verb'ztype' of the binary operator, which is the -type of $z$ in the function $z=f(x,y)$. - -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_BinaryOp\_xtype\_name:} return the name of the type of $x$} -%------------------------------------------------------------------------------- -\label{binaryop_xtype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_BinaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; -\end{verbatim} -}\end{mdframed} - -\verb'GxB_BinaryOp_xtype_name' -returns name of the \verb'xtype' of the binary operator, which is the -type of $x$ in the function $z=f(x,y)$. - -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_BinaryOp\_ytype\_name:} return the name of the type of $y$} -%------------------------------------------------------------------------------- -\label{binaryop_ytype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_BinaryOp_ytype_name // return the type_name of y -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_BinaryOp_ytype_name' -returns name of the \verb'ytype' of the binary operator, which is the -type of $y$ in the function $z=f(x,y)$. - %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_BinaryOp\_free:} free a user-defined binary operator} %------------------------------------------------------------------------------- @@ -2796,7 +2692,7 @@ \subsection{GraphBLAS IndexUnaryOp operators: {\sf GrB\_IndexUnaryOp}} %======== const void *x, // input value x of type xtype; value of v(i) or A(i,j) GrB_Index i, // row index of A(i,j) GrB_Index j, // column index of A(i,j), or zero for v(i) - const void *y // input scalar y + const void *y // input scalar y of type ytype ) ; \end{verbatim}} The following built-in operators are available. Operators that do not depend @@ -2857,9 +2753,8 @@ \subsection{GraphBLAS IndexUnaryOp operators: {\sf GrB\_IndexUnaryOp}} %======== \verb'GrB_IndexUnaryOp_new' & create a user-defined index-unary operator & \ref{idxunop_new} \\ \verb'GxB_IndexUnaryOp_new' & create a named user-defined index-unary operator & \ref{idxunop_new_named} \\ \verb'GrB_IndexUnaryOp_wait' & wait for a user-defined index-unary operator & \ref{idxunop_wait} \\ -\verb'GrB_IndexUnaryOp_ztype_name' & return the type of the output $z$ & \ref{idxunop_ztype_name} \\ -\verb'GrB_IndexUnaryOp_xtype_name' & return the type of the input $x$ & \ref{idxunop_xtype_name} \\ -\verb'GrB_IndexUnaryOp_ytype_name' & return the type of the scalar $y$ & \ref{idxunop_ytype_name} \\ +\verb'GrB_get' & get properties of an operator & \ref{get_set_idxunop} \\ +\verb'GrB_set' & set the operator name/definition & \ref{get_set_idxunop} \\ \verb'GrB_IndexUnaryOp_free' & free a user-defined index-unary operator & \ref{idxunop_free} \\ \hline \end{tabular} @@ -2934,6 +2829,45 @@ \subsubsection{{\sf GxB\_IndexUnaryOp\_new:} create a named user-defined index-u The two strings \verb'idxop_name' and \verb'idxop_defn' are optional, but are required to enable the JIT compilation of kernels that use this operator. +The strings can also be set the \verb'GrB_set' after the operator is created +with \verb'GrB_IndexUnaryOp_new'. For example: + +{\footnotesize +\begin{verbatim} + void banded_idx + ( + bool *z, + const int64_t *x, // unused + int64_t i, + int64_t j, + const int64_t *thunk + ) + { + // d = abs (j-i) + int64_t d = j-i ; + if (d < 0) d = -d ; + (*z) = (d <= *thunk) ; + } + + #define BANDED_IDX_DEFN \ + "void banded_idx \n" \ + "( \n" \ + " bool *z, \n" \ + " const int64_t *x, // unused \n" \ + " int64_t i, \n" \ + " int64_t j, \n" \ + " const int64_t *thunk \n" \ + ") \n" \ + "{ \n" \ + " int64_t d = j-i ; \n" \ + " if (d < 0) d = -d ; \n" \ + " (*z) = (d <= *thunk) ; \n" \ + "}" + + GxB_IndexUnaryOp_new (&Banded, + (GxB_index_unary_function) banded_idx, + GrB_BOOL, GrB_INT64, GrB_INT64, + "banded_idx", BANDED_IDX_DEFN)) ;\end{verbatim}} If JIT compilation is enabled, or if the corresponding JIT kernel has been copied into the \verb'PreJIT' folder, the \verb'function' may be \verb'NULL'. @@ -2941,6 +2875,21 @@ \subsubsection{{\sf GxB\_IndexUnaryOp\_new:} create a named user-defined index-u function. If the JIT is disabled and the \verb'function' is \verb'NULL', this method returns \verb'GrB_NULL_POINTER'. +The above example is identical to the following usage +except that \verb'GrB_IndexUnaryOp_new' requires a non-NULL function pointer. +The \verb'banded_idx' function is defined the same as above. + +{\footnotesize +\begin{verbatim} + void banded_idx ... see above + #define BANDED_IDX_DEFN ... see above + + GrB_IndexUnaryOp_new (&Banded, + (GxB_index_unary_function) banded_idx, + GrB_BOOL, GrB_INT64, GrB_INT64) ; + GrB_set (Banded, "banded_idx", GxB_JIT_C_NAME)) ; + GrB_set (Banded, BANDED_IDX_DEFN, GxB_JIT_C_DEFINITION)) ;\end{verbatim}} + %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_IndexUnaryOp\_wait:} wait for an index-unary operator} %------------------------------------------------------------------------------- @@ -2963,66 +2912,6 @@ \subsubsection{{\sf GrB\_IndexUnaryOp\_wait:} wait for an index-unary operator} \verb'op' is valid. \newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_IndexUnaryOp\_ztype\_name:} return the name of the type of $z$} -%------------------------------------------------------------------------------- -\label{idxunop_ztype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_IndexUnaryOp_ztype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // index-unary operator -) ; -\end{verbatim} -}\end{mdframed} - -\verb'GrB_IndexUnaryOp_ztype_name' returns the \verb'ztype' of the index-unary -operator, which is the type of $z$ in the function $z=f(x,i,j,y)$. - -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_IndexUnaryOp\_xtype\_name:} return the name of the type of $x$} -%------------------------------------------------------------------------------- -\label{idxunop_xtype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_IndexUnaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // index-unary operator -) ; -\end{verbatim} -}\end{mdframed} - -\verb'GrB_IndexUnaryOp_xtype_name' returns the \verb'xtype' of the index-unary -operator, which is the type of $x$ in the function $z=f(x,i,j,y)$. -This input is used for the entry \verb'A(i,j)' of a matrix or \verb'v(i)' of a -vector. - -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_IndexUnaryOp\_ytype\_name:} return the name of the type of scalar $y$} -%------------------------------------------------------------------------------- -\label{idxunop_ytype_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_IndexUnaryOp_ytype_name // return the type_name of the scalar y -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // index-unary operator -) ; -\end{verbatim} -}\end{mdframed} - -\verb'GrB_IndexUnaryOp_ytype_name' returns the \verb'ytype' of the index-unary -operator, which is the type of the scalar y in the function $z=f(x,i,j,y)$. - %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_IndexUnaryOp\_free:} free a user-defined index-unary operator} %------------------------------------------------------------------------------- @@ -3168,9 +3057,8 @@ \subsection{GraphBLAS monoids: {\sf GrB\_Monoid}} %============================= \verb'GrB_Monoid_new' & create a user-defined monoid & \ref{monoid_new} \\ \verb'GrB_Monoid_wait' & wait for a user-defined monoid & \ref{monoid_wait} \\ \verb'GxB_Monoid_terminal_new' & create a monoid that has a terminal value & \ref{monoid_terminal_new} \\ -\verb'GxB_Monoid_operator' & return the monoid operator & \ref{monoid_operator} \\ -\verb'GxB_Monoid_identity' & return the monoid identity value & \ref{monoid_identity} \\ -\verb'GxB_Monoid_terminal' & return the monoid terminal value (if any) & \ref{monoid_terminal} \\ +\verb'GrB_get' & get properties of a monoid & \ref{get_set_monoid} \\ +\verb'GrB_set' & set the monoid name & \ref{get_set_monoid} \\ \verb'GrB_Monoid_free' & free a monoid & \ref{monoid_free} \\ \hline \end{tabular} @@ -3299,77 +3187,6 @@ \subsubsection{{\sf GxB\_Monoid\_terminal\_new:} create a monoid with terminal} based on this user-defined operator with a terminal value of zero and an identity of \verb'+INFINITY'. -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Monoid\_operator:} return the monoid operator} -%------------------------------------------------------------------------------- -\label{monoid_operator} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Monoid_operator // return the monoid operator -( - GrB_BinaryOp *op, // returns the binary op of the monoid - GrB_Monoid monoid // monoid to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Monoid_operator' returns the binary operator of the monoid. - -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Monoid\_identity:} return the monoid identity} -%------------------------------------------------------------------------------- -\label{monoid_identity} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Monoid_identity // return the monoid identity -( - void *identity, // returns the identity of the monoid - GrB_Monoid monoid // monoid to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Monoid_identity' returns the identity value of the monoid. The -\verb'void *' pointer, \verb'identity', must be non-\verb'NULL' and must point -to a memory space of size at least equal to the size of the type of the -\verb'monoid'. The type size can be obtained via \verb'GxB_Monoid_operator' to -return the monoid additive operator, then \verb'GxB_BinaryOp_ztype' to obtain -the \verb'ztype', followed by \verb'GxB_Type_size' to get its size. - -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Monoid\_terminal:} return the monoid terminal value} -%------------------------------------------------------------------------------- -\label{monoid_terminal} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Monoid_terminal // return the monoid terminal -( - bool *has_terminal, // true if the monoid has a terminal value - void *terminal, // returns the terminal of the monoid - GrB_Monoid monoid // monoid to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Monoid_terminal' returns the terminal value of the monoid (if any). -The \verb'void *' pointer, \verb'terminal', must be non-\verb'NULL' and must -point to a memory space of size at least equal to the size of the type of the -\verb'monoid'. The type size can be obtained via \verb'GxB_Monoid_operator' to -return the monoid additive operator, then \verb'GxB_BinaryOp_ztype' to obtain -the \verb'ztype', followed by \verb'GxB_Type_size' to get its size. - -If the monoid has a terminal value, then \verb'has_terminal' is \verb'true', -and its value is returned in the \verb'terminal' parameter. If it has no -terminal value, then \verb'has_terminal' is \verb'false', and the -\verb'terminal' parameter is not modified. - % \newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Monoid\_free:} free a monoid} @@ -3420,8 +3237,8 @@ \subsection{GraphBLAS semirings: {\sf GrB\_Semiring}} %========================= \hline \verb'GrB_Semiring_new' & create a user-defined semiring & \ref{semiring_new} \\ \verb'GrB_Semiring_wait' & wait for a user-defined semiring & \ref{semiring_wait} \\ -\verb'GxB_Semiring_add' & return the additive monoid of a semiring & \ref{semiring_add} \\ -\verb'GxB_Semiring_multiply' & return the binary operator of a semiring & \ref{semiring_multiply} \\ +\verb'GrB_get' & get properties of a semiring & \ref{get_set_semiring} \\ +\verb'GrB_set' & set the semiring name & \ref{get_set_semiring} \\ \verb'GrB_Semiring_free' & free a semiring & \ref{semiring_free} \\ \hline \end{tabular} @@ -3572,44 +3389,6 @@ \subsubsection{{\sf GrB\_Semiring\_wait:} wait for a semiring} SuiteSparse:GraphBLAS currently does nothing except to ensure that the \verb'semiring' is valid. -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Semiring\_add:} return the additive monoid of a semiring} -%------------------------------------------------------------------------------- -\label{semiring_add} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Semiring_add // return the add monoid of a semiring -( - GrB_Monoid *add, // returns add monoid of the semiring - GrB_Semiring semiring // semiring to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Semiring_add' returns the additive monoid of a semiring. - -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Semiring\_multiply:} return multiply operator of a semiring} -%------------------------------------------------------------------------------- -\label{semiring_multiply} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Semiring_multiply // return multiply operator of a semiring -( - GrB_BinaryOp *multiply, // returns multiply operator of the semiring - GrB_Semiring semiring // semiring to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Semiring_multiply' returns the binary multiplicative operator of a -semiring. - %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Semiring\_free:} free a semiring} %------------------------------------------------------------------------------- @@ -3657,7 +3436,8 @@ \subsection{GraphBLAS scalars: {\sf GrB\_Scalar}} %============================= \verb'GrB_Scalar_dup' & copy a scalar & \ref{scalar_dup} \\ \verb'GrB_Scalar_clear' & clear a scalar of its entry & \ref{scalar_clear} \\ \verb'GrB_Scalar_nvals' & return number of entries in a scalar & \ref{scalar_nvals} \\ -\verb'GxB_Scalar_type_name' & return name of the type of a scalar & \ref{scalar_type_name} \\ +\verb'GrB_get' & get properties of a scalar & \ref{get_set_scalar} \\ +\verb'GrB_set' & set properties of a scalar & \ref{get_set_scalar} \\ \verb'GrB_Scalar_setElement' & set the single entry of a scalar & \ref{scalar_setElement} \\ \verb'GrB_Scalar_extractElement' & get the single entry from a scalar & \ref{scalar_extractElement} \\ \verb'GxB_Scalar_memoryUsage' & memory used by a scalar & \ref{scalar_memusage} \\ @@ -3754,6 +3534,7 @@ \subsubsection{{\sf GrB\_Scalar\_dup:} copy a scalar} Then \verb's' and \verb't' are two different scalars that currently have the same value, but they do not depend on each other. Modifying one has no effect on the other. +The \verb'GrB_NAME' is copied into the new scalar. %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Scalar\_clear:} clear a scalar of its entry} @@ -3798,26 +3579,6 @@ \subsubsection{{\sf GrB\_Scalar\_nvals:} return the number of entries in a scala (short for ``number of nonzeros'') in MATLAB is better described as ``number of entries'' in GraphBLAS. -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Scalar\_type\_name:} return name of the type of a scalar} -%------------------------------------------------------------------------------- -\label{scalar_type_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Scalar_type_name // return the name of the type of a scalar -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Scalar s // GrB_Scalar to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Scalar_type_name' returns the name of the type of a scalar. -Analogous to \verb'type = class (s)' in MATLAB. - %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Scalar\_setElement:} set the single entry of a scalar} %------------------------------------------------------------------------------- @@ -3930,7 +3691,8 @@ \subsection{GraphBLAS vectors: {\sf GrB\_Vector}} %============================= \verb'GrB_Vector_clear' & clear a vector of all entries & \ref{vector_clear} \\ \verb'GrB_Vector_size' & size of a vector & \ref{vector_size} \\ \verb'GrB_Vector_nvals' & number of entries in a vector & \ref{vector_nvals} \\ -\verb'GxB_Vector_type_name' & name of the type of a vector & \ref{vector_type_name} \\ +\verb'GrB_get' & get properties of a vector & \ref{get_set_vector} \\ +\verb'GrB_set' & set properties of a vector & \ref{get_set_vector} \\ \verb'GrB_Vector_build' & build a vector from tuples & \ref{vector_build} \\ \verb'GxB_Vector_build_Scalar' & build a vector from tuples & \ref{vector_build_Scalar} \\ \verb'GrB_Vector_setElement' & add an entry to a vector & \ref{vector_setElement} \\ @@ -4069,6 +3831,7 @@ \subsubsection{{\sf GrB\_Vector\_dup:} copy a vector} Then \verb'w' and \verb'u' are two different vectors that currently have the same set of values, but they do not depend on each other. Modifying one has no effect on the other. +The \verb'GrB_NAME' is copied into the new vector. %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Vector\_clear:} clear a vector of all entries} @@ -4133,27 +3896,6 @@ \subsubsection{{\sf GrB\_Vector\_nvals:} return the number of entries in GraphBLAS need not be zero and \verb'nnz' (short for ``number of nonzeros'') in MATLAB is better described as ``number of entries'' in GraphBLAS. -% \newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Vector\_type\_name:} return name of the type of a vector} -%------------------------------------------------------------------------------- -\label{vector_type_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Vector_type_name // return the name of the type of a vector -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Vector v // vector to query -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GxB_Vector_type_name' returns the name of the type of a vector. -Analogous to \verb'type = class (v)' in MATLAB. - \newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Vector\_build:} build a vector from a set of tuples} @@ -4392,7 +4134,7 @@ \subsubsection{{\sf GxB\_Vector\_diag:} extract a diagonal from a matrix} $-m+1$. Any existing entries in \verb'v' are discarded. The type of \verb'v' is preserved, so that if the type of \verb'A' and \verb'v' differ, the entries are typecasted into the type of \verb'v'. Any settings made to \verb'v' by -\verb'GxB_Vector_Option_set' (bitmap switch and sparsity control) are +\verb'GrB_set' (bitmap switch and sparsity control) are unchanged. \newpage @@ -4480,7 +4222,8 @@ \subsection{GraphBLAS matrices: {\sf GrB\_Matrix}} %============================ \verb'GrB_Matrix_nrows' & number of rows of a matrix & \ref{matrix_nrows} \\ \verb'GrB_Matrix_ncols' & number of columns of a matrix & \ref{matrix_ncols} \\ \verb'GrB_Matrix_nvals' & number of entries in a matrix & \ref{matrix_nvals} \\ -\verb'GxB_Matrix_type_name' & type of a matrix & \ref{matrix_type_name} \\ +\verb'GrB_get' & get properties of a matrix & \ref{get_set_matrix} \\ +\verb'GrB_set' & set properties of a matrix & \ref{get_set_matrix} \\ \verb'GrB_Matrix_build' & build a matrix from tuples & \ref{matrix_build} \\ \verb'GxB_Matrix_build_Scalar' & build a matrix from tuples & \ref{matrix_build_Scalar} \\ \verb'GrB_Matrix_setElement' & add an entry to a matrix & \ref{matrix_setElement} \\ @@ -4581,15 +4324,16 @@ \subsubsection{{\sf GrB\_Matrix\_new:} create a matrix} sparse matrices of any type. By default, matrices of size \verb'nrows-by-1' are held by column, regardless -of the global setting controlled by \verb'GxB_set (GxB_FORMAT, ...)', for any -value of \verb'nrows'. Matrices of size \verb'1-by-ncols' with \verb'ncols' -not equal to 1 are held by row, regardless of this global setting. The global -setting only affects matrices with both \verb'm > 1' and \verb'n > 1'. Empty -matrices (\verb'0-by-0') are also controlled by the global setting. +of the global setting controlled by \verb'GrB_set (GrB_GLOBAL, ...,' \newline +\verb'GrB_STORAGE_ORIENTATION_HINT)', for any value of \verb'nrows'. Matrices +of size \verb'1-by-ncols' with \verb'ncols' not equal to 1 are held by row, +regardless of this global setting. The global setting only affects matrices +with both \verb'm > 1' and \verb'n > 1'. Empty matrices (\verb'0-by-0') are +also controlled by the global setting. Once a matrix is created, its format (by-row or by-column) can be arbitrarily -changed with \verb'GxB_set (A, GxB_FORMAT, fmt)' with \verb'fmt' equal to -\verb'GxB_BY_COL' or \verb'GxB_BY_ROW'. +changed with \verb'GrB_set (A, fmt, GrB_STORAGE_ORIENTATION_HINT)' +with \verb'fmt' equal to \verb'GrB_COLMAJOR' or \verb'GrB_ROWMAJOR'. \begin{alert} {\bf SPEC:} \verb'nrows' and/or \verb'ncols' may be zero, @@ -4663,6 +4407,7 @@ \subsubsection{{\sf GrB\_Matrix\_dup:} copy a matrix} Then \verb'C' and \verb'A' are two different matrices that currently have the same set of values, but they do not depend on each other. Modifying one has no effect on the other. +The \verb'GrB_NAME' is copied into the new matrix. %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Matrix\_clear:} clear a matrix of all entries} @@ -4745,25 +4490,6 @@ \subsubsection{{\sf GrB\_Matrix\_nvals:} return the number of entries in MATLAB is better described as ``number of entries'' in GraphBLAS. \newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Matrix\_type\_name:} return name of the type of a matrix} -%------------------------------------------------------------------------------- -\label{matrix_type_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Matrix_type_name // return the name of the type of a matrix -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Matrix A // matrix to query -) ; -\end{verbatim} } \end{mdframed} - -\verb'GxB_Matrix_type_name' returns the name of the type of a matrix, like -\verb'type=class(A)' in MATLAB. - %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Matrix\_build:} build a matrix from a set of tuples} %------------------------------------------------------------------------------- @@ -4854,7 +4580,7 @@ \subsubsection{{\sf GrB\_Matrix\_build:} build a matrix from a set of tuples} The parameter \verb'X' is a pointer to any C equivalent built-in type, or a \verb'void *' pointer. The \verb'GrB_Matrix_build' function uses the -\verb'_Generic' feature of ANSI C11 to detect the type of pointer passed as the +\verb'_Generic' feature of C11 to detect the type of pointer passed as the parameter \verb'X'. If \verb'X' is a pointer to a built-in type, then the function can do the right typecasting. If \verb'X' is a \verb'void *' pointer, then it can only assume \verb'X' to be a pointer to a user-defined type that is @@ -4935,7 +4661,7 @@ \subsubsection{{\sf GrB\_Matrix\_setElement:} add an entry to a matrix} The scalar \verb'x' is typecasted into the type of \verb'C'. Any value can be passed to this function and its type will be detected, via the \verb'_Generic' -feature of ANSI C11. For a user-defined type, \verb'x' is a \verb'void *' +feature of C11. For a user-defined type, \verb'x' is a \verb'void *' pointer that points to a memory space holding a single entry of this user-defined type. This user-defined type must exactly match the user-defined type of \verb'C' since no typecasting is done between user-defined types. @@ -4971,7 +4697,7 @@ \subsubsection{{\sf GrB\_Matrix\_setElement:} add an entry to a matrix} do not access the existing entries may also be done without forcing the updates to be assembled, namely \verb'GrB_Matrix_clear' (which erases all pending updates), \verb'GrB_Matrix_free', \verb'GrB_Matrix_ncols', -\verb'GrB_Matrix_nrows', \verb'GxB_Matrix_type', and of course +\verb'GrB_Matrix_nrows', \verb'GrB_get', and of course \verb'GrB_Matrix_setElement' itself. All other methods and operations cause the updates to be assembled. Future versions of SuiteSparse:GraphBLAS may extend this list. @@ -5270,7 +4996,7 @@ \subsubsection{{\sf GxB\_Matrix\_concat:} concatenate matrices } The type of \verb'C' is unchanged, and all matrices $A_{i,j}$ are typecasted into the type of \verb'C'. Any settings made to \verb'C' by -\verb'GxB_Matrix_Option_set' (format by row or by column, bitmap switch, hyper +\verb'GrB_set' (format by row or by column, bitmap switch, hyper switch, and sparsity control) are unchanged. %------------------------------------------------------------------------------- @@ -5363,7 +5089,7 @@ \subsubsection{{\sf GxB\_Matrix\_diag:} build a diagonal matrix} existing entries in \verb'C' are discarded. The type of \verb'C' is preserved, so that if the type of \verb'C' and \verb'v' differ, the entries are typecasted into the type of \verb'C'. Any settings made to \verb'C' by -\verb'GxB_Matrix_Option_set' (format by row or by column, bitmap switch, hyper +\verb'GrB_set' (format by row or by column, bitmap switch, hyper switch, and sparsity control) are unchanged. %------------------------------------------------------------------------------- @@ -5383,6 +5109,7 @@ \subsubsection{{\sf GxB\_Matrix\_iso:} query iso status of a matrix} Returns the true if the matrix is iso-valued, false otherwise. +\newpage %------------------------------------------------------------------------------- \subsubsection{{\sf GxB\_Matrix\_memoryUsage:} memory used by a matrix} %------------------------------------------------------------------------------- @@ -5440,9 +5167,14 @@ \subsection{Serialize/deserialize methods} process over an MPI channel, or operated on in any other way that moves the bytes around. The contents of the array cannot be interpreted except by deserialization back into a vector or matrix, by the same library (and -sometimes the same version) that created the blob. Currently, all versions of -SuiteSparse:GraphBLAS that implement serialization/deserialization use the same -format for the blob, so the library versions are compatible with each other. +sometimes the same version) that created the blob. + +All versions of SuiteSparse:GraphBLAS that implement +serialization/deserialization use essentially the same format for the blob, so +the library versions are compatible with each other. Version v9.0.0 adds the +\verb'GrB_NAME' and \verb'GrB_EL_TYPE_STRING' to the blob in an upward +compatible manner, so that older versions of SS:GraphBLAS can read the blobs +created by v9.0.0; they simply ignore those components. There are two forms of serialization: \verb'GrB*serialize' and \verb'GxB*serialize'. For the \verb'GrB' form, the blob must first be @@ -5451,7 +5183,7 @@ \subsection{Serialize/deserialize methods} By default, ZSTD (level 1) compression is used for serialization, but other options can be selected via the descriptor: -\verb'GxB_set (desc, GxB_COMPRESSION, method)', where \verb'method' is an +\verb'GrB_set (desc, method, GxB_COMPRESSION)', where \verb'method' is an integer selected from the following options: \vspace{0.2in} @@ -5476,14 +5208,14 @@ \subsection{Serialize/deserialize methods} {\footnotesize \begin{verbatim} - GxB_set (desc, GxB_COMPRESSION, GxB_COMPRESSION_LZ4HC + 6) ; \end{verbatim}} + GrB_set (desc, GxB_COMPRESSION_LZ4HC + 6, GxB_COMPRESSION) ; \end{verbatim}} The ZSTD method can be specified as level 1 to 19, with 1 being the default. To compress with ZSTD at level 6, use: {\footnotesize \begin{verbatim} - GxB_set (desc, GxB_COMPRESSION, GxB_COMPRESSION_ZSTD + 6) ; \end{verbatim}} + GrB_set (desc, GxB_COMPRESSION_ZSTD + 6, GxB_COMPRESSION) ; \end{verbatim}} Deserialization of untrusted data is a common security problem; see \url{https://cwe.mitre.org/data/definitions/502.html}. The deserialization @@ -5520,7 +5252,7 @@ \subsection{Serialize/deserialize methods} \verb'GrB_Matrix_deserialize' & deserialize a matrix & \ref{matrix_deserialize} \\ \verb'GxB_Matrix_deserialize' & deserialize a matrix & \ref{matrix_deserialize_GxB} \\ \hline -\verb'GrB_deserialize_type_name' & return the name of type of the blob & \ref{deserialize_type_name} \\ +\verb'GrB_get' & get blob properties & \ref{get_set_blob} \\ \hline \end{tabular} } @@ -5663,10 +5395,10 @@ \subsubsection{{\sf GxB\_Vector\_deserialize:} deserialize a vector} see Section \ref{matrix_deserialize_GxB} for more information. The blob is allocated with the \verb'malloc' function passed to -\verb'GxB_init', or the ANSI C11 \verb'malloc' if \verb'GrB_init' was used +\verb'GxB_init', or the C11 \verb'malloc' if \verb'GrB_init' was used to initialize GraphBLAS. The blob must be freed by the matching \verb'free' method, either the \verb'free' function passed to \verb'GxB_init' or -the ANSI C11 \verb'free' if \verb'GrB_init' was used. +the C11 \verb'free' if \verb'GrB_init' was used. %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Matrix\_serializeSize:} return size of serialized matrix} @@ -5749,10 +5481,10 @@ \subsubsection{{\sf GxB\_Matrix\_serialize:} serialize a matrix} compression is used, but other options can be selected via the descriptor. The blob is allocated with the \verb'malloc' function passed to -\verb'GxB_init', or the ANSI C11 \verb'malloc' if \verb'GrB_init' was used +\verb'GxB_init', or the C11 \verb'malloc' if \verb'GrB_init' was used to initialize GraphBLAS. The blob must be freed by the matching \verb'free' method, either the \verb'free' function passed to \verb'GxB_init' or -the ANSI C11 \verb'free' if \verb'GrB_init' was used. +the C11 \verb'free' if \verb'GrB_init' was used. \newpage %------------------------------------------------------------------------------- @@ -5782,11 +5514,12 @@ \subsubsection{{\sf GrB\_Matrix\_deserialize:} deserialize a matrix} blob, constructed by either \verb'GrB_Matrix_serialize' or \verb'GxB_Matrix_serialize'. -\begin{alert} -{\bf SPEC:} The specification requires the \verb'type' to always be non-NULL. -As an extension, SuiteSparse:GraphBLAS allows \verb'type' to be NULL if -the blob contains a serialized matrix with a built-in type. -\end{alert} +% extended in the v2.1 C API (type may be NULL): +The \verb'type' may be \verb'NULL' if the blob holds a serialized matrix with a +built-in type. In this case, the type is determined automatically. For +user-defined types, the \verb'type' must match the type of the matrix in the +blob. The \verb'GrB_get' method can be used to query the blob for the name of +this type. %------------------------------------------------------------------------------- \subsubsection{{\sf GxB\_Matrix\_deserialize:} deserialize a matrix} @@ -5814,33 +5547,6 @@ \subsubsection{{\sf GxB\_Matrix\_deserialize:} deserialize a matrix} Identical to \verb'GrB_Matrix_deserialize'. -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_deserialize\_type\_name:} name of the type of a blob} -%------------------------------------------------------------------------------- -\label{deserialize_type_name} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_deserialize_type_name // return the type name of a blob -( - // output: - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - // input, not modified: - const void *blob, // the blob - GrB_Index blob_size // size of the blob -) ; -\end{verbatim} -} \end{mdframed} - -\verb'GrB_deserialize_type_name' returns the name of type of the matrix or -vector serialized into the blob. This method works for any blob, from -% \verb'GrB_Vector_serialize', -\verb'GxB_Vector_serialize', -\verb'GrB_Matrix_serialize', or \verb'GxB_Matrix_serialize'. - \newpage %=============================================================================== \subsection{GraphBLAS pack/unpack: using move semantics} %======== @@ -5956,7 +5662,7 @@ \subsection{GraphBLAS pack/unpack: using move semantics} %======== {\footnotesize \begin{verbatim} - GxB_set (desc, GxB_IMPORT, GxB_SECURE_IMPORT) ; \end{verbatim}} + GrB_set (desc, GxB_SECURE_IMPORT, GxB_IMPORT) ; \end{verbatim}} The table below lists the methods presented in this section. @@ -6281,7 +5987,7 @@ \subsubsection{{\sf GxB\_Matrix\_pack\_CSR:} pack a CSR matrix} \verb'GxB_Matrix_pack_CSR' packs a matrix from 3 user arrays in CSR format. In the resulting \verb'GrB_Matrix A', the \verb'CSR' format is a sparse matrix -with a format (\verb'GxB_FORMAT') of \verb'GxB_BY_ROW'. +with a format (\verb'GrB_STORAGE_ORIENTATION_HINT') of \verb'GrB_ROWMAJOR'. The \verb'GrB_Matrix A' must exist on input with the right type and dimensions. No typecasting is done. @@ -7294,8 +7000,8 @@ \subsection{GraphBLAS import/export: using copy semantics} %==================== \begin{verbatim} typedef enum { - GrB_CSR_FORMAT = 0, // CSR format (equiv to GxB_SPARSE with GxB_BY_ROW) - GrB_CSC_FORMAT = 1, // CSC format (equiv to GxB_SPARSE with GxB_BY_COL) + GrB_CSR_FORMAT = 0, // CSR format (equiv to GxB_SPARSE with GrB_ROWMAJOR) + GrB_CSC_FORMAT = 1, // CSC format (equiv to GxB_SPARSE with GrB_COLMAJOR) GrB_COO_FORMAT = 2 // triplet format (like input to GrB*build) } GrB_Format ; \end{verbatim}} @@ -7343,7 +7049,7 @@ \subsubsection{{\sf GrB\_Matrix\_import:} import a matrix} The matrix can be imported in one of three different formats: \begin{packed_itemize} - \item \verb'GrB_CSR_FORMAT': % CSR format (equiv to GxB_SPARSE with GxB_BY_ROW) + \item \verb'GrB_CSR_FORMAT': % CSR format (equiv to GxB_SPARSE with GrB_ROWMAJOR) Compressed-row format. \verb'Ap' is an array of size \verb'nrows+1'. The arrays \verb'Ai' and \verb'Ax' are of size \verb'nvals = Ap [nrows]', and \verb'Ap[0]' must be zero. @@ -7352,7 +7058,7 @@ \subsubsection{{\sf GrB\_Matrix\_import:} import a matrix} the same locations in \verb'Ax'. The column indices need not be in any particular order. - \item \verb'GrB_CSC_FORMAT': % CSC format (equiv to GxB_SPARSE with GxB_BY_COL) + \item \verb'GrB_CSC_FORMAT': % CSC format (equiv to GxB_SPARSE with GrB_COLMAJOR) Compressed-column format. \verb'Ap' is an array of size \verb'ncols+1'. The arrays \verb'Ai' and \verb'Ax' are of size \verb'nvals = Ap [ncols]', and \verb'Ap[0]' must be zero. @@ -7369,12 +7075,12 @@ \subsubsection{{\sf GrB\_Matrix\_import:} import a matrix} column index \verb'Ap[k]', and value \verb'Ax[k]'. The tuples can appear any order, but no duplicates are permitted. -% \item \verb'GrB_DENSE_ROW_FORMAT': % FullR format (GxB_FULL with GxB_BY_ROW) +% \item \verb'GrB_DENSE_ROW_FORMAT': % FullR format (GxB_FULL with GrB_ROWMAJOR) % Dense matrix format, held by row. Only the \verb'Ax' array is used, of % size \verb'nrows*ncols'. % It holds the matrix in dense format, in row major order. % -% \item \verb'GrB_DENSE_COL_FORMAT': % FullC format (GxB_FULL with GxB_BY_ROW) +% \item \verb'GrB_DENSE_COL_FORMAT': % FullC format (GxB_FULL with GrB_ROWMAJOR) % Dense matrix format, held by column. Only the \verb'Ax' array is used, of % size \verb'nrows*ncols'. % It holds the matrix in dense format, in column major order. @@ -7470,15 +7176,15 @@ \subsubsection{{\sf GrB\_Matrix\_exportHint:} determine best export format} format of the \verb'GrB_Matrix': \begin{packed_itemize} -\item \verb'GxB_SPARSE', \verb'GxB_BY_ROW': export as \verb'GrB_CSR_FORMAT' -\item \verb'GxB_SPARSE', \verb'GxB_BY_COL': export as \verb'GrB_CSC_FORMAT' +\item \verb'GxB_SPARSE', \verb'GrB_ROWMAJOR': export as \verb'GrB_CSR_FORMAT' +\item \verb'GxB_SPARSE', \verb'GrB_COLMAJOR': export as \verb'GrB_CSC_FORMAT' \item \verb'GxB_HYPERSPARSE': export as \verb'GrB_COO_FORMAT' -\item \verb'GxB_BITMAP', \verb'GxB_BY_ROW': export as \verb'GrB_CSR_FORMAT' -\item \verb'GxB_BITMAP', \verb'GxB_BY_COL': export as \verb'GrB_CSC_FORMAT' -%\item \verb'GxB_FULL', \verb'GxB_BY_ROW': export as \verb'GrB_DENSE_ROW_FORMAT' -%\item \verb'GxB_FULL', \verb'GxB_BY_COL': export as \verb'GrB_DENSE_COL_FORMAT' -\item \verb'GxB_FULL', \verb'GxB_BY_ROW': export as \verb'GrB_CSR_FORMAT' -\item \verb'GxB_FULL', \verb'GxB_BY_COL': export as \verb'GrB_CSC_FORMAT' +\item \verb'GxB_BITMAP', \verb'GrB_ROWMAJOR': export as \verb'GrB_CSR_FORMAT' +\item \verb'GxB_BITMAP', \verb'GrB_COLMAJOR': export as \verb'GrB_CSC_FORMAT' +%\item \verb'GxB_FULL', \verb'GrB_ROWMAJOR': export as \verb'GrB_DENSE_ROW_FORMAT' +%\item \verb'GxB_FULL', \verb'GrB_COLMAJOR': export as \verb'GrB_DENSE_COL_FORMAT' +\item \verb'GxB_FULL', \verb'GrB_ROWMAJOR': export as \verb'GrB_CSR_FORMAT' +\item \verb'GxB_FULL', \verb'GrB_COLMAJOR': export as \verb'GrB_CSC_FORMAT' \end{packed_itemize} \newpage @@ -7603,7 +7309,7 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %===================== typedef enum { // for all GrB_Descriptor fields: - GxB_DEFAULT = 0, // default behavior of the method + GrB_DEFAULT = 0, // default behavior of the method // for GrB_OUTP only: GrB_REPLACE = 1, // clear the output before assigning new values to it // for GrB_MASK only: @@ -7708,7 +7414,7 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %===================== \begin{itemize} - \item \verb'GxB_DEFAULT' means that a method is selected automatically. + \item \verb'GrB_DEFAULT' means that a method is selected automatically. \item \verb'GxB_AxB_SAXPY': select any saxpy-based method: \verb'GxB_AxB_GUSTAVSON', and/or @@ -7769,7 +7475,7 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %===================== unjumbled form, or provided as input to a method that requires it to not be jumbled, then sorting it during the matrix multiplication is faster. By default, these methods leave the result in jumbled form (a {\em lazy - sort}), if \verb'GxB_SORT' is set to zero (\verb'GxB_DEFAULT'). A nonzero + sort}), if \verb'GxB_SORT' is set to zero (\verb'GrB_DEFAULT'). A nonzero value will inform the matrix multiplication to sort its result, instead. \item \verb'GxB_COMPRESSION' selects the compression method for serialization. @@ -7784,7 +7490,7 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %===================== {\footnotesize \begin{verbatim} - GxB_set (desc, GxB_IMPORT, GxB_SECURE_IMPORT) ; \end{verbatim}} + GrB_set (desc, GxB_SECURE_IMPORT, GxB_IMPORT) ; \end{verbatim}} \end{itemize} @@ -7798,9 +7504,8 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %===================== \hline \verb'GrB_Descriptor_new' & create a descriptor & \ref{descriptor_new} \\ \verb'GrB_Descriptor_wait' & wait for a descriptor & \ref{descriptor_wait} \\ -\verb'GrB_Descriptor_set' & set a parameter in a descriptor & \ref{descriptor_set} \\ -\verb'GxB_Desc_set' & set a parameter in a descriptor & \ref{desc_set} \\ -\verb'GxB_Desc_get' & get a parameter from a descriptor & \ref{desc_get} \\ +\verb'GrB_get' & get a parameter from a descriptor & \ref{get_set_descriptor} \\ +\verb'GrB_set' & set a parameter in a descriptor & \ref{get_set_descriptor} \\ \verb'GrB_Descriptor_free' & free a descriptor & \ref{descriptor_free} \\ \hline \end{tabular} @@ -7847,139 +7552,6 @@ \subsubsection{{\sf GrB\_Descriptor\_wait:} wait for a descriptor} exploit non-blocking mode to delay its creation. Currently, SuiteSparse:GraphBLAS does nothing except to ensure that \verb'd' is valid. -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GrB\_Descriptor\_set:} set a parameter in a descriptor} -%------------------------------------------------------------------------------- -\label{descriptor_set} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GrB_Descriptor_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - GrB_Desc_Field field, // parameter to change - GrB_Desc_Value val // value to change it to -) ; -\end{verbatim} } \end{mdframed} - -\verb'GrB_Descriptor_set' sets a descriptor field (\verb'GrB_OUTP', -\verb'GrB_MASK', \verb'GrB_INP0', \verb'GrB_INP1', or \verb'GxB_AxB_METHOD') to -a particular value. -If an error occurs, \verb'GrB_error(&err,desc)' returns details about the error. - -\vspace{0.2in} -\noindent -{\footnotesize -\begin{tabular}{|l|p{2.4in}|p{2.2in}|} -\hline -Descriptor & Default & Non-default \\ -field & & \\ -\hline - -\verb'GrB_OUTP' - & \verb'GxB_DEFAULT': - The output matrix is not cleared. The operation computes - ${\bf C \langle M \rangle = C \odot T}$. - & \verb'GrB_REPLACE': - After computing ${\bf Z=C\odot T}$, - the output {\bf C} is cleared of all entries. - Then ${\bf C \langle M \rangle = Z}$ is performed. \\ - -\hline - -\verb'GrB_MASK' - & \verb'GxB_DEFAULT': - The Mask is not complemented. \verb'Mask(i,j)=1' means the value $C_{ij}$ - can be modified by the operation, while \verb'Mask(i,j)=0' means the value - $C_{ij}$ shall not be modified by the operation. - & \verb'GrB_COMP': - The Mask is complemented. \verb'Mask(i,j)=0' means the value $C_{ij}$ - can be modified by the operation, while \verb'Mask(i,j)=1' means the value - $C_{ij}$ shall not be modified by the operation. \\ - & - & \verb'GrB_STRUCTURE': - The values of the Mask are ignored. If \verb'Mask(i,j)' is an entry - in the \verb'Mask' matrix, it is treated as if \verb'Mask(i,j)=1'. - The two options \verb'GrB_COMP' and \verb'GrB_STRUCTURE' can be - combined, with two subsequent calls, or with a single call with the setting - \verb'GrB_COMP+GrB_STRUCTURE'. \\ - -\hline - -\verb'GrB_INP0' - & \verb'GxB_DEFAULT': - The first input is not transposed prior to using it in the operation. - & \verb'GrB_TRAN': - The first input is transposed prior to using it in the operation. Only - matrices are transposed, never vectors. \\ - -\hline - -\verb'GrB_INP1' - & \verb'GxB_DEFAULT': - The second input is not transposed prior to using it in the operation. - & \verb'GrB_TRAN': - The second input is transposed prior to using it in the operation. Only - matrices are transposed, never vectors. \\ - -\hline - -\verb'GrB_AxB_METHOD' - & \verb'GxB_DEFAULT': - The method for \verb'C=A*B' is selected automatically. - & \verb'GxB_AxB_'{\em method}: The selected method is used to compute - \verb'C=A*B'. \\ - -\hline -\end{tabular} -} - -\newpage -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Desc\_set:} set a parameter in a descriptor} -%------------------------------------------------------------------------------- -\label{desc_set} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Desc_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - GrB_Desc_Field field, // parameter to change - ... // value to change it to -) ; -\end{verbatim} } \end{mdframed} - -\verb'GxB_Desc_set' is like \verb'GrB_Descriptor_set', except that the type of -the third parameter can vary with the field. This function can modify all -descriptor settings, including those that do not have the type -\verb'GrB_Desc_Value'. See also \verb'GxB_set' described in -Section~\ref{options}. If an error occurs, \verb'GrB_error(&err,desc)' returns -details about the error. - -%------------------------------------------------------------------------------- -\subsubsection{{\sf GxB\_Desc\_get:} get a parameter from a descriptor} -%------------------------------------------------------------------------------- -\label{desc_get} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Desc_get // get a parameter from a descriptor -( - GrB_Descriptor desc, // descriptor to query; NULL means defaults - GrB_Desc_Field field, // parameter to query - ... // value of the parameter -) ; -\end{verbatim} } \end{mdframed} - -\verb'GxB_Desc_get' returns the value of a single field in a descriptor. The -type of the third parameter is a pointer to a variable type, whose type depends -on the field. See also \verb'GxB_get' described in Section~\ref{options}. - %------------------------------------------------------------------------------- \subsubsection{{\sf GrB\_Descriptor\_free:} free a descriptor} %------------------------------------------------------------------------------- @@ -8298,8 +7870,8 @@ \section{{\sf GxB\_Context:} controlling computational resources} %============= single threaded, with all parallelism is inside GraphBLAS itself. The object is also not needed if the user application is multi-threaded, but all user threads create the same number of threads inside GraphBLAS (say each using a -single thread). In that case, \verb'GxB_set(GxB_NTHREADS,1)' can be used (for -example). +single thread). In that case, \verb'GrB_set(GrB_GLOBAL,1,GxB_NTHREADS)' +can be used (for example). However, suppose the user application creates 5 threads of its own, on a machine with 16 cores, and each thread wants to use a different number of @@ -8310,40 +7882,22 @@ \section{{\sf GxB\_Context:} controlling computational resources} %============= The default context is \verb'GxB_CONTEXT_WORLD', which is not created by the user application but it can be modified. If a user thread does not create its own context, then its computational resources are determine by this -\verb'GxB_CONTEXT_WORLD' object. The following \verb'GxB_set/get' methods -access this global object without naming it directly: - - \begin{itemize} - \item \verb'GxB_set (GxB_NTHREADS, nthreads)' - \item \verb'GxB_get (GxB_NTHREADS, &nthreads)' - \item \verb'GxB_set (GxB_CHUNK, chunk)' - \item \verb'GxB_get (GxB_CHUNK, &chunk)' - \end{itemize} - -Those four operations above are identical to the same set/get operations on the -the world context: - - \begin{itemize} - \item \verb'GxB_Context_set (GxB_CONTEXT_WORLD, GxB_NTHREADS, nthreads)' - \item \verb'GxB_Context_get (GxB_CONTEXT_WORLD, GxB_NTHREADS, &nthreads)' - \item \verb'GxB_Context_set (GxB_CONTEXT_WORLD, GxB_CHUNK, chunk)' - \item \verb'GxB_Context_get (GxB_CONTEXT_WORLD, GxB_CHUNK, &chunk)' - \end{itemize} - -Or, a \verb'NULL' context can be used, which also modifies the world context: +\verb'GxB_CONTEXT_WORLD' object. The following \verb'GrB_set/get' methods +access this global object without naming it directly (where \verb'chunk' +is a \verb'GrB_Scalar' of type \verb'GrB_FP64' or \verb'GrB_FP32'): \begin{itemize} - \item \verb'GxB_Context_set (NULL, GxB_NTHREADS, nthreads)' - \item \verb'GxB_Context_get (NULL, GxB_NTHREADS, &nthreads)' - \item \verb'GxB_Context_set (NULL, GxB_CHUNK, chunk)' - \item \verb'GxB_Context_get (NULL, GxB_CHUNK, &chunk)' + \item \verb'GrB_set (GrB_GLOBAL, nthreads, GxB_NTHREADS)' + \item \verb'GrB_get (GrB_GLOBAL, &nthreads, GxB_NTHREADS)' + \item \verb'GrB_set (GrB_GLOBAL, chunk, GxB_CHUNK)' + \item \verb'GrB_get (GrB_GLOBAL, chunk, GxB_CHUNK)' \end{itemize} The above methods control the OpenMP threads used by all user threads in the user application. To allow each user thread to control its own OpenMP threading, each user thread needs to create its own Context object via \verb'GxB_Context_new'. Next, the user thread must {\em engage} this context -via \verb'GxB_Context_engate'; all subsequent calls to GraphBLAS from this +via \verb'GxB_Context_engage'; all subsequent calls to GraphBLAS from this particular user thread will then use the number of OpenMP threads dictated by this particular context. @@ -8368,7 +7922,7 @@ \section{{\sf GxB\_Context:} controlling computational resources} %============= // each user thread constructs its own context GxB_Context Context = NULL ; GxB_Context_new (&Context) ; - GxB_Context_set (Context, GxB_NTHREADS, ninner) ; + GrB_set (Context, ninner, GxB_NTHREADS) ; GxB_Context_engage (Context) ; // kth user thread builds kth matrix with ninner threads @@ -8403,8 +7957,8 @@ \section{{\sf GxB\_Context:} controlling computational resources} %============= GraphBLAS function & purpose & Section \\ \hline \verb'GxB_Context_new' & create a context & \ref{context_new} \\ -\verb'GxB_Context_set' & set an value in a context & \ref{context_set} \\ -\verb'GxB_Context_get' & get an value from a context & \ref{context_get} \\ +\verb'GrB_get' & get a value from a context & \ref{get_set_context} \\ +\verb'GrB_set' & set a value in a context & \ref{get_set_context} \\ \verb'GxB_Context_engage' & engage a context & \ref{context_engage} \\ \verb'GxB_Context_disengage' & disengage a context & \ref{context_disengage} \\ \verb'GxB_Context_fprint' & check/print a context & \ref{context_print} \\ @@ -8429,66 +7983,10 @@ \subsection{{\sf GxB\_Context\_new:} create a new context} \end{verbatim} } \end{mdframed} A new context is created and initialized with the current global settings for -\verb'GxB_NTHREADS' and \verb'GxB_CHUNK'. See \verb'GxB_Global_Option_get'. +\verb'GxB_NTHREADS' and \verb'GxB_CHUNK'. See \verb'GrB_get'. The context object will not have an effect on any calls to GraphBLAS until it is {\em engaged} by a user thread. -\newpage -%------------------------------------------------------------------------------- -\subsection{{\sf GxB\_Context\_set:} change a setting in a context} -%------------------------------------------------------------------------------- -\label{context_set} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Context_set // set a parameter in a context -( - GxB_Context Context // context to modify - GxB_Context_Field field, // field to modify - ... -) ; -\end{verbatim} } \end{mdframed} - -The \verb'GxB_Context_Field' parameter can currently take on one of two -values, given by the following definition: - -{\footnotesize -\begin{verbatim} -typedef enum -{ - GxB_CONTEXT_NTHREADS = GxB_NTHREADS, // max number of threads to use. - // If <= 0, then one thread is used. - GxB_CONTEXT_CHUNK = GxB_CHUNK, // chunk size for small problems. - // If < 1, then the default is used. -} -GxB_Context_Field ; -\end{verbatim} -} - -For example, \verb'GxB_set (Context, GxB_NTHREADS, 4)' sets the number of -threads in the \verb'Context' to 4. - -%------------------------------------------------------------------------------- -\subsection{{\sf GxB\_Context\_get:} get a setting from a context} -%------------------------------------------------------------------------------- -\label{context_get} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_Context_get // get a parameter in a context -( - GxB_Context Context // context to query - GxB_Context_Field field, // field to query - ... -) ; -\end{verbatim} } \end{mdframed} - -For example, \verb'GxB_get (Context, GxB_NTHREADS, &nthreads)' returns the -number of threads set in the \verb'Context', returning the result in the -\verb'int32_t' scalar, \verb'nthreads'. - \newpage %------------------------------------------------------------------------------- \subsection{{\sf GxB\_Context\_engage:} engaging context} @@ -8654,8 +8152,8 @@ \subsection{Using the JIT} folder after calling \verb'GrB_init'. It can also modify the C compiler and its flags, and can control when and how the JIT is used. These changes are -made via \verb'GxB_Global_Option_set', and can be queried via -\verb'GxB_Global_Option_get'; refer to Section~\ref{options} for details, and +made via \verb'GrB_set', and can be queried via +\verb'GrB_get'; refer to Section~\ref{options} for details, and the \verb'GxB_JIT_*' settings: \vspace{0.15in} @@ -8690,14 +8188,14 @@ \subsection{Using the JIT} definition when the kernel was compiled, then the compiled kernel is discarded and recompiled. The stale kernel is overwritten with the new one, so there is no need to for the user to take any action to delete the stale kernel from the -cache path. If the cache path is changed via \verb'GxB_set', compiled kernels +cache path. If the cache path is changed via \verb'GrB_set', compiled kernels in the old cache folder are not copied over. New ones are compiled instead. %---------------------------------------- \subsubsection{\sf GxB\_JIT\_C\_CONTROL} %---------------------------------------- -The usage of the CPU JIT can be controlled via \verb'GxB_get/set' using the +The usage of the CPU JIT can be controlled via \verb'GrB_get/set' using the \verb'GxB_JIT_C_CONTROL' setting. If the JIT is enabled at compile time, the initial setting is \verb'GxB_JIT_ON'. If the JIT is disabled at compile time (by setting the cmake variable \verb'GRAPHBLAS_USE_JIT' to \verb'OFF'), the @@ -8706,10 +8204,10 @@ \subsubsection{\sf GxB\_JIT\_C\_CONTROL} loaded JIT kernels from memory, use: \begin{verbatim} - GxB_set (GxB_JIT_C_CONTROL, GxB_JIT_OFF) ; + GrB_set (GrB_GLOBAL, GxB_JIT_OFF, GxB_JIT_C_CONTROL) ; \end{verbatim} -The above call to \verb'GxB_set' does not clear any PreJIT kernels, however, +The above call to \verb'GrB_set' does not clear any PreJIT kernels, however, since those are integral components of the single compiled GraphBLAS library and cannot be cleared (see Section~\ref{prejit}). It also does not clear any compiled user functions, created by the JIT for \verb'GxB_*Op_new' when the @@ -8738,7 +8236,7 @@ \subsubsection{\sf GxB\_JIT\_C\_CONTROL} \verb'GxB_JIT_RUN' settings listed above. If the application tries to set the control to \verb'GxB_JIT_LOAD' or \verb'GxB_JIT_ON', the setting is changed to \verb'GxB_JIT_RUN' instead. This is not an error condition. The resulting -setting can be queried via \verb'GxB_get', if desired. +setting can be queried via \verb'GrB_get', if desired. The JIT control setting can be also changed by GraphBLAS itself, based on following error conditions. These changes affect all kernels, not just the @@ -8747,7 +8245,7 @@ \subsubsection{\sf GxB\_JIT\_C\_CONTROL} generic kernels instead. It would return \verb'GrB_OUT_OF_MEMORY' for the last case below. The error is also reported if the \verb'GxB_BURBLE' is enabled. If the JIT is disabled through any of these errors, it can be detected by -\verb'GxB_get' to read the \verb'GxB_JIT_C_CONTROL' state. +\verb'GrB_get' to read the \verb'GxB_JIT_C_CONTROL' state. \begin{itemize} @@ -8874,21 +8372,11 @@ \subsubsection{\sf GxB\_JIT\_USE\_CMAKE} \label{use_cmake} Two methods are provided for compiling the JIT kernels: cmake, and a direct -compiler/link command. - -On Linux or Mac, or the default is false since a direct compile/link is faster. -However, it is possible that some compilers are not handled properly with this -method, so cmake can also be used on those platforms by setting the value of -\verb'GxB_JIT_USE_CMAKE' to true. - -On Windows with MS Visual Studio, only cmake may be used, and this setting is -ignored (it is always true). Direct compilation without cmake on Windows with -MSVC is not yet available. - -When using MINGW on Windows the opposite is true: cmake may not be used, and -this setting ignored (it is always false). The only option is to use a direct -compile instead of using cmake. Using cmake to build kernels when using MINGW -on Windows is not yet available. +compiler/link command. On Windows, only cmake may be used, and this setting +is ignored (it is always true). On Linux or Mac, the default is false since +a direct compile/link is faster. However, it is possible that some compilers +are not handled properly with this method, so cmake can also be used on those +platforms by setting the value of \verb'GxB_JIT_USE_CMAKE' to true. Normally the same version of cmake should be used to compile both GraphBLAS and the JIT kernels. However, compiling GraphBLAS itself requires cmake v3.16 or @@ -8923,1436 +8411,241 @@ \subsection{Compilation options: {\sf GRAPHBLAS\_USE\_JIT} and {\sf GRAPHBLAS\_C %------------------------------------------------------------------------------- The CPU JIT can be disabled at compile time by setting the -\verb'GRAPHBLAS_USE_NIT' option \verb'OFF' in the cmake build options. Good +\verb'GRAPHBLAS_USE_JIT' option \verb'OFF' in the cmake build options. Good performance will be obtained only by using the \verb'FactoryKernels' or the \verb'PreJIT' kernels that are compiled into GraphBLAS when it is first compiled with \verb'cmake'. By default, \verb'GRAPHBLAS_USE_JIT' is \verb'ON', to enable the CPU JIT. -With the introduction of the JIT kernels, it is now possible to obtain good -performance in GraphBLAS without compiling the many {\em factory kernels} that -appear in the \verb'GraphBLAS/Source/FactoryKernels' directory. If the JIT is -enabled, GraphBLAS will still be fast, once the JIT kernels are compiled, or by -using any \verb'PreJIT' kernels. To compile GraphBLAS without its -\verb'FactoryKernels', enable the \verb'GRAPHBLAS_COMPACT' option in the cmake -build options. By default, \verb'GRAPHBLAS_COMPACT' is off, to enable the -\verb'FactoryKernels'. - -When GraphBLAS is compiled with \verb'GRAPHBLAS_USE_JIT' set to \verb'OFF', the -\verb'GxB_JIT_C_CONTROL' may be set to \verb'GxB_JIT_OFF', -\verb'GxB_JIT_PAUSE', or \verb'GxB_JIT_RUN'. No kernels will be loaded at -run-time (the \verb'GxB_JIT_LOAD' setting is disabled and treated as -\verb'GxB_JIT_RUN'), and no new kernels will be compiled at run-time (the -\verb'GxB_JIT_ON' is disabled and treated as \verb'GxB_JIT_RUN'). Only -pre-existing \verb'PreJIT' kernels can be run, described in -Section~\ref{prejit}. - -If both \verb'GRAPHBLAS_USE_JIT' is set \verb'OFF' and -\verb'GRAPHBLAS_COMPACT' is set \verb'ON', all features of GraphBLAS will be -functional. The only fast kernels available will be the \verb'PreJIT' kernels -(if any). Otherwise, generic kernels will be used, in which every single -operator is implemented with a function pointer, and every scalar assignment -requires a \verb'memcpy'. Generic kernels are slow, so using this combination -of options is not recommended when preparing GraphBLAS for production use, -benchmarking, or for a Linux distro or other widely-used distribution, unless -you are able to run your application in advance and create all the JIT kernels -you need, and then copy them into \verb'GraphBLAS/PreJIT'. This would be -impossible to do for a general-purpose case such as a Linux distro, but -feasible for a more targetted application such as RedisGraph. - -%------------------------------------------------------------------------------- -\subsection{Adding {\sf PreJIT} kernels to GraphBLAS} -%------------------------------------------------------------------------------- -\label{prejit} - -When GraphBLAS runs, it constructs JIT kernels in the user's cache folder, -which by default is \verb'~/.SuiteSparse/GrB8.0.0' for v8.0.0. The -kernels placed in a subfolder (\verb'c') and inside that folder they are -further subdivided arbitrarily into subfolders (via an arbitary hash). The -files are split into subfolders because a single folder may grow too large for -efficient access. Once GraphBLAS has generated some kernels, some or all of -them kernels can then incorporated into the compiled GraphBLAS library by -copying them into the \verb'GraphBLAS/PreJIT' folder. Be sure to move any -\verb'*.c' files into the single \verb'GraphBLAS/PreJIT' folder; do not keep -the subfolder structure. - -If GraphBLAS is then recompiled via cmake, the build system will detect these -kernels, compile them, and make them available as pre-compiled JIT kernels. -The kernels are no longer ``Just-In-Time'' kernels since they are not compiled -at run-time. They are refered to as \verb'PreJIT' kernels since they were at -one time created at run-time by the GraphBLAS JIT, but are now compiled into -GraphBLAS before it runs. - -{\bf It's that simple.} Just copy the source files for any kernels you want -from your cache folder (typically \verb'~/.SuiteSparse/GrB8.0.0/c') into -\verb'GraphBLAS/PreJIT', and recompile GraphBLAS. There's no need to change -any other cmake setting, and no need to do anything different in any -applications that use GraphBLAS. Do not copy the compiled libraries; they are -not needed and will be ignored. Just copy the \verb'*.c' files. - -If the resulting GraphBLAS library is installed for system-wide usage (say in a -Linux distro, Python, RedisGraph, etc), the \verb'GraphBLAS/PreJIT' kernels -will be available to all users of that library. They are not disabled by the -\verb'GRAPHBLAS_USE_JIT' option. - -Once these kernels are moved to \verb'GraphBLAS/PreJIT' and GraphBLAS is -recompiled, they can be deleted from the cache folder. However, even if they -are left there, they will not be used since GraphBLAS will find these kernels -as PreJIT kernels inside the compiled library itself (\verb'libgraphblas.so' on -Linux, \verb'libgraphblas.dylib' on the Mac). GraphBLAS will not be any slower -if these kernels are left in the cache folder, and the compiled library size -will not be affected. - -If the GraphBLAS version is changed at all (even in the last digit), all -\verb'GB_jit_*.c' files in the \verb'GraphBLAS/PreJIT' folder should be -deleted. The version mismatch will be detected during the call to -\verb'GrB_init', and any stale kernels will be safely ignored. Likewise, if a -user-defined type or operator is changed, the relevant kernels should also be -deleted from \verb'GraphBLAS/PreJIT'. For example, the -\verb'GraphBLAS/Demo/Program/gauss_demo.c' program creates a user-defined -\verb'gauss' type, and two operators, \verb'addgauss' and \verb'multgauss'. It -then intentionally changes one of the operators just to test this feature. If -the type and/or operators are changed, then the \verb'*gauss*.c' files in the -\verb'GraphBLAS/PreJIT' folder should be deleted. - -GraphBLAS will safely detect any stale \verb'PreJIT' kernels by checking them -the first time they are run after calling \verb'GrB_init' and will not use them -if they are found to be stale. If the JIT control is set to \verb'GxB_JIT_OFF' -all PreJIT kernels are flagged as unchecked. If the JIT is then renabled by -setting the control to \verb'GxB_JIT_RUN' or \verb'GxB_JIT_ON', all PreJIT -kernels will be checked again and any stale kernels will be detected. - -If a stale PreJIT kernel is found, GraphBLAS will use its run-time JIT to -compile new ones with the current definitions, or it will punt to a generic -kernel if JIT compilation is disabled. GraphBLAS will be functional, and fast -if it can rely on a JIT kernel, but the unusable stale PreJIT kernels take up -space inside the compiled GraphBLAS library. The best practice is to delete -any stale kernels from the \verb'GraphBLAS/PreJIT' folder, or replace them with -newly compiled JIT kernels from the cache folder, and recompile GraphBLAS. - -It is safe to copy only a subset of the JIT kernels from the cache folder into -\verb'GraphBLAS/PreJIT'. You may also delete any files in -\verb'GraphBLAS/PreJIT' and recompile GraphBLAS without those kernels. If -GraphBLAS encounters a need for a particular kernel that has been removed from -\verb'GraphBLAS/PreJIT', it will create it at run-time via the JIT, if -permitted. If not permitted, by either compiling GraphBLAS with the -\verb'GRAPHBLAS_USE_JIT' option set ot \verb'OFF', or by using -\verb'GxB_JIT_C_CONTROL' at run-time, the factory kernel or generic kernel will -be used instead. The generic kernel will be slower than the PreJIT or JIT -kernel, but GraphBLAS will still be functional. - -In addition to a single \verb'README.txt' file, the \verb'GraphBLAS/PreJIT' -folder includes a \verb'.gitignore' file that prevents any files in the folder -from being synced via \verb'git'. If you wish to add your PreJIT kernels to a -fork of GraphBLAS, you will need to revise this \verb'.gitignore' file. - -%------------------------------------------------------------------------------- -\subsection{{\sf JIT} and {\sf PreJIT} performance considerations} -%------------------------------------------------------------------------------- -\label{jit_performance} - -To create a good set of PreJIT kernels for a particular user application, it is -necessary to run the application with many different kinds of workloads. Each -JIT or PreJIT kernel is specialized to the particular matrix format, data type, -operators, and descriptors of its inputs. GraphBLAS can change a matrix format -(from sparse to hypersparse, for example), at its discretion, thus triggering -the use of a different kernel. Some GraphBLAS methods use heuristics to select -between different methods based upon the sparsity structure or estimates of the -kind or amount of work required. In these cases, entirely different kernels -will be compiled. As a result, it's very difficult to predict which kernels -GraphBLAS will find the need to compile, and thus a wide set of test cases -should be used in an application to allow GraphBLAS to generate as many kernels -as could be expected to appear in production use. - -GraphBLAS can encounter very small matrices, and it will often select its -bitmap format to store them. This change of format will trigger a different -kernel than the sparse or hypersparse cases. There are many other cases like -that where specific kernels are only needed for small problems. In this case, -compiling an entirely new kernel is costly, since using a compiled kernel will -be no faster than the generic kernel. When benchmarking an application to -allow GraphBLAS to compile its JIT kernels, it may be useful to pause the JIT -via \verb'GxB_JIT_PAUSE', \verb'GxB_JIT_RUN', or \verb'GxB_JIT_LOAD', when the -application knows it is calling GraphBLAS for tiny problems. These three -settings keep any loaded JIT kernels in memory, but pauses the compilation of -any new JIT kernels. Then the control can be reset to \verb'GxB_JIT_ON' once -the application finishes with its tiny problems and moves to larger ones where -the JIT will improve performance. A future version of GraphBLAS may allow -this heuristic to be implemented inside GraphBLAS itself, but for now, the -JIT does not second guess the user application; if it wants a new kernel, -the JIT will compile it if the control is set to \verb'GxB_JIT_ON'. - -%------------------------------------------------------------------------------- -\subsection{Mixing JIT kernels: MATLAB and Apple Silicon} -%------------------------------------------------------------------------------- - -In general, the JIT kernels compiled by the C interface and the kernels -compiled while using GraphBLAS in MATLAB are interchangable, and the same cache -folder can be used for both. This is the default. - -However, when using the \verb'@GrB' MATLAB interface to GraphBLAS on Apple -Silicon, the MATLAB JIT kernels are compiled as x86 binaries and executed -inside MATLAB via Rosetta. The pure C installation may compile native Arm64 -binaries for its JIT kernels. Do not mix the two. In this case, set another -cache path for MATLAB using \verb'GrB.jit' in MATLAB, or using \verb'GxB_set' -in the C interface for your native Arm64 binaries. - -%------------------------------------------------------------------------------- -\subsection{Updating the JIT when GraphBLAS source code changes} -%------------------------------------------------------------------------------- - -If you edit the GraphBLAS source code itself or add any files to -\verb'GraphBLAS/PreJIT', read the instructions in -\verb'GraphBLAS/JITpackage/README.txt' for details on how to update the JIT -source code. - -If your cache folder (\verb'~/.SuiteSparse/GrBx.y.z') changes in any way -except via GraphBLAS itself, simply delete your cache folder. GraphBLAS will -then reconstruct the kernels there as needed. - -%------------------------------------------------------------------------------- -\subsection{Future plans for the {\sf JIT} and {\sf PreJIT}} -%------------------------------------------------------------------------------- -\label{jit_future} - -\subsubsection{More JIT kernels} -I have 44 JIT kernels but could write about another 43 for \verb'GrB_assign', -\verb'GrB_extract', \verb'GrB_kronecker', and other kernels. Grep the source -code for \verb'JIT: needed' for a list. The current JIT kernels cover all the -\verb'generic' kernels in SuiteSparse GraphBLAS v7.x and earlier for which {\em -factory} kernels are available. However, in those versions, some kernels are -only generic. This version does not accelerate those, but they will be -accelerated by the JIT in a future version. - -\subsubsection{Kernel fusion} -The introduction of the JIT and its related PreJIT kernels allow for the future -exploitation of kernel fusion via an aggressive exploitation of the GraphBLAS -non-blocking mode. In that mode, multiple calls to GraphBLAS can be fused into -a single kernel. There are far to many possible variants to allow a fused -kernel to appear in the \verb'GraphBLAS/Source/FactoryKernels' folder, but -specific fused kernels could be created by the JIT. - -\subsubsection{Heuristics for controlling the JIT} -As mentioned in Section~\ref{jit_performance}, GraphBLAS may compile JIT -kernels that are used for only tiny problems where the compile time of a single -kernel will dominate any performance gains from using the compiled kernel. A -heuristic could be introduced so that it compiles them only for larger -problems. - -\subsubsection{CUDA / SYCL / OpenCL kernels} -The CUDA JIT will enable NVIDIA GPUs to be exploited. There are simply too -many kernels to create at compile time as the ``factory kernels.'' This CUDA -JIT is in progress. A related JIT for SYCL / OpenCL kernels is under -consideration. - -\subsubsection{Better performance for multithreaded user programs:} -This version is thread-safe when used in a multithread user application, but a -better JIT critical section (many readers, one writer) might be needed. The -current critical section may be sufficiently fast since the typical case of -work done inside the critical section is a single hash table lookup. However, -the performance issues related to this have not been tested. This has no -effect if all parallelism is exploited only within GraphBLAS. It only -affects the case when multiple user threads each call GraphBLAS in parallel -(using the \verb'GxB_Context'; see Section~\ref{context}). - -\newpage -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{SuiteSparse:GraphBLAS Options} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\label{options} - -SuiteSparse:GraphBLAS includes two type-generic methods, \verb'GxB_set' and -\verb'GxB_get', that set and query various options and parameters settings, -including a generic way to set values in the \verb'GrB_Descriptor' object. -Using these methods, the user application can provide hints to -SuiteSparse:GraphBLAS on how it should store and operate on its matrices. -These hints have no effect on the results of any GraphBLAS operation (except -perhaps floating-point roundoff differences), but they can have a great impact -on the amount of time or memory taken. - -\begin{note} -{\bf NOTE:} In the next release, \verb'GxB_get' and \verb'GxB_set' will be -replaced by \verb'GrB_*_get' and \verb'GrB_*_set', using the v2.1 C API -Specification. -\end{note} - -%------------------------------------------------------------------------------- -\subsection{{\sf GxB\_set}: overview} -%------------------------------------------------------------------------------- - -\begin{itemize} - -\item \verb'GxB_set (field, value)' sets global options. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_HYPER_SWITCH' & \verb'double' & hypersparsity control (0 to 1) \\ -\verb'GxB_BITMAP_SWITCH' & \verb'double [8]' & bitmap control \\ -\verb'GxB_FORMAT' & \verb'int' & \verb'GxB_BY_ROW' - or \verb'GxB_BY_COL' \\ -\verb'GxB_GLOBAL_NTHREADS' & \verb'int' & number of threads to use \\ -\verb'GxB_NTHREADS' & \verb'int' & number of threads to use \\ -\verb'GxB_GLOBAL_CHUNK' & \verb'double' & chunk size \\ -\verb'GxB_CHUNK' & \verb'double' & chunk size \\ -\verb'GxB_BURBLE' & \verb'int' & diagnostic output \\ -\verb'GxB_PRINTF' & see below & diagnostic output \\ -\verb'GxB_FLUSH' & see below & diagnostic output \\ -\verb'GxB_PRINT_1BASED' & \verb'int' & for printing matrices/vectors \\ -\hline -\verb'GxB_JIT_C_COMPILER_NAME' & \verb'char *' & C compiler for JIT kernels \\ -\verb'GxB_JIT_C_COMPILER_FLAGS'& \verb'char *' & flags for the C compiler \\ -\verb'GxB_JIT_C_LINKER_FLAGS' & \verb'char *' & link flags for the C compiler \\ -\verb'GxB_JIT_C_LIBRARIES' & \verb'char *' & libraries to link against \\ -\verb'GxB_JIT_C_CMAKE_LIBS' & \verb'char *' & libraries to link against \\ -\verb'GxB_JIT_C_PREFACE' & \verb'char *' & C code as preface to JIT kernels \\ -\verb'GxB_JIT_C_CONTROL' & see Section \ref{jit} & CPU JIT control \\ -\verb'GxB_JIT_USE_CMAKE' & see Section \ref{jit} & CPU JIT: use cmake \\ -\verb'GxB_JIT_ERROR_LOG' & \verb'char *' & error log file \\ -\verb'GxB_JIT_CACHE_PATH' & \verb'char *' & folder with compiled kernels \\ -\hline -\end{tabular} -} - -\item \verb'GxB_set (GrB_Matrix A, field, value)' provides hints to - SuiteSparse: GraphBLAS on how to store a particular matrix. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_HYPER_SWITCH' & \verb'double' & hypersparsity control (0 to 1) \\ -\verb'GxB_BITMAP_SWITCH' & \verb'double' & bitmap control (0 to 1) \\ -\verb'GxB_FORMAT' & \verb'int' & \verb'GxB_BY_ROW' - or \verb'GxB_BY_COL' \\ -\verb'GxB_SPARSITY_CONTROL' & \verb'int' & 0 to 15 \\ -\hline -\end{tabular} -} - -\item \verb'GxB_set (GrB_Vector v, field, value)' provides hints to - SuiteSparse: GraphBLAS on how to store a particular vector. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_BITMAP_SWITCH' & \verb'double' & bitmap control (0 to 1) \\ -\verb'GxB_SPARSITY_CONTROL' & \verb'int' & 0 to 15 \\ -\hline -\end{tabular} -} - -\item \verb'GxB_set (GrB_Descriptor desc, field, value)' sets - the value of a field in a \verb'GrB_Descriptor'. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GrB_OUTP' & \verb'GrB_Desc_Value' & replace option \\ -\verb'GrB_MASK' & \verb'GrB_Desc_Value' & mask option \\ -\verb'GrB_INP0' & \verb'GrB_Desc_Value' & transpose input 0 \\ -\verb'GrB_INP1' & \verb'GrB_Desc_Value' & transpose input 1 \\ -\verb'GxB_AxB_METHOD' & \verb'int' & method for matrix multiply \\ -\verb'GxB_SORT' & \verb'int' & lazy vs aggressive sort \\ -\verb'GxB_COMPRESSION' & \verb'int' & compression for serialization \\ -\verb'GxB_IMPORT' & \verb'GrB_Desc_Value' & trust data on import/pack \\ -\hline -\end{tabular} -} - -\item \verb'GxB_set (GxB_Context desc, field, value)' sets - the value of a field in a \verb'GxB_Context'. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_NTHREADS' & \verb'int' & number of threads to use \\ -\verb'GxB_CHUNK' & \verb'double' & chunk size \\ -\hline -\end{tabular} -} - -\end{itemize} - -%------------------------------------------------------------------------------- -\subsection{{\sf GxB\_get}: overview} -%------------------------------------------------------------------------------- - -\verb'GxB_get' queries a \verb'GrB_Descriptor', a \verb'GrB_Matrix', -a \verb'GrB_Vector', or the global options. - -\begin{itemize} - -\item \verb'GxB_get (field, &value)' retrieves the value of a global option. -NOTE: the \verb'const char *' values returned by \verb'GxB_get' are pointers -to memory spaces ``owned'' by the GraphBLAS library. Do not modify them. -Subsequent calls to GraphBLAS (particularly setting the JIT control strings) -can change those strings. The user application must copy those strings into -its own memory space if the strings are to be kept. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_HYPER_SWITCH' & \verb'double' & hypersparsity control (0 to 1) \\ -\verb'GxB_BITMAP_SWITCH' & \verb'double [8]' & bitmap control \\ -\verb'GxB_FORMAT' & \verb'int' & \verb'GxB_BY_ROW' or \verb'GxB_BY_COL' \\ -\verb'GxB_GLOBAL_NTHREADS' & \verb'int' & number of threads to use \\ -\verb'GxB_NTHREADS' & \verb'int' & number of threads to use \\ -\verb'GxB_GLOBAL_CHUNK' & \verb'double' & chunk size \\ -\verb'GxB_CHUNK' & \verb'double' & chunk size \\ -\verb'GxB_BURBLE' & \verb'int' & diagnostic output \\ -\verb'GxB_PRINTF' & see below & diagnostic output \\ -\verb'GxB_FLUSH' & see below & diagnostic output \\ -\verb'GxB_PRINT_1BASED' & \verb'int' & for printing matrices/vectors \\ -\hline -\verb'GxB_JIT_C_COMPILER_NAME' & \verb'const char *' & C compiler for JIT kernels \\ -\verb'GxB_JIT_C_COMPILER_FLAGS'& \verb'const char *' & flags for the C compiler \\ -\verb'GxB_JIT_C_LINKER_FLAGS' & \verb'const char *' & link flags for the C compiler \\ -\verb'GxB_JIT_C_LIBRARIES' & \verb'const char *' & libraries to link against \\ -\verb'GxB_JIT_C_CMAKE_LIBS' & \verb'const char *' & libraries to link against \\ -\verb'GxB_JIT_C_PREFACE' & \verb'const char *' & C code as preface to JIT kernels \\ -\verb'GxB_JIT_C_CONTROL' & see Section \ref{jit} & CPU JIT control \\ -\verb'GxB_JIT_USE_CMAKE' & see Section \ref{jit} & CPU JIT: use cmake \\ -\verb'GxB_JIT_ERROR_LOG' & \verb'const char *' & error log file \\ -\verb'GxB_JIT_CACHE_PATH' & \verb'const char *' & folder with compiled kernels \\ -\hline -\verb'GxB_MODE' & \verb'int' & blocking/non-blocking \\ -\verb'GxB_LIBRARY_NAME' & \verb'const char *' & name of library \\ -\verb'GxB_LIBRARY_VERSION' & \verb'int [3]' & library version \\ -\verb'GxB_LIBRARY_DATE' & \verb'const char *' & release date \\ -\verb'GxB_LIBRARY_ABOUT' & \verb'const char *' & about the library \\ -\verb'GxB_LIBRARY_LICENSE' & \verb'const char *' & license \\ -\verb'GxB_LIBRARY_COMPILE_DATE' & \verb'const char *' & date of compilation \\ -\verb'GxB_LIBRARY_COMPILE_TIME' & \verb'const char *' & time of compilation \\ -\verb'GxB_LIBRARY_OPENMP' & \verb'bool' & true if compiled with OpenMP\\ -\verb'GxB_LIBRARY_URL' & \verb'const char *' & url of library \\ -\verb'GxB_API_VERSION' & \verb'int [3]' & C API version \\ -\verb'GxB_API_DATE' & \verb'const char *' & C API date \\ -\verb'GxB_API_ABOUT' & \verb'const char *' & about the C API \\ -\verb'GxB_API_URL' & \verb'const char *' & \verb'http://graphblas.org' \\ -\verb'GxB_COMPILER_NAME' & \verb'const char *' & C compiler name \\ -\verb'GxB_COMPILER_VERSION' & \verb'int [3]' & C compiler version \\ -\hline -\end{tabular} -} - -\newpage -\item \verb'GxB_get (GrB_Matrix A, field, &value)' retrieves the current - value of an option from a particular matrix \verb'A'. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_HYPER_SWITCH' & \verb'double' & hypersparsity control (0 to 1) \\ -\verb'GxB_BITMAP_SWITCH' & \verb'double' & bitmap control (0 to 1) \\ -\verb'GxB_FORMAT' & \verb'int' & \verb'GxB_BY_ROW' - or \verb'GxB_BY_COL' \\ -\verb'GxB_SPARSITY_CONTROL' & \verb'int' & 0 to 15 \\ -\verb'GxB_SPARSITY_STATUS' & \verb'int' & 1, 2, 4, or 8 \\ -\hline -\end{tabular} -} - -\item \verb'GxB_get (GrB_Vector A, field, &value)' retrieves the current - value of an option from a particular vector \verb'v'. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_BITMAP_SWITCH' & \verb'double' & bitmap control (0 to 1) \\ -\verb'GxB_FORMAT' & \verb'int' & \verb'GxB_BY_ROW' - or \verb'GxB_BY_COL' \\ -\verb'GxB_SPARSITY_CONTROL' & \verb'int' & 0 to 15 \\ -\verb'GxB_SPARSITY_STATUS' & \verb'int' & 1, 2, 4, or 8 \\ -\hline -\end{tabular} -} - -\item \verb'GxB_get (GrB_Descriptor desc, field, &value)' retrieves the value - of a field in a descriptor. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GrB_OUTP' & \verb'GrB_Desc_Value' & replace option \\ -\verb'GrB_MASK' & \verb'GrB_Desc_Value' & mask option \\ -\verb'GrB_INP0' & \verb'GrB_Desc_Value' & transpose input 0 \\ -\verb'GrB_INP1' & \verb'GrB_Desc_Value' & transpose input 1 \\ -\verb'GxB_AxB_METHOD' & \verb'int' & method for matrix multiply \\ -\verb'GxB_SORT' & \verb'int' & lazy vs aggressive sort \\ -\verb'GxB_COMPRESSION' & \verb'int' & compression for serialization \\ -\verb'GxB_IMPORT' & \verb'GrB_Desc_Value' & trust data on import/pack \\ -\hline -\end{tabular} -} - -\item \verb'GxB_get (GxB_Context desc, field, value)' retrieves - the value of a field in a \verb'GxB_Context'. - -{\footnotesize -\begin{tabular}{lll} -field & value & description \\ -\hline -\verb'GxB_NTHREADS' & \verb'int' & number of threads to use \\ -\verb'GxB_CHUNK' & \verb'double' & chunk size \\ -\hline -\end{tabular} -} - -\end{itemize} - -%------------------------------------------------------------------------------- -\newpage -\subsection{OpenMP parallelism} -%------------------------------------------------------------------------------- -\label{omp_parallelism} - -SuiteSparse:GraphBLAS is a parallel library, based on OpenMP. By -default, all GraphBLAS operations will use up to the maximum number of threads -specified by the \verb'omp_get_max_threads' OpenMP function. For small -problems, GraphBLAS may choose to use fewer threads, using two parameters: the -maximum number of threads to use (which may differ from the -\verb'omp_get_max_threads' value), and a parameter called the \verb'chunk'. -Suppose \verb'work' is a measure of the work an operation needs to perform (say -the number of entries in the two input matrices for \verb'GrB_eWiseAdd'). No -more than \verb'floor(work/chunk)' threads will be used (or one thread if the -ratio is less than 1). - -\verb'GxB_NTHREADS' controls how many threads a method uses. - By default (if set to zero, or \verb'GxB_DEFAULT'), all available threads - are used. The maximum available threads is controlled by the global - setting, which is \verb'omp_get_max_threads ( )' by default. If set to - some positive integer \verb'nthreads' less than this maximum, at most - \verb'nthreads' threads will be used. - -\verb'GxB_CHUNK' is a \verb'double' value that controls how many threads - a method uses for small problems. -The default \verb'chunk' value is 65,536, but this may change in future -versions, or it may be modified when GraphBLAS is installed on a particular -machine. - -Both parameters can be set in two ways: - -\begin{itemize} - -\item Globally: If the following methods are used, then all subsequent -GraphBLAS operations will use these settings. Note the typecast, -\verb'(double)' \verb'chunk'. This is necessary if a literal constant such as -\verb'20000' is passed as this argument. The type of the constant must be -\verb'double'. - - {\footnotesize - \begin{verbatim} - int nthreads_max = 40 ; - GxB_set (GxB_NTHREADS, nthreads_max) ; - GxB_set (GxB_CHUNK, (double) 20000) ; \end{verbatim} } - -\item Context: this object can be used to choose a different number of -threads used in calls to GraphBLAS from different user threads, exploiting -nested parallelism. Refer to Section~\ref{context}. If a thread has engaged a -context object, it ignores the global settings for \verb'GxB_NTHREADS' and -\verb'GxB_CHUNK', and uses the settings in its own context instead. - -\end{itemize} - -The smaller of \verb'nthreads_max' and \verb'floor(work/chunk)' is used for any -given GraphBLAS operation, except that a single thread is used if this value is -zero or less. - -If either parameter is set to \verb'GxB_DEFAULT', then default values are used. -The default for \verb'nthreads_max' is the return value from -\verb'omp_get_max_threads', and the default chunk size is currently 65,536. - -If a descriptor value for either parameter is left at its default, or set to -\verb'GxB_DEFAULT', then the global setting is used. This global setting may -have been modified from its default, and this modified value will be used. - -For example, suppose \verb'omp_get_max_threads' reports 8 threads. If \newline -\verb'GxB_set (GxB_NTHREADS, 4)' is used, then the global setting is four -threads, not eight. - -GraphBLAS may be compiled without OpenMP, by setting \verb'-DNOPENMP=1'. -The library will be thread-safe, with one exception. \verb'GrB_wait' is -intended to provide thread-safety by flushing the cache of one user thread -so the object can be safely read by another thread. This is accomplished -with \verb'pragma omp flush', but if OpenMP is not available, this does -nothing. If OpenMP is not available or \verb'-DNOPENMP=1' is used, then -user applications need to ensure their own thread safety when one user thread -computes a result that is then read by another thread. - -You can query GraphBLAS at run-time to ask if it was compiled with OpenMP: - -\begin{verbatim} - bool have_openmp ; - GxB_get (GxB_LIBRARY_OPENMP, &have_openmp) ; - if (!have_openmp) printf ("GraphBLAS not compiled with OpenMP\n") : -\end{verbatim} - -Compiling GraphBLAS without OpenMP is not recommended for installation in a -package manager (Linux, conda-forge, spack, brew, vcpkg, etc). - -%------------------------------------------------------------------------------- -\subsection{Storing a matrix by row or by column} -%------------------------------------------------------------------------------- - -The GraphBLAS \verb'GrB_Matrix' is entirely opaque to the user application, and -the GraphBLAS API does not specify how the matrix should be stored. However, -choices made in how the matrix is represented in a particular implementation, -such as SuiteSparse:GraphBLAS, can have a large impact on performance. - -Many graph algorithms are just as fast in any format, but some algorithms are -much faster in one format or the other. For example, suppose the user -application stores a directed graph as a matrix \verb'A', with the edge $(i,j)$ -represented as the value \verb'A(i,j)', and the application makes many accesses -to the $i$th row of the matrix, with \verb'GrB_Col_extract' -\verb'(w,...,A,GrB_ALL,...,i,desc)' with the transposed descriptor -(\verb'GrB_INP0' set to \verb'GrB_TRAN'). If the matrix is stored by column -this can be extremely slow, just like the expression \verb'w=A(i,:)' in MATLAB, -where \verb'i' is a scalar. Since this is a typical use-case in graph -algorithms, the default format in SuiteSparse:GraphBLAS is to store its -matrices by row, in Compressed Sparse Row format (CSR). - -MATLAB stores its sparse matrices by column, in ``non-hypersparse'' format, in -what is called the Compressed Sparse Column format, or CSC for short. An -\verb'm'-by-\verb'n' matrix in MATLAB is represented as a set of \verb'n' -column vectors, each with a sorted list of row indices and values of the -nonzero entries in that column. As a result, \verb'w=A(:,j)' is very fast in -MATLAB, since the result is already held in the data structure a single list, -the $j$th column vector. However, \verb'w=A(i,:)' is very slow in MATLAB, -since every column in the matrix has to be searched to see if it contains row -\verb'i'. In MATLAB, if many such accesses are made, it is much better to -transpose the matrix (say \verb"AT=A'") and then use \verb"w=AT(:,i)" instead. -This can have a dramatic impact on the performance of MATLAB. - -Likewise, if \verb'u' is a very sparse column vector and \verb'A' is stored by -column, then \verb"w=u'*A" (via \verb'GrB_vxm') is slower than \verb'w=A*u' -(via \verb'GrB_mxv'). The opposite is true if the matrix is stored by row. - -SuiteSparse:GraphBLAS stores its matrices by row, by default (with one -exception described below). However, it can also be instructed to store any -selected matrices, or all matrices, by column instead (just like MATLAB), so -that \verb'w=A(:,j)' (via \verb'GrB_Col_extract') is very fast. The change in -data format has no effect on the result, just the time and memory usage. To -use a column-oriented format by default, the following can be done in a user -application that tends to access its matrices by column. - - {\footnotesize - \begin{verbatim} - GrB_init (...) ; - // just after GrB_init: do the following: - #ifdef GxB_SUITESPARSE_GRAPHBLAS - GxB_set (GxB_FORMAT, GxB_BY_COL) ; - #endif \end{verbatim} } - -If this is done, and no other \verb'GxB_set' calls are made with -\verb'GxB_FORMAT', all matrices will be stored by column. -The default format is \verb'GxB_BY_ROW'. - -All vectors (\verb'GrB_Vector') are held by column, and this cannot be changed. - -By default, matrices of size \verb'm-by-1' are held by column, regardless of -the global setting described above. Matrices of size \verb'1-by-n' with -\verb'n' not equal to 1 are held by row, regardless of the global setting. -The global setting only affects matrices with both \verb'm > 1' and \verb'n > 1'. -Empty matrices (\verb'0-by-0') are also controlled by the global setting. - -After creating a matrix with \verb'GrB_Matrix_new (&A, ...)', -its format can be changed arbitrarily with \verb'GxB_set (A, GxB_FORMAT, ...)'. -So even an \verb'm-by-1' matrix can then be changed to be held by row, for -example. Likewise, once a \verb'1-by-n' matrix is created, it can be converted -to column-oriented format. - -%------------------------------------------------------------------------------- -\subsection{Hypersparse matrices} -\label{hypersparse} -%------------------------------------------------------------------------------- - -MATLAB can store an \verb'm'-by-\verb'n' matrix with a very large value of -\verb'm', since a CSC data structure takes $O(n+|{\bf A}|)$ memory, independent -of \verb'm', where $|{\bf A}|$ is the number of nonzeros in the matrix. It -cannot store a matrix with a huge \verb'n', and this structure is also -inefficient when $|{\bf A}|$ is much smaller than \verb'n'. In contrast, -SuiteSparse:GraphBLAS can store its matrices in {\em hypersparse} format, -taking only $O(|{\bf A}|)$ memory, independent of how it is stored (by row or -by column) and independent of both \verb'm' and \verb'n' -\cite{BulucGilbert08,BulucGilbert12}. - -In both the CSR and CSC formats, the matrix is held as a set of sparse vectors. -In non-hypersparse format, the set of sparse vectors is itself dense; all -vectors are present, even if they are empty. For example, an -\verb'm'-by-\verb'n' matrix in non-hypersparse CSC format contains \verb'n' -sparse vectors. Each column vector takes at least one integer to represent, -even for a column with no entries. This allows for quick lookup for a -particular vector, but the memory required is $O(n+|{\bf A}|)$. With a -hypersparse CSC format, the set of vectors itself is sparse, and columns with -no entries take no memory at all. The drawback of the hypersparse format is -that finding an arbitrary column vector \verb'j', such as for the computation -\verb'C=A(:,j)', takes $O(\log k)$ time if there $k \le n$ vectors in the data -structure. One advantage of the hypersparse structure is the memory required -for an \verb'm'-by-\verb'n' hypersparse CSC matrix is only $O(|{\bf A}|)$, -independent of \verb'm' and \verb'n'. Algorithms that must visit all non-empty -columns of a matrix are much faster when working with hypersparse matrices, -since empty columns can be skipped. - -The \verb'hyper_switch' parameter controls the hypersparsity of the internal -data structure for a matrix. The parameter is typically in the range 0 to 1. -The default is \verb'hyper_switch' = \verb'GxB_HYPER_DEFAULT', which is an -\verb'extern' \verb'const' \verb'double' value, currently set to 0.0625, or -1/16. This default ratio may change in the future. - -The \verb'hyper_switch' determines how the matrix is converted between the -hypersparse and non-hypersparse formats. Let $n$ be the number of columns of a -CSC matrix, or the number of rows of a CSR matrix. The matrix can have at most -$n$ non-empty vectors. - -Let $k$ be the actual number of non-empty vectors. That is, for the CSC -format, $k \le n$ is the number of columns that have at least one entry. Let -$h$ be the value of \verb'hyper_switch'. - -If a matrix is currently hypersparse, it can be converted to non-hypersparse if -the either condition $n \le 1$ or $k > 2nh$ holds, or both. Otherwise, it -stays hypersparse. Note that if $n \le 1$ the matrix is always stored as -non-hypersparse. - -If currently non-hypersparse, it can be converted to hypersparse if -both conditions $n > 1$ and $k \le nh$ hold. Otherwise, it stays -non-hypersparse. Note that if $n \le 1$ the matrix always remains -non-hypersparse. - -The default value of \verb'hyper_switch' is assigned at startup by -\verb'GrB_init', and can then be modified globally with \verb'GxB_set'. All -new matrices are created with the same \verb'hyper_switch', determined by the -global value. Once a particular matrix \verb'A' has been constructed, its -hypersparsity ratio can be modified from the default with: - - {\footnotesize - \begin{verbatim} - double hyper_switch = 0.2 ; - GxB_set (A, GxB_HYPER_SWITCH, hyper_switch) ; \end{verbatim}} - -To force a matrix to always be non-hypersparse, use \verb'hyper_switch' equal to -\verb'GxB_NEVER_HYPER'. To force a matrix to always stay hypersparse, set -\verb'hyper_switch' to \verb'GxB_ALWAYS_HYPER'. - -A \verb'GrB_Matrix' can thus be held in one of four formats: any combination of -hyper/non-hyper and CSR/CSC. All \verb'GrB_Vector' objects are always stored -in non-hypersparse CSC format. - -A new matrix created via \verb'GrB_Matrix_new' starts with $k=0$ and is created -in hypersparse form by default unless $n \le 1$ or if $h<0$, where $h$ is the -global \verb'hyper_switch' value. The matrix is created in either -\verb'GxB_BY_ROW' or \verb'GxB_BY_COL' format, as determined by the last call -to \verb'GxB_set(GxB_FORMAT,...)' or \verb'GrB_init'. - -A new matrix \verb'C' created via \verb'GrB_dup (&C,A)' inherits the CSR/CSC -format, hypersparsity format, and \verb'hyper_switch' from \verb'A'. - -%------------------------------------------------------------------------------- -\subsection{Bitmap matrices} -\label{bitmap_switch} -%------------------------------------------------------------------------------- - -By default, SuiteSparse:GraphBLAS switches between all four formats -(hypersparse, sparse, bitmap, and full) automatically. Let $d = |{\bf A}|/mn$ -for an $m$-by-$n$ matrix $\bf A$ with $|{\bf A}|$ entries. If the matrix is -currently in sparse or hypersparse format, and is modified so that $d$ exceeds -a given threshold, it is converted into bitmap format. The default threshold -is controlled by the \verb'GxB_BITMAP_SWITCH' setting, which can be set -globally, or for a particular matrix or vector. - -The default value of the switch to bitmap format depends on $\min(m,n)$, for a -matrix of size $m$-by-$n$. For the global setting, the bitmap switch is a -\verb'double' array of size \verb'GxB_NBITMAP_SWITCH'. The defaults are given -below: - -\vspace{0.2in} -{\small -\begin{tabular}{lll} -parameter & default & matrix sizes \\ -\hline -\verb'bitmap_switch [0]' & 0.04 & $\min(m,n) = 1$ (and all vectors) \\ -\verb'bitmap_switch [1]' & 0.05 & $\min(m,n) = 2$ \\ -\verb'bitmap_switch [2]' & 0.06 & $\min(m,n) = 3$ to 4 \\ -\verb'bitmap_switch [3]' & 0.08 & $\min(m,n) = 5$ to 8 \\ -\verb'bitmap_switch [4]' & 0.10 & $\min(m,n) = 9$ to 16\\ -\verb'bitmap_switch [5]' & 0.20 & $\min(m,n) = 17$ to 32\\ -\verb'bitmap_switch [6]' & 0.30 & $\min(m,n) = 33$ to 64 \\ -\verb'bitmap_switch [7]' & 0.40 & $\min(m,n) > 64$ \\ -\end{tabular} -} -\vspace{0.2in} - -That is, by default a \verb'GrB_Vector' is held in bitmap format if its density -exceeds 4\%. To change the global settings, do the following: - -{\footnotesize -\begin{verbatim} - double bswitch [GxB_NBITMAP_SWITCH] = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8 } ; - GxB_set (GxB_BITMAP_SWITCH, bswitch) ; -\end{verbatim} -} - -If the matrix is currently in bitmap format, it is converted to full if all -entries are present, or to sparse/hypersparse if $d$ drops below $b/2$, if its -bitmap switch is $b$. A matrix or vector with $d$ between $b/2$ and $b$ -remains in its current format. - -%------------------------------------------------------------------------------- -\subsection{Parameter types} -%------------------------------------------------------------------------------- -The \verb'GxB_Option_Field' enumerated type gives the type of the \verb'field' -parameter for the second argument of \verb'GxB_set' and \verb'GxB_get', -for setting global options or matrix options. - -NOTE: The enum values have changed with v8.0.0, to be compatible with the -future updates from the v2.1 C API specification. - -{\footnotesize -\begin{verbatim} -\end{verbatim} } - -The \verb'GxB_FORMAT' field can be by row or by column, set to a value -with the type \verb'GxB_Format_Value': - -{\footnotesize -\begin{verbatim} -typedef enum -{ - GxB_BY_ROW = 0, // CSR: compressed sparse row format - GxB_BY_COL = 1 // CSC: compressed sparse column format -} -GxB_Format_Value ; -\end{verbatim} } - -The default format is given by the predefined value \verb'GxB_FORMAT_DEFAULT', -which is equal to \verb'GxB_BY_ROW'. -The default hypersparsity -ratio is 0.0625 (1/16), but this value may change in the future. - -Setting the \verb'GxB_HYPER_SWITCH' field to \verb'GxB_ALWAYS_HYPER' ensures a matrix -always stays hypersparse. If set to \verb'GxB_NEVER_HYPER', it always stays -non-hypersparse. At startup, \verb'GrB_init' defines the following initial -settings: - -{\footnotesize -\begin{verbatim} - GxB_set (GxB_HYPER_SWITCH, GxB_HYPER_DEFAULT) ; - GxB_set (GxB_FORMAT, GxB_BY_ROW) ; -\end{verbatim} } - -That is, by default, all new matrices are held by row in CSR format (except -for \verb'n-by-1' matrices; see \verb'GrB_Matrix_new'). -If a matrix has fewer than $n/16$ -columns, it can be converted to hypersparse format. If it has more than $n/8$ -columns, it can be converted to non-hypersparse format. These options can be -changed for all future matrices with \verb'GxB_set'. For example, to change -all future matrices to be in non-hypersparse CSC when created, use: - -{\footnotesize -\begin{verbatim} - GxB_set (GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; - GxB_set (GxB_FORMAT, GxB_BY_COL) ; -\end{verbatim} } - -Then if a particular matrix needs a different format, then (as an example): - -{\footnotesize -\begin{verbatim} - GxB_set (A, GxB_HYPER_SWITCH, 0.1) ; - GxB_set (A, GxB_FORMAT, GxB_BY_ROW) ; -\end{verbatim} } - -This changes the matrix \verb'A' so that it is stored by row, and it is -converted from non-hypersparse to hypersparse format if it has fewer than 10\% -non-empty columns. If it is hypersparse, it is a candidate for conversion to -non-hypersparse if has 20\% or more non-empty columns. If it has between 10\% -and 20\% non-empty columns, it remains in its current format. -MATLAB only supports a non-hypersparse CSC format. The format in -SuiteSparse:GraphBLAS that is equivalent to the MATLAB format is: - -{\footnotesize -\begin{verbatim} - GrB_init (...) ; - GxB_set (GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; - GxB_set (GxB_FORMAT, GxB_BY_COL) ; - // no subsequent use of GxB_HYPER_SWITCH or GxB_FORMAT -\end{verbatim} } - -The \verb'GxB_HYPER_SWITCH' and \verb'GxB_FORMAT' options should be considered as -suggestions from the user application as to how SuiteSparse:GraphBLAS can -obtain the best performance for a particular application. -SuiteSparse:GraphBLAS is free to ignore any of these suggestions, both now and -in the future, and the available options and formats may be augmented in the -future. Any prior options no longer needed in future versions of -SuiteSparse:GraphBLAS will be silently ignored, so the use these options is -safe for future updates. - -The sparsity status of a matrix can be queried with the following, which -returns a value of \verb'GxB_HYPERSPARSE' \verb'GxB_SPARSE' \verb'GxB_BITMAP' -or \verb'GxB_FULL'. - -{\footnotesize -\begin{verbatim} - int sparsity ; - GxB_get (A, GxB_SPARSITY_STATUS, &sparsity) ; \end{verbatim}} - -The sparsity format of a matrix can be controlled with \verb'GxB_set', which -can be any mix (a sum or bitwise or) of \verb'GxB_HYPERSPARSE' -\verb'GxB_SPARSE' \verb'GxB_BITMAP', and \verb'GxB_FULL'. By default, a matrix -or vector can be held in any format, with the default setting -\verb'GxB_AUTO_SPARSITY', which is equal to \verb'GxB_HYPERSPARSE' + -\verb'GxB_SPARSE' + \verb'GxB_BITMAP' + \verb'GxB_FULL'. To enable a matrix to -take on just \verb'GxB_SPARSE' or \verb'GxB_FULL' formats, but not -\verb'GxB_HYPERSPARSE' or \verb'GxB_BITMAP', for example, use the following: - -{\footnotesize -\begin{verbatim} - GxB_set (A, GxB_SPARSITY_CONTROL, GxB_SPARSE + GxB_FULL) ; \end{verbatim}} - -In this case, SuiteSparse:GraphBLAS will hold the matrix in sparse format -(\verb'CSC' or \verb'CSC', depending on its \verb'GxB_FORMAT'), unless all -entries are present, in which case it will be converted to full format. - -Only the least 4 bits of the sparsity control are considered, so the -formats can be bitwise negated. For example, to allow for any format -except full: - -{\footnotesize -\begin{verbatim} - GxB_set (A, GxB_SPARSITY_CONTROL, ~GxB_FULL) ; \end{verbatim}} - -%------------------------------------------------------------------------------- -\subsection{{\sf GxB\_BURBLE}, {\sf GxB\_PRINTF}, {\sf GxB\_FLUSH}: diagnostics} -%------------------------------------------------------------------------------- - -\verb'GxB_set (GxB_BURBLE, ...)' controls the burble setting. It can also be -controlled via \verb'GrB.burble(b)' in the MATLAB/Octave interface. - -{\footnotesize -\begin{verbatim} - GxB_set (GxB_BURBLE, true) ; // enable burble - GxB_set (GxB_BURBLE, false) ; // disable burble \end{verbatim}} - -If enabled, SuiteSparse:GraphBLAS reports which internal kernels it uses, and -how much time is spent. If you see the word \verb'generic', it means that -SuiteSparse:GraphBLAS was unable to use its JIT kernels, or its faster kernels -in \verb'Source/FactoryKernels', but used a generic kernel that relies on -function pointers. This is done for user-defined types and operators, and when -typecasting is performed, and it is typically slower than the JIT kernels -or kernels in \verb'Source/FactoryKernels'. - -If you see a lot of \verb'wait' statements, it may mean that a lot of time is -spent finishing a matrix or vector. This may be the result of an inefficient -use of the \verb'setElement' and \verb'assign' methods. If this occurs you -might try changing the sparsity format of a vector or matrix to -\verb'GxB_BITMAP', assuming there's enough space for it. - -\verb'GxB_set (GxB_PRINTF, printf)' allows the user application to change the -function used to print diagnostic output. This also controls the output of the -\verb'GxB_*print' functions. By default this parameter is \verb'NULL', in -which case the ANSI C11 \verb'printf' function is used. The parameter is a -function pointer with the same signature as the ANSI C11 \verb'printf' -function. The MATLAB/Octave interface to GraphBLAS sets it to \verb'mexPrintf' -so that GraphBLAS can print to the MATLAB/Octave Command Window. - -After each call to the \verb'printf' function, an optional -\verb'flush' function is called, which is \verb'NULL' by default. If -\verb'NULL', the function is not used. This can be changed with -\verb'GxB_set (GxB_FLUSH, flush)'. The \verb'flush' function takes no -arguments, and returns an \verb'int' which is 0 if successful, or any nonzero -value on failure (the same output as the ANSI C11 \verb'fflush' function, -except that \verb'flush' has no inputs). - -%------------------------------------------------------------------------------- -\subsection{Other global options} -%------------------------------------------------------------------------------- - -\verb'GxB_MODE' can only be -queried by \verb'GxB_get'; it cannot be modified by \verb'GxB_set'. The mode -is the value passed to \verb'GrB_init' (blocking or non-blocking). - -All threads in the same user application share the same global options, -including hypersparsity, bitmap options, and CSR/CSC format determined by -\verb'GxB_set', and the blocking mode determined by \verb'GrB_init'. -Specific format and hypersparsity parameters of each matrix are specific to -that matrix and can be independently changed. - -The \verb'GxB_LIBRARY_*' options can be used with \verb'GxB_get' to query the -current implementation. For all of these, \verb'GxB_get' returns a string -(\verb'char *'), except for \verb'GxB_LIBRARY_VERSION', which takes as input an -\verb'int' array of size three. The \verb'GxB_API_*' options can be used with -\verb'GxB_get' to query the current GraphBLAS C API Specification. For all of -these, \verb'GxB_get' returns a string (\verb'char *'), except for -\verb'GxB_API_VERSION', which takes as input an \verb'int' array of size three. - -%=============================================================================== -\subsection{{\sf GxB\_Global\_Option\_set:} set a global option} -%=============================================================================== - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_set // set a global default option -( - const GxB_Option_Field field, // option to change - ... // value to change it to -) ; -\end{verbatim} } \end{mdframed} - -This usage of \verb'GxB_set' sets the value of a global option. -The \verb'field' parameter can be -\verb'GxB_HYPER_SWITCH', -\verb'GxB_BITMAP_SWITCH', -\verb'GxB_FORMAT', -\verb'GxB_NTHREADS', -\verb'GxB_CHUNK', -\verb'GxB_BURBLE', -\verb'GxB_PRINTF', -\verb'GxB_FLUSH', -\verb'GxB_PRINT_1BASED', \newline -\verb'GxB_JIT_C_COMPILER_NAME', -\verb'GxB_JIT_C_COMPILER_FLAGS', -\verb'GxB_JIT_C_LINKER_FLAGS', -\verb'GxB_JIT_C_LIBRRIES', -\verb'GxB_JIT_C_PREFACE', -\verb'GxB_JIT_C_CONTROL', -\verb'GxB_JIT_USE_CMAKE', -\verb'GxB_JIT_ERROR_LOG', or -\verb'GxB_JIT_CACHE_PATH'. - -For example, the following usage sets the global hypersparsity ratio to 0.2, -the format of future matrices to \verb'GxB_BY_COL', the maximum number -of threads to 4, the chunk size to 10000, and enables the burble. -No existing matrices are changed. - -{\footnotesize -\begin{verbatim} - GxB_set (GxB_HYPER_SWITCH, 0.2) ; - GxB_set (GxB_FORMAT, GxB_BY_COL) ; - GxB_set (GxB_NTHREADS, 4) ; - GxB_set (GxB_CHUNK, (double) 10000) ; - GxB_set (GxB_BURBLE, true) ; - GxB_set (GxB_PRINTF, mexPrintf) ; -\end{verbatim} } - -\newpage -%=============================================================================== -\subsection{{\sf GxB\_Matrix\_Option\_set:} set a matrix option} -%=============================================================================== - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_set // set an option in a matrix -( - GrB_Matrix A, // matrix to modify - const GxB_Option_Field field, // option to change - ... // value to change it to -) ; -\end{verbatim} } \end{mdframed} - -This usage of \verb'GxB_set' sets the value of a matrix option, for a -particular matrix. -The \verb'field' parameter can be -\verb'GxB_HYPER_SWITCH', -\verb'GxB_BITMAP_SWITCH', -\verb'GxB_SPARSITY_CONTROL', or -\verb'GxB_FORMAT'. -This example usage sets the hypersparsity ratio to 0.2, and the -format of \verb'GxB_BY_COL', for a particular matrix \verb'A', and sets the -sparsity control to \verb'GxB_SPARSE+GxB_FULL' (allowing the matrix to be held -in CSC or FullC formats, but not BitmapC or HyperCSC): - -{\footnotesize -\begin{verbatim} - GxB_set (A, GxB_HYPER_SWITCH, 0.2) ; - GxB_set (A, GxB_FORMAT, GxB_BY_COL) ; - GxB_set (A, GxB_SPARSITY_CONTROL, GxB_SPARSE + GxB_FULL) ; -\end{verbatim} } - -SuiteSparse:GraphBLAS currently applies these changes immediately, but since -they are simply hints, future versions of SuiteSparse:GraphBLAS may delay the -change in format if it can obtain better performance. If the setting is just -\verb'GxB_FULL' and some entries are missing, then the matrix is held in bitmap -format. For best performance, the matrix option should be set as soon as it is -created with \verb'GrB_Matrix_new', so the internal transformation takes less -time. If an error occurs, \verb'GrB_error(&err,A)' returns details about the -error. - -%=============================================================================== -\subsection{{\sf GxB\_Desc\_set:} set a {\sf GrB\_Descriptor} value} -%=============================================================================== -\label{gxbset} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - const GrB_Desc_Field field, // parameter to change - ... // value to change it to -) ; -\end{verbatim} } \end{mdframed} - -This usage is similar to \verb'GrB_Descriptor_set', just with a name that is -consistent with the other usages of this generic function. Unlike -\verb'GrB_Descriptor_set', the \verb'field' may also be -\verb'GxB_SORT', \verb'GxB_COMPRESSION', or -\verb'GxB_IMPORT'. Refer to Sections~\ref{descriptor_set}~and~\ref{desc_set} -for details. If an error occurs, \verb'GrB_error(&err,desc)' returns details -about the error. - -\newpage -%=============================================================================== -\subsection{{\sf GxB\_Global\_Option\_get:} retrieve a global option} -%=============================================================================== -\label{gxbget} - -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_get // gets the current global default option -( - const GxB_Option_Field field, // option to query - ... // return value of the global option -) ; -\end{verbatim} } \end{mdframed} - -This usage of \verb'GxB_get' retrieves the value of a global option. The -\verb'field' parameter can be one of the following: +With the introduction of the JIT kernels, it is now possible to obtain good +performance in GraphBLAS without compiling the many {\em factory kernels} that +appear in the \verb'GraphBLAS/Source/FactoryKernels' directory. If the JIT is +enabled, GraphBLAS will still be fast, once the JIT kernels are compiled, or by +using any \verb'PreJIT' kernels. To compile GraphBLAS without its +\verb'FactoryKernels', enable the \verb'COMPACT' option in the cmake build +options. By default, \verb'COMPACT' is off, to enable the +\verb'FactoryKernels'. -\vspace{0.2in} -{\footnotesize -\begin{tabular}{ll} - \hline - \verb'GxB_HYPER_SWITCH' & sparse/hyper setting \\ - \verb'GxB_BITMAP_SWITCH' & bitmap/sparse setting \\ - \verb'GxB_FORMAT' & by row/col setting \\ - \verb'GxB_MODE' & blocking / non-blocking \\ - \verb'GxB_NTHREADS' & default number of threads \\ - \verb'GxB_CHUNK' & default chunk size \\ - \verb'GxB_BURBLE' & burble setting \\ - \verb'GxB_PRINTF' & printf function \\ - \verb'GxB_FLUSH' & flush function \\ - \verb'GxB_PRINT_1BASED' & for printing matrices/vectors \\ - \hline - \verb'GxB_JIT_C_COMPILER_NAME' & C compiler for JIT kernels \\ - \verb'GxB_JIT_C_COMPILER_FLAGS' & flags for the C compiler \\ - \verb'GxB_JIT_C_LINKER_FLAGS' & link flags for the C compiler \\ - \verb'GxB_JIT_C_LIBRARIES' & libraries to link against \\ - \verb'GxB_JIT_C_CMAKE_LIBS' & libraries to link against \\ - \verb'GxB_JIT_C_PREFACE' & preface for JIT kernels \\ - \verb'GxB_JIT_C_CONTROL' & CPU JIT control \\ - \verb'GxB_JIT_USE_CMAKE' & CPU JIT: use cmake or not \\ - \verb'GxB_JIT_ERROR_LOG' & error log file \\ - \verb'GxB_JIT_CACHE_PATH' & folder with compiled kernels \\ - \hline - \verb'GxB_LIBRARY_NAME' & the string - \verb'"SuiteSparse:GraphBLAS"' \\ - \verb'GxB_LIBRARY_VERSION' & \verb'int' array of size 3 \\ - \verb'GxB_LIBRARY_DATE' & date of release \\ - \verb'GxB_LIBRARY_ABOUT' & author, copyright \\ - \verb'GxB_LIBRARY_LICENSE' & license for the library \\ - \verb'GxB_LIBRARY_COMPILE_DATE' & date of compilation \\ - \verb'GxB_LIBRARY_COMPILE_TIME' & time of compilation \\ - \verb'GxB_LIBRARY_OPENMP' & library compiled with OpenMP\\ - \verb'GxB_LIBRARY_URL' & URL of the library \\ - \hline - \verb'GxB_API_VERSION' & GraphBLAS C API Specification Version \\ - \verb'GxB_API_DATE' & date of the C API Spec. \\ - \verb'GxB_API_ABOUT' & about of the C API Spec. \\ - \verb'GxB_API_URL' & URL of the specification \\ - \hline -\end{tabular} -} -\vspace{0.2in} +When GraphBLAS is compiled with \verb'GRAPHBLAS_USE_JIT' set to \verb'OFF', the +\verb'GxB_JIT_C_CONTROL' may be set to \verb'GxB_JIT_OFF', +\verb'GxB_JIT_PAUSE', or \verb'GxB_JIT_RUN'. No kernels will be loaded at +run-time (the \verb'GxB_JIT_LOAD' setting is disabled and treated as +\verb'GxB_JIT_RUN'), and no new kernels will be compiled at run-time (the +\verb'GxB_JIT_ON' is disabled and treated as \verb'GxB_JIT_RUN'). Only +pre-existing \verb'PreJIT' kernels can be run, described in +Section~\ref{prejit}. -{\bf NOTE:} The strings returned by \verb'GxB_get' are \verb'const char *'. -They are ``owned'' by the GraphBLAS library itself, not by the user -application. They cannot be freed or modified in any way. A subsequent call -to \verb'GxB_set' can free them and reallocate them, so they are only valid -until that point. If you want to keep a string returned by \verb'GxB_get', -make a copy immediately after calling \verb'GxB_get', into a character array -owned by the user application. The \verb'GxB_JIT_*' strings are the only ones -this affects. +If both \verb'GRAPHBLAS_USE_JIT' is set \verb'OFF' and +\verb'GRAPHBLAS_COMPACT' is set \verb'ON', all features of GraphBLAS will be +functional. The only fast kernels available will be the \verb'PreJIT' kernels +(if any). Otherwise, generic kernels will be used, in which every single +operator is implemented with a function pointer, and every scalar assignment +requires a \verb'memcpy'. Generic kernels are slow, so using this combination +of options is not recommended when preparing GraphBLAS for production use, +benchmarking, or for a Linux distro or other widely-used distribution, unless +you are able to run your application in advance and create all the JIT kernels +you need, and then copy them into \verb'GraphBLAS/PreJIT'. This would be +impossible to do for a general-purpose case such as a Linux distro, but +feasible for a more targetted application such as FalkorDB. -Below is an example: +%------------------------------------------------------------------------------- +\subsection{Adding {\sf PreJIT} kernels to GraphBLAS} +%------------------------------------------------------------------------------- +\label{prejit} -{\footnotesize -\begin{verbatim} - double h ; - GxB_get (GxB_HYPER_SWITCH, &h) ; - printf ("hyper_switch = %g for all new matrices\n", h) ; +When GraphBLAS runs, it constructs JIT kernels in the user's cache folder, +which by default is \verb'~/.SuiteSparse/GrB8.0.0' for v8.0.0. The +kernels placed in a subfolder (\verb'c') and inside that folder they are +further subdivided arbitrarily into subfolders (via an arbitary hash). The +files are split into subfolders because a single folder may grow too large for +efficient access. Once GraphBLAS has generated some kernels, some or all of +them kernels can then incorporated into the compiled GraphBLAS library by +copying them into the \verb'GraphBLAS/PreJIT' folder. Be sure to move any +\verb'*.c' files into the single \verb'GraphBLAS/PreJIT' folder; do not keep +the subfolder structure. - double b [GxB_BITMAP_SWITCH] ; - GxB_get (GxB_BITMAP_SWITCH, b) ; - for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) - { - printf ("bitmap_switch [%d] = %g ", k, b [k]) ; - if (k == 0) - { - printf ("for vectors and matrices with 1 row or column\n") ; - } - else if (k == GxB_NBITMAP_SWITCH - 1) - { - printf ("for matrices with min dimension > %d\n", 1 << (k-1)) ; - } - else - { - printf ("for matrices with min dimension %d to %d\n", - (1 << (k-1)) + 1, 1 << k) ; - } - } +If GraphBLAS is then recompiled via cmake, the build system will detect these +kernels, compile them, and make them available as pre-compiled JIT kernels. +The kernels are no longer ``Just-In-Time'' kernels since they are not compiled +at run-time. They are refered to as \verb'PreJIT' kernels since they were at +one time created at run-time by the GraphBLAS JIT, but are now compiled into +GraphBLAS before it runs. - GxB_Format_Value s ; - GxB_get (GxB_FORMAT, &s) ; - if (s == GxB_BY_COL) printf ("all new matrices are stored by column\n") ; - else printf ("all new matrices are stored by row\n") ; +{\bf It's that simple.} Just copy the source files for any kernels you want +from your cache folder (typically \verb'~/.SuiteSparse/GrB8.0.0/c') into +\verb'GraphBLAS/PreJIT', and recompile GraphBLAS. There's no need to change +any other cmake setting, and no need to do anything different in any +applications that use GraphBLAS. Do not copy the compiled libraries; they are +not needed and will be ignored. Just copy the \verb'*.c' files. - GrB_mode mode ; - GxB_get (GxB_MODE, &mode) ; - if (mode == GrB_BLOCKING) printf ("GrB_init(GrB_BLOCKING) was called.\n") ; - else printf ("GrB_init(GrB_NONBLOCKING) was called.\n") ; +If the resulting GraphBLAS library is installed for system-wide usage (say in a +Linux distro, Python, RedisGraph, etc), the \verb'GraphBLAS/PreJIT' kernels +will be available to all users of that library. They are not disabled by the +\verb'GRAPHBLAS_USE_JIT' option. - int nthreads_max ; - GxB_get (GxB_NTHREADS, &nthreads_max) ; - printf ("max # of threads to use: %d\n", nthreads_max) ; +Once these kernels are moved to \verb'GraphBLAS/PreJIT' and GraphBLAS is +recompiled, they can be deleted from the cache folder. However, even if they +are left there, they will not be used since GraphBLAS will find these kernels +as PreJIT kernels inside the compiled library itself (\verb'libgraphblas.so' on +Linux, \verb'libgraphblas.dylib' on the Mac). GraphBLAS will not be any slower +if these kernels are left in the cache folder, and the compiled library size +will not be affected. - double chunk ; - GxB_get (GxB_CHUNK, &chunk) ; - printf ("chunk size: %g\n", chunk) ; +If the GraphBLAS version is changed at all (even in the last digit), all +\verb'GB_jit_*.c' files in the \verb'GraphBLAS/PreJIT' folder should be +deleted. The version mismatch will be detected during the call to +\verb'GrB_init', and any stale kernels will be safely ignored. Likewise, if a +user-defined type or operator is changed, the relevant kernels should also be +deleted from \verb'GraphBLAS/PreJIT'. For example, the +\verb'GraphBLAS/Demo/Program/gauss_demo.c' program creates a user-defined +\verb'gauss' type, and two operators, \verb'addgauss' and \verb'multgauss'. It +then intentionally changes one of the operators just to test this feature. If +the type and/or operators are changed, then the \verb'*gauss*.c' files in the +\verb'GraphBLAS/PreJIT' folder should be deleted. - char *name ; - int ver [3] ; - GxB_get (GxB_LIBRARY_NAME, &name) ; - GxB_get (GxB_LIBRARY_VERSION, ver) ; - printf ("Library %s, version %d.%d.%d\n", name, ver [0], ver [1], ver [2]) ; \end{verbatim} } +GraphBLAS will safely detect any stale \verb'PreJIT' kernels by checking them +the first time they are run after calling \verb'GrB_init' and will not use them +if they are found to be stale. If the JIT control is set to \verb'GxB_JIT_OFF' +all PreJIT kernels are flagged as unchecked. If the JIT is then renabled by +setting the control to \verb'GxB_JIT_RUN' or \verb'GxB_JIT_ON', all PreJIT +kernels will be checked again and any stale kernels will be detected. -%=============================================================================== -\subsection{{\sf GxB\_Matrix\_Option\_get:} retrieve a matrix option} -%=============================================================================== +If a stale PreJIT kernel is found, GraphBLAS will use its run-time JIT to +compile new ones with the current definitions, or it will punt to a generic +kernel if JIT compilation is disabled. GraphBLAS will be functional, and fast +if it can rely on a JIT kernel, but the unusable stale PreJIT kernels take up +space inside the compiled GraphBLAS library. The best practice is to delete +any stale kernels from the \verb'GraphBLAS/PreJIT' folder, or replace them with +newly compiled JIT kernels from the cache folder, and recompile GraphBLAS. -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_get // gets the current option of a matrix -( - GrB_Matrix A, // matrix to query - GxB_Option_Field field, // option to query - ... // return value of the matrix option -) ; -\end{verbatim} } \end{mdframed} +It is safe to copy only a subset of the JIT kernels from the cache folder into +\verb'GraphBLAS/PreJIT'. You may also delete any files in +\verb'GraphBLAS/PreJIT' and recompile GraphBLAS without those kernels. If +GraphBLAS encounters a need for a particular kernel that has been removed from +\verb'GraphBLAS/PreJIT', it will create it at run-time via the JIT, if +permitted. If not permitted, by either compiling GraphBLAS with the +\verb'GRAPHBLAS_USE_JIT' option set ot \verb'OFF', or by using +\verb'GxB_JIT_C_CONTROL' at run-time, the factory kernel or generic kernel will +be used instead. The generic kernel will be slower than the PreJIT or JIT +kernel, but GraphBLAS will still be functional. -This usage of \verb'GxB_get' retrieves the value of a matrix option. The -\verb'field' parameter can be -\verb'GxB_HYPER_SWITCH', -\verb'GxB_BITMAP_SWITCH', -\verb'GxB_SPARSITY_CONTROL', -\verb'GxB_SPARSITY_STATUS', -or -\verb'GxB_FORMAT'. -For example: +In addition to a single \verb'README.txt' file, the \verb'GraphBLAS/PreJIT' +folder includes a \verb'.gitignore' file that prevents any files in the folder +from being synced via \verb'git'. If you wish to add your PreJIT kernels to a +fork of GraphBLAS, you will need to revise this \verb'.gitignore' file. -\vspace{-0.1in} -{\footnotesize -\begin{verbatim} - double h, b ; - int sparsity, scontrol ; - GxB_get (A, GxB_SPARSITY_STATUS, &sparsity) ; - GxB_get (A, GxB_HYPER_SWITCH, &h) ; - printf ("matrix A has hyper_switch = %g\n", h) ; - GxB_get (A, GxB_BITMAP_SWITCH, &b) ; - printf ("matrix A has bitmap_switch = %g\n", b) ; - switch (sparsity) - { - case GxB_HYPERSPARSE: printf ("matrix A is hypersparse\n") ; break ; - case GxB_SPARSE: printf ("matrix A is sparse\n" ) ; break ; - case GxB_BITMAP: printf ("matrix A is bitmap\n" ) ; break ; - case GxB_FULL: printf ("matrix A is full\n" ) ; break ; - } - GxB_Format_Value s ; - GxB_get (A, GxB_FORMAT, &s) ; - printf ("matrix A is stored by %s\n", (s == GxB_BY_COL) ? "col" : "row") ; - GxB_get (A, GxB_SPARSITY_CONTROL, &scontrol) ; - if (scontrol & GxB_HYPERSPARSE) printf ("A may become hypersparse\n") ; - if (scontrol & GxB_SPARSE ) printf ("A may become sparse\n") ; - if (scontrol & GxB_BITMAP ) printf ("A may become bitmap\n") ; - if (scontrol & GxB_FULL ) printf ("A may become full\n") ; \end{verbatim} } +%------------------------------------------------------------------------------- +\subsection{{\sf JIT} and {\sf PreJIT} performance considerations} +%------------------------------------------------------------------------------- +\label{jit_performance} -%=============================================================================== -\subsection{{\sf GxB\_Desc\_get:} retrieve a {\sf GrB\_Descriptor} value} -%=============================================================================== +To create a good set of PreJIT kernels for a particular user application, it is +necessary to run the application with many different kinds of workloads. Each +JIT or PreJIT kernel is specialized to the particular matrix format, data type, +operators, and descriptors of its inputs. GraphBLAS can change a matrix format +(from sparse to hypersparse, for example), at its discretion, thus triggering +the use of a different kernel. Some GraphBLAS methods use heuristics to select +between different methods based upon the sparsity structure or estimates of the +kind or amount of work required. In these cases, entirely different kernels +will be compiled. As a result, it's very difficult to predict which kernels +GraphBLAS will find the need to compile, and thus a wide set of test cases +should be used in an application to allow GraphBLAS to generate as many kernels +as could be expected to appear in production use. -\begin{mdframed}[userdefinedwidth=6in] -{\footnotesize -\begin{verbatim} -GrB_Info GxB_get // get a parameter from a descriptor -( - GrB_Descriptor desc, // descriptor to query; NULL means defaults - GrB_Desc_Field field, // parameter to query - ... // value of the parameter -) ; -\end{verbatim} } \end{mdframed} +GraphBLAS can encounter very small matrices, and it will often select its +bitmap format to store them. This change of format will trigger a different +kernel than the sparse or hypersparse cases. There are many other cases like +that where specific kernels are only needed for small problems. In this case, +compiling an entirely new kernel is costly, since using a compiled kernel will +be no faster than the generic kernel. When benchmarking an application to +allow GraphBLAS to compile its JIT kernels, it may be useful to pause the JIT +via \verb'GxB_JIT_PAUSE', \verb'GxB_JIT_RUN', or \verb'GxB_JIT_LOAD', when the +application knows it is calling GraphBLAS for tiny problems. These three +settings keep any loaded JIT kernels in memory, but pauses the compilation of +any new JIT kernels. Then the control can be reset to \verb'GxB_JIT_ON' once +the application finishes with its tiny problems and moves to larger ones where +the JIT will improve performance. A future version of GraphBLAS may allow +this heuristic to be implemented inside GraphBLAS itself, but for now, the +JIT does not second guess the user application; if it wants a new kernel, +the JIT will compile it if the control is set to \verb'GxB_JIT_ON'. -This usage is the same as \verb'GxB_Desc_get'. The \verb'field' parameter can -be \verb'GrB_OUTP', \verb'GrB_MASK', \verb'GrB_INP0', \verb'GrB_INP1', -\verb'GxB_AxB_METHOD', -\verb'GxB_SORT', -\verb'GxB_COMPRESSION', or -\verb'GxB_IMPORT'. -Refer to Section~\ref{desc_get} for details. +%------------------------------------------------------------------------------- +\subsection{Mixing JIT kernels: MATLAB and Apple Silicon} +%------------------------------------------------------------------------------- -%=============================================================================== -\subsection{Summary of usage of {\sf GxB\_set} and {\sf GxB\_get}} -%=============================================================================== +In general, the JIT kernels compiled by the C interface and the kernels +compiled while using GraphBLAS in MATLAB are interchangable, and the same cache +folder can be used for both. This is the default. -The different usages of \verb'GxB_set' and \verb'GxB_get' are summarized below. +However, when using the \verb'@GrB' MATLAB interface to GraphBLAS on Apple +Silicon, the MATLAB JIT kernels are compiled as x86 binaries and executed +inside MATLAB via Rosetta. The pure C installation may compile native Arm64 +binaries for its JIT kernels. Do not mix the two. In this case, set another +cache path for MATLAB using \verb'GrB.jit' in MATLAB, or using \verb'GrB_set' +in the C interface for your native Arm64 binaries. -\noindent -To set/get the global options: +%------------------------------------------------------------------------------- +\subsection{Updating the JIT when GraphBLAS source code changes} +%------------------------------------------------------------------------------- - {\footnotesize - \begin{verbatim} - GxB_set (GxB_HYPER_SWITCH, double h) ; - GxB_set (GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ; - GxB_set (GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; - GxB_get (GxB_HYPER_SWITCH, double *h) ; - double b [GxB_NBITMAP_SWITCH] ; - GxB_set (GxB_BITMAP_SWITCH, b) ; - GxB_set (GxB_BITMAP_SWITCH, NULL) ; // set defaults - GxB_get (GxB_BITMAP_SWITCH, b) ; - GxB_set (GxB_FORMAT, GxB_BY_ROW) ; - GxB_set (GxB_FORMAT, GxB_BY_COL) ; - GxB_get (GxB_FORMAT, GxB_Format_Value *s) ; - GxB_set (GxB_NTHREADS, int nthreads_max) ; - GxB_get (GxB_NTHREADS, int *nthreads_max) ; - GxB_set (GxB_CHUNK, double chunk) ; - GxB_get (GxB_CHUNK, double *chunk) ; - GxB_set (GxB_BURBLE, bool burble) ; - GxB_get (GxB_BURBLE, bool *burble) ; - GxB_set (GxB_PRINTF, void *printf_function) ; - GxB_get (GxB_PRINTF, void **printf_function) ; - GxB_set (GxB_FLUSH, void *flush_function) ; - GxB_get (GxB_FLUSH, void **flush_function) ; - GxB_set (GxB_PRINT_1BASED, bool onebased) ; - GxB_get (GxB_PRINT_1BASED, bool *onebased) ; - - GxB_set (GxB_JIT_C_COMPILER_NAME, char *compiler) ; - GxB_get (GxB_JIT_C_COMPILER_NAME, char **compiler) ; - GxB_set (GxB_JIT_C_COMPILER_FLAGS, char *flags) ; - GxB_get (GxB_JIT_C_COMPILER_FLAGS, char **flags) ; - GxB_set (GxB_JIT_C_LINKER_FLAGS, char *flags) ; - GxB_get (GxB_JIT_C_LINKER_FLAGS, char **flags) ; - GxB_set (GxB_JIT_C_LIBRARIES, char *libraries) ; - GxB_get (GxB_JIT_C_LIBRARIES, char **libraries) ; - GxB_set (GxB_JIT_C_CMAKE_LIBS, char *libraries) ; - GxB_get (GxB_JIT_C_CMAKE_LIBS, char **libraries) ; - GxB_set (GxB_JIT_C_PREFACE, char *preface) ; - GxB_get (GxB_JIT_C_PREFACE, char **preface) ; - GxB_set (GxB_JIT_ERROR_LOG, char *error_log) ; - GxB_get (GxB_JIT_ERROR_LOG, char **error_log) ; - GxB_set (GxB_JIT_CACHE_PATH, char *cache) ; - GxB_get (GxB_JIT_CACHE_PATH, char **cache) ; - GxB_set (GxB_JIT_USE_CMAKE, int use_cmake) ; - GxB_get (GxB_JIT_USE_CMAKE, int *use_cmake) ; - GxB_set (GxB_JIT_C_CONTROL, int control) ; - GxB_get (GxB_JIT_C_CONTROL, int *control) ; - \end{verbatim} } +If you edit the GraphBLAS source code itself or add any files to +\verb'GraphBLAS/PreJIT', read the instructions in +\verb'GraphBLAS/JITpackage/README.txt' for details on how to update the JIT +source code. -\noindent -To get global options that can be queried but not modified: +If your cache folder (\verb'~/.SuiteSparse/GrBx.y.z') changes in any way +except via GraphBLAS itself, simply delete your cache folder. GraphBLAS will +then reconstruct the kernels there as needed. - {\footnotesize - \begin{verbatim} - GxB_get (GxB_MODE, GrB_Mode *mode) ; - GxB_get (GxB_LIBRARY_NAME, char **) ; - GxB_get (GxB_LIBRARY_VERSION, int *) ; - GxB_get (GxB_LIBRARY_DATE, char **) ; - GxB_get (GxB_LIBRARY_ABOUT, char **) ; - GxB_get (GxB_LIBRARY_LICENSE, char **) ; - GxB_get (GxB_LIBRARY_COMPILE_DATE, char **) ; - GxB_get (GxB_LIBRARY_COMPILE_TIME, char **) ; - GxB_get (GxB_LIBRARY_OPENMP, bool *) ; - GxB_get (GxB_LIBRARY_URL, char **) ; - GxB_get (GxB_API_VERSION, int *) ; - GxB_get (GxB_API_DATE, char **) ; - GxB_get (GxB_API_ABOUT, char **) ; - GxB_get (GxB_API_URL, char **) ; \end{verbatim} } +%------------------------------------------------------------------------------- +\subsection{Future plans for the {\sf JIT} and {\sf PreJIT}} +%------------------------------------------------------------------------------- +\label{jit_future} -\noindent -To set/get a matrix option or status +\subsubsection{More JIT kernels} +I have 44 JIT kernels but could write about another 43 for \verb'GrB_assign', +\verb'GrB_extract', \verb'GrB_kronecker', and other kernels. Grep the source +code for \verb'JIT: needed' for a list. The current JIT kernels cover all the +\verb'generic' kernels in SuiteSparse GraphBLAS v7.x and earlier for which {\em +factory} kernels are available. However, in those versions, some kernels are +only generic. This version does not accelerate those, but they will be +accelerated by the JIT in a future version. - {\footnotesize - \begin{verbatim} - GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, double h) ; - GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ; - GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; - GxB_get (GrB_Matrix A, GxB_HYPER_SWITCH, double *h) ; - GxB_set (GrB_Matrix A, GxB_BITMAP_SWITCH, double b) ; - GxB_get (GrB_Matrix A, GxB_BITMAP_SWITCH, double *b) ; - GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_ROW) ; - GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_COL) ; - GxB_get (GrB_Matrix A, GxB_FORMAT, GxB_Format_Value *s) ; - GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ; - GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, scontrol) ; - GxB_get (GrB_Matrix A, GxB_SPARSITY_CONTROL, int *scontrol) ; - GxB_get (GrB_Matrix A, GxB_SPARSITY_STATUS, int *sparsity) ; \end{verbatim} } +\subsubsection{Kernel fusion} +The introduction of the JIT and its related PreJIT kernels allow for the future +exploitation of kernel fusion via an aggressive exploitation of the GraphBLAS +non-blocking mode. In that mode, multiple calls to GraphBLAS can be fused into +a single kernel. There are far to many possible variants to allow a fused +kernel to appear in the \verb'GraphBLAS/Source/FactoryKernels' folder, but +specific fused kernels could be created by the JIT. -\noindent -To set/get a vector option or status: +\subsubsection{Heuristics for controlling the JIT} +As mentioned in Section~\ref{jit_performance}, GraphBLAS may compile JIT +kernels that are used for only tiny problems where the compile time of a single +kernel will dominate any performance gains from using the compiled kernel. A +heuristic could be introduced so that it compiles them only for larger +problems. - {\footnotesize - \begin{verbatim} - GxB_set (GrB_Vector v, GxB_BITMAP_SWITCH, double b) ; - GxB_get (GrB_Vector v, GxB_BITMAP_SWITCH, double *b) ; - GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_ROW) ; - GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_COL) ; - GxB_get (GrB_Vector v, GxB_FORMAT, GxB_Format_Value *s) ; - GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ; - GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, scontrol) ; - GxB_get (GrB_Vector v, GxB_SPARSITY_CONTROL, int *scontrol) ; - GxB_get (GrB_Vector v, GxB_SPARSITY_STATUS, int *sparsity) ; \end{verbatim} } +\subsubsection{CUDA / SYCL / OpenCL kernels} +The CUDA JIT will enable NVIDIA GPUs to be exploited. There are simply too +many kernels to create at compile time as the ``factory kernels.'' This CUDA +JIT is in progress. A related JIT for SYCL / OpenCL kernels is under +consideration. -\noindent -To set/get a descriptor field: +\subsubsection{Better performance for multithreaded user programs:} +This version is thread-safe when used in a multithread user application, but a +better JIT critical section (many readers, one writer) might be needed. The +current critical section may be sufficiently fast since the typical case of +work done inside the critical section is a single hash table lookup. However, +the performance issues related to this have not been tested. This has no +effect if all parallelism is exploited only within GraphBLAS. It only +affects the case when multiple user threads each call GraphBLAS in parallel +(using the \verb'GxB_Context'; see Section~\ref{context}). - {\footnotesize - \begin{verbatim} - GxB_set (GrB_Descriptor d, GrB_OUTP, GxB_DEFAULT) ; - GxB_set (GrB_Descriptor d, GrB_OUTP, GrB_REPLACE) ; - GxB_get (GrB_Descriptor d, GrB_OUTP, GrB_Desc_Value *v) ; - GxB_set (GrB_Descriptor d, GrB_MASK, GxB_DEFAULT) ; - GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP) ; - GxB_set (GrB_Descriptor d, GrB_MASK, GrB_STRUCTURE) ; - GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP+GrB_STRUCTURE) ; - GxB_get (GrB_Descriptor d, GrB_MASK, GrB_Desc_Value *v) ; - GxB_set (GrB_Descriptor d, GrB_INP0, GxB_DEFAULT) ; - GxB_set (GrB_Descriptor d, GrB_INP0, GrB_TRAN) ; - GxB_get (GrB_Descriptor d, GrB_INP0, GrB_Desc_Value *v) ; - GxB_set (GrB_Descriptor d, GrB_INP1, GxB_DEFAULT) ; - GxB_set (GrB_Descriptor d, GrB_INP1, GrB_TRAN) ; - GxB_get (GrB_Descriptor d, GrB_INP1, GrB_Desc_Value *v) ; - GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_DEFAULT) ; - GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_GUSTAVSON) ; - GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_HASH) ; - GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_SAXPY) ; - GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_DOT) ; - GxB_get (GrB_Descriptor d, GrB_AxB_METHOD, GrB_Desc_Value *v) ; - GxB_set (GrB_Descriptor d, GxB_SORT, sort) ; - GxB_get (GrB_Descriptor d, GxB_SORT, int *sort) ; - GxB_set (GrB_Descriptor d, GxB_COMPRESSION, GxB_FAST_IMPORT) ; - GxB_set (GrB_Descriptor d, GxB_COMPRESSION, GxB_SECURE_IMPORT) ; - GxB_get (GrB_Descriptor d, GxB_COMPRESSION, GrB_Desc_Value *method) ; - GxB_set (GrB_Descriptor d, GxB_IMPORT, int method) ; - GxB_get (GrB_Descriptor d, GxB_IMPORT, int *method) ; \end{verbatim} } +\newpage +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\input{GrB_get_set.tex} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -10708,7 +9001,7 @@ \subsection{{\sf GrB\_mxm:} matrix-matrix multiply} %=========================== function \verb'GB_spec_accum_mask.m', discussed in Section~\ref{accummask}. \paragraph{\bf Performance considerations:} -Suppose all matrices are in \verb'GxB_BY_COL' format, and \verb'B' is extremely +Suppose all matrices are in \verb'GrB_COLMAJOR' format, and \verb'B' is extremely sparse but \verb'A' is not as sparse. Then computing \verb'C=A*B' is very fast, and much faster than when \verb'A' is extremely sparse. For example, if \verb'A' is square and \verb'B' is a column vector that is all nonzero except @@ -10768,11 +9061,11 @@ \subsection{{\sf GrB\_vxm:} vector-matrix multiply} %=========================== terms are column vectors instead of matrices. \paragraph{\bf Performance considerations:} % u'=u'*A -If the \verb'GxB_FORMAT' of \verb'A' is \verb'GxB_BY_ROW', and the default +If the \verb'GrB_STORAGE_ORIENTATION_HINT' of \verb'A' is \verb'GrB_ROWMAJOR', and the default descriptor is used (\verb'A' is not transposed), then \verb'GrB_vxm' is faster than than \verb'GrB_mxv' with its default descriptor, when the vector \verb'u' is very sparse. -However, if the \verb'GxB_FORMAT' of \verb'A' is \verb'GxB_BY_COL', then +However, if the \verb'GrB_STORAGE_ORIENTATION_HINT' of \verb'A' is \verb'GrB_COLMAJOR', then \verb'GrB_mxv' with its default descriptor is faster than \verb'GrB_vxm' with its default descriptor, when the vector \verb'u' is very sparse. Using the non-default \verb'GrB_TRAN' descriptor for \verb'A' makes the @@ -10821,11 +9114,11 @@ \subsection{{\sf GrB\_mxv:} matrix-vector multiply} %=========================== \paragraph{\bf Performance considerations:} % u=A*u Refer to the discussion of \verb'GrB_vxm'. In SuiteSparse:GraphBLAS, \verb'GrB_mxv' is very efficient when \verb'u' is sparse or dense, when the -default descriptor is used, and when the matrix is \verb'GxB_BY_COL'. When +default descriptor is used, and when the matrix is \verb'GrB_COLMAJOR'. When \verb'u' is very sparse and \verb'GrB_INP0' is set to its non-default \verb'GrB_TRAN', then this method is not efficient if the matrix is in -\verb'GxB_BY_COL' format. If an application needs to perform \verb"A'*u" -repeatedly where \verb'u' is very sparse, then use the \verb'GxB_BY_ROW' format +\verb'GrB_COLMAJOR' format. If an application needs to perform \verb"A'*u" +repeatedly where \verb'u' is very sparse, then use the \verb'GrB_ROWMAJOR' format for \verb'A' instead. \newpage @@ -11354,9 +9647,9 @@ \subsubsection{{\sf GrB\_Matrix\_extract:} extract submatrix from matrix} \paragraph{\bf Performance considerations:} % C=A(I,J) If \verb'A' is not transposed via input descriptor: if \verb'|I|' is small, -then it is fastest if \verb'A' is \verb'GxB_BY_ROW'; if +then it is fastest if \verb'A' is \verb'GrB_ROWMAJOR'; if \verb'|J|' is small, then it is fastest if \verb'A' is -\verb'GxB_BY_COL'. The opposite is true if \verb'A' is transposed. +\verb'GrB_COLMAJOR'. The opposite is true if \verb'A' is transposed. \newpage %------------------------------------------------------------------------------- @@ -11396,7 +9689,7 @@ \subsubsection{{\sf GrB\_Col\_extract:} extract column vector from matrix} \paragraph{\bf Performance considerations:} % w = A(I,j) If \verb'A' is not transposed: it is fastest if the format of \verb'A' is -\verb'GxB_BY_COL'. The opposite is true if \verb'A' is transposed. +\verb'GrB_COLMAJOR'. The opposite is true if \verb'A' is transposed. \newpage %=============================================================================== @@ -11564,8 +9857,8 @@ \subsubsection{{\sf GxB\_Matrix\_subassign:} assign to a submatrix } \paragraph{\bf Performance considerations:} % C(I,J) = A If \verb'A' is not transposed: if \verb'|I|' is small, then it is fastest if -the format of \verb'C' is \verb'GxB_BY_ROW'; if \verb'|J|' is small, then it is -fastest if the format of \verb'C' is \verb'GxB_BY_COL'. The opposite is true +the format of \verb'C' is \verb'GrB_ROWMAJOR'; if \verb'|J|' is small, then it is +fastest if the format of \verb'C' is \verb'GrB_COLMAJOR'. The opposite is true if \verb'A' is transposed. \newpage @@ -11601,9 +9894,9 @@ \subsubsection{{\sf GxB\_Col\_subassign:} assign to a sub-column of a matrix} \paragraph{\bf Performance considerations:} % C(I,j) = u \verb'GxB_Col_subassign' is much faster than \verb'GxB_Row_subassign' if the -format of \verb'C' is \verb'GxB_BY_COL'. \verb'GxB_Row_subassign' is much +format of \verb'C' is \verb'GrB_COLMAJOR'. \verb'GxB_Row_subassign' is much faster than \verb'GxB_Col_subassign' if the format of \verb'C' is -\verb'GxB_BY_ROW'. +\verb'GrB_ROWMAJOR'. % \newpage %------------------------------------------------------------------------------- @@ -11638,9 +9931,9 @@ \subsubsection{{\sf GxB\_Row\_subassign:} assign to a sub-row of a matrix} \paragraph{\bf Performance considerations:} % C(i,J) = u' \verb'GxB_Col_subassign' is much faster than \verb'GxB_Row_subassign' if the -format of \verb'C' is \verb'GxB_BY_COL'. \verb'GxB_Row_subassign' is much +format of \verb'C' is \verb'GrB_COLMAJOR'. \verb'GxB_Row_subassign' is much faster than \verb'GxB_Col_subassign' if the format of \verb'C' is -\verb'GxB_BY_ROW'. +\verb'GrB_ROWMAJOR'. % \newpage %------------------------------------------------------------------------------- @@ -11708,7 +10001,7 @@ \subsubsection{{\sf GxB\_Matrix\_subassign\_$<$type$>$:} assign a scalar to a su The \verb' x' notation is otherwise the same as \verb'GrB_Matrix_setElement' (see Section~\ref{matrix_setElement}). Any value can be passed to this function and its type will be detected, via the -\verb'_Generic' feature of ANSI C11. For a user-defined type, \verb'x' is a +\verb'_Generic' feature of C11. For a user-defined type, \verb'x' is a \verb'void *' pointer that points to a memory space holding a single entry of a scalar that has exactly the same user-defined type as the matrix \verb'C'. This user-defined type must exactly match the user-defined type of \verb'C' @@ -11724,8 +10017,8 @@ \subsubsection{{\sf GxB\_Matrix\_subassign\_$<$type$>$:} assign a scalar to a su \paragraph{\bf Performance considerations:} % C(I,J) = scalar If \verb'A' is not transposed: if \verb'|I|' is small, then it is fastest if -the format of \verb'C' is \verb'GxB_BY_ROW'; if \verb'|J|' is small, then it is -fastest if the format of \verb'C' is \verb'GxB_BY_COL'. The opposite is true +the format of \verb'C' is \verb'GrB_ROWMAJOR'; if \verb'|J|' is small, then it is +fastest if the format of \verb'C' is \verb'GrB_COLMAJOR'. The opposite is true if \verb'A' is transposed. \newpage @@ -11833,8 +10126,8 @@ \subsubsection{{\sf GrB\_Matrix\_assign:} assign to a submatrix } \paragraph{\bf Performance considerations:} % C(I,J) = A If \verb'A' is not transposed: if \verb'|I|' is small, then it is fastest if -the format of \verb'C' is \verb'GxB_BY_ROW'; if \verb'|J|' is small, then it is -fastest if the format of \verb'C' is \verb'GxB_BY_COL'. The opposite is true +the format of \verb'C' is \verb'GrB_ROWMAJOR'; if \verb'|J|' is small, then it is +fastest if the format of \verb'C' is \verb'GrB_COLMAJOR'. The opposite is true if \verb'A' is transposed. \newpage @@ -11872,8 +10165,8 @@ \subsubsection{{\sf GrB\_Col\_assign:} assign to a sub-column of a matrix} \paragraph{\bf Performance considerations:} % C(I,j) = u \verb'GrB_Col_assign' is much faster than \verb'GrB_Row_assign' if the format -of \verb'C' is \verb'GxB_BY_COL'. \verb'GrB_Row_assign' is much faster than -\verb'GrB_Col_assign' if the format of \verb'C' is \verb'GxB_BY_ROW'. +of \verb'C' is \verb'GrB_COLMAJOR'. \verb'GrB_Row_assign' is much faster than +\verb'GrB_Col_assign' if the format of \verb'C' is \verb'GrB_ROWMAJOR'. \newpage %------------------------------------------------------------------------------- @@ -11910,8 +10203,8 @@ \subsubsection{{\sf GrB\_Row\_assign:} assign to a sub-row of a matrix} \paragraph{\bf Performance considerations:} % C(i,J) = u' \verb'GrB_Col_assign' is much faster than \verb'GrB_Row_assign' if the format -of \verb'C' is \verb'GxB_BY_COL'. \verb'GrB_Row_assign' is much faster than -\verb'GrB_Col_assign' if the format of \verb'C' is \verb'GxB_BY_ROW'. +of \verb'C' is \verb'GrB_COLMAJOR'. \verb'GrB_Row_assign' is much faster than +\verb'GrB_Col_assign' if the format of \verb'C' is \verb'GrB_ROWMAJOR'. \newpage %------------------------------------------------------------------------------- @@ -11986,7 +10279,7 @@ \subsubsection{{\sf GrB\_Matrix\_assign\_$<$type$>$:} assign a scalar to a subma The \verb' x' notation is otherwise the same as \verb'GrB_Matrix_setElement' (see Section~\ref{matrix_setElement}). Any value can be passed to this function and its type will be detected, via the -\verb'_Generic' feature of ANSI C11. For a user-defined type, \verb'x' is a +\verb'_Generic' feature of C11. For a user-defined type, \verb'x' is a \verb'void *' pointer that points to a memory space holding a single entry of a scalar that has exactly the same user-defined type as the matrix \verb'C'. This user-defined type must exactly match the user-defined type of \verb'C' @@ -12007,8 +10300,8 @@ \subsubsection{{\sf GrB\_Matrix\_assign\_$<$type$>$:} assign a scalar to a subma \paragraph{\bf Performance considerations:} % C(I,J) = scalar If \verb'A' is not transposed: if \verb'|I|' is small, then it is fastest if -the format of \verb'C' is \verb'GxB_BY_ROW'; if \verb'|J|' is small, then it is -fastest if the format of \verb'C' is \verb'GxB_BY_COL'. The opposite is true +the format of \verb'C' is \verb'GrB_ROWMAJOR'; if \verb'|J|' is small, then it is +fastest if the format of \verb'C' is \verb'GrB_COLMAJOR'. The opposite is true if \verb'A' is transposed. \newpage @@ -12078,7 +10371,7 @@ \subsection{Duplicate indices in {\sf GrB\_assign} and {\sf GxB\_subassign}} {\small \begin{verbatim} #include "GraphBLAS.h" - #undef I /* complex.h #define's I, used below as an array */ + #undef I /* complex.h #define's I, but I is used an array below */ #include int main (void) { @@ -12499,7 +10792,7 @@ \subsubsection{Performance of {\sf GxB\_subassign}, {\sf GrB\_assign} $n$-by-$n$ matrix \verb'C' where each submatrix \verb'A' has size $a$-by-$a$ with $s$ entries, and where \verb'C' starts with $c$ entries. Assume the matrices are all stored in non-hypersparse form, by row -(\verb'GxB_BY_ROW'). +(\verb'GrB_ROWMAJOR'). If blocking mode is enabled, or if the sequence requires the matrix to be completed after each assignment, each of the $t$ assignments takes $O(a + s @@ -13274,7 +11567,7 @@ \section{Printing GraphBLAS objects} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The ten different objects handled by SuiteSparse:GraphBLAS are all opaque, although nearly all of their contents can be extracted via methods such as \verb'GrB_Matrix_extractTuples', \verb'GrB_Matrix_extractElement', -\verb'GxB_Matrix_type', and so on. The GraphBLAS C API has no mechanism for +\verb'GrB_get', and so on. The GraphBLAS C API has no mechanism for printing all the contents of GraphBLAS objects, but this is helpful for debugging. Ten type-specific methods and two type-generic methods are provided: @@ -13286,7 +11579,7 @@ \section{Printing GraphBLAS objects} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \verb'GxB_Type_fprint' & print and check a \verb'GrB_Type' \\ \verb'GxB_UnaryOp_fprint' & print and check a \verb'GrB_UnaryOp' \\ \verb'GxB_BinaryOp_fprint' & print and check a \verb'GrB_BinaryOp' \\ -\verb'GxB_IndexUnaryOP_fprint' & print and check a \verb'GrB_IndexUnaryOp' \\ +\verb'GxB_IndexUnaryOp_fprint' & print and check a \verb'GrB_IndexUnaryOp' \\ \verb'GxB_Monoid_fprint' & print and check a \verb'GrB_Monoid' \\ \verb'GxB_Semiring_fprint' & print and check a \verb'GrB_Semiring' \\ \verb'GxB_Descriptor_fprint' & print and check a \verb'GrB_Descriptor' \\ @@ -13372,7 +11665,7 @@ \section{Printing GraphBLAS objects} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GraphBLAS matrices and vectors are zero-based, where indices of an $n$-by-$n$ matrix are in the range 0 to $n-1$. However, MATLAB, Octave, and Julia prefer to print their matrices and vectors as one-based. To enable 1-based printing, -use \verb'GxB_set (GxB_PRINT_1BASED, true)'. Printing is done as zero-based by +use \verb'GrB_set (GrB_GLOBAL, true, GxB_PRINT_1BASED)'. Printing is done as zero-based by default. \newpage @@ -13711,16 +12004,16 @@ \section{Matrix and Vector iterators} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the entries of a matrix using a row iterator requires an outer loop (for the rows) and an inner loop (for the entries in each row). A matrix can be accessed via a row iterator only if its format - (determined by \verb'GxB_get (A, GxB_FORMAT, &fmt)') is by-row - (that is, \verb'GxB_BY_ROW'). + (determined by \verb'GrB_get (A, &fmt,' \verb'GrB_STORAGE_ORIENTATION_HINT)') is by-row + (that is, \verb'GrB_ROWMAJOR'). See Section~\ref{options}. \item {\em column iterator}: iterates across the columns of a matrix, and then within each column to access the entries in a given column. Accessing all the entries of a matrix using a column iterator requires an outer loop (for the columns) and an inner loop (for the entries in each column). A matrix can be accessed via a column iterator only if - its format (determined by \verb'GxB_get (A, GxB_FORMAT, &fmt)') is - by-column (that is, \verb'GxB_BY_COL'). + its format (determined by \verb'GrB_get (A, &fmt, GrB_STORAGE_ORIENTATION_HINT)') is + by-column (that is, \verb'GrB_COLMAJOR'). See Section~\ref{options}. \item {\em entry iterator}: iterates across the entries of a matrix. Accessing all the entries of a matrix using an entry iterator requires @@ -14944,7 +13237,7 @@ \section{Performance} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{The burble is your friend} %------------------------------------------------------------------------------- -Turn on the burble with \verb'GxB_set (GxB_BURBLE, true)'. You will get a +Turn on the burble with \verb'GrB_set (GrB_GLOBAL, true, GxB_BURBLE)'. You will get a single line of output from each (significant) call to GraphBLAS. The burble output can help you detect when you are likely using sub-optimal methods, as described in the next sections. @@ -14986,12 +13279,12 @@ \subsection{Matrix data structures: sparse, hypersparse, bitmap, or full} and full formats. By default, all 4 formats can be used. A matrix typically starts out hypersparse when it is created by \verb'GrB_Matrix_new', and then changes during its lifetime, possibly taking on all four different formats -at different times. This can be modified via \verb'GxB_set'. For example, +at different times. This can be modified via \verb'GrB_set'. For example, this line of code: {\footnotesize \begin{verbatim} - GxB_set (A, GxB_SPARSITY_CONTROL, GxB_SPARSE + GxB_BITMAP) ; \end{verbatim}} + GrB_set (A, GxB_SPARSE + GxB_BITMAP, GxB_SPARSITY_CONTROL) ; \end{verbatim}} \noindent tells SuiteSparse that the matrix \verb'A' can be held in either sparse or @@ -15002,7 +13295,7 @@ \subsection{Matrix data structures: sparse, hypersparse, bitmap, or full} {\footnotesize \begin{verbatim} - GxB_set (A, GxB_SPARSITY_CONTROL, GxB_SPARSE) ; \end{verbatim}} + GrB_set (A, GxB_SPARSE, GxB_SPARSITY_CONTROL) ; \end{verbatim}} This ensures that SuiteSparse will primarily use the sparse format. This is still just a hint, however. The data structure is opaque and SuiteSparse is @@ -15048,7 +13341,7 @@ \subsection{Matrix formats: by row or by column, or using the transpose of application. If you see the term \verb'transpose' in the burble output, and if you need to perform this computation many times, try constructing your own explicit transpose, say \verb"AT=A'", via \verb'GrB_transpose', or create a -copy of \verb'A' but held in another orientation via \verb'GxB_set'. For +copy of \verb'A' but held in another orientation via \verb'GrB_set'. For example, assuming the default matrix format is by-row, and that \verb'A' is \verb'm'-by-\verb'n' of type \verb'GrB_FP32': @@ -15061,7 +13354,7 @@ \subsection{Matrix formats: by row or by column, or using the transpose of // method 2: A2 = A but held by column instead of by row // note: doing the set before the assign is faster than the reverse GrB_Matrix_new (A2, GrB_FP32, m, n) ; - GxB_set (A2, GxB_FORMAT, GxB_BY_COL) ; + GrB_set (A2, GrB_COLMAJOR, GrB_STORAGE_ORIENTATION_HINT) ; GrB_assign (A2, NULL, NULL, A, GrB_ALL, m, GrB_ALL, n, NULL) ; \end{verbatim}} Internally, the data structure for \verb'AT' and \verb'A2' are nearly identical @@ -15097,7 +13390,7 @@ \subsection{Push/pull optimization} {\footnotesize \begin{verbatim} int sparsity = do_push ? GxB_SPARSE : GxB_BITMAP ; - GxB_set (q, GxB_SPARSITY_CONTROL, sparsity) ; + GrB_set (q, sparsity, GxB_SPARSITY_CONTROL) ; if (do_push) { // q'{!pi} = q'*A @@ -15109,7 +13402,7 @@ \subsection{Push/pull optimization} GrB_mxv (q, pi, NULL, semiring, AT, q, GrB_DESC_RSC) ; }\end{verbatim}} -The call to \verb'GxB_set' is optional, since SuiteSparse will likely already +The call to \verb'GrB_set' is optional, since SuiteSparse will likely already determine that a bitmap format will work best when the frontier \verb'q' has many entries, which is also when the pull step is fastest. The push step relies on a sparse vector times sparse matrix method originally due to @@ -15551,7 +13844,7 @@ \subsection{Reading a matrix from a file} {\footnotesize \begin{verbatim} GrB_Descriptor_new (&dt2) ; - GrB_Descriptor_set (dt2, GrB_INP1, GrB_TRAN) ; + GrB_set (dt2, GrB_TRAN, GrB_INP1) ; GrB_Matrix_new (&A, GrB_FP64, n, n) ; GrB_eWiseAdd (A, NULL, NULL, GrB_PLUS_FP64, C, C, dt2) ; // A=C+C' GrB_free (&C) ; @@ -15601,7 +13894,7 @@ \subsection{Reading a matrix from a file} {\footnotesize \begin{verbatim} GrB_Descriptor_new (&dt1) ; - GrB_Descriptor_set (dt1, GrB_INP0, GrB_TRAN) ; + GrB_set (dt1, GrB_TRAN, GrB_INP0) ; GrB_Matrix_new (&A, GrB_FP64, n, n) ; // A (nrows:n-1, 0:nrows-1) = C' GrB_assign (A, NULL, NULL, C, J, ncols, I, nrows, dt1) ; @@ -15667,7 +13960,7 @@ \subsection{User-defined types and operators} the \verb'GxB_FC64' predefined type, but a complex type can also easily added as a user-defined type. The \verb'Complex_init' function in the \verb'usercomplex.c' file in the \verb'Demo' folder creates the \verb'Complex' -type based on the ANSI C11 \verb'double complex' type. +type based on the C11 \verb'double complex' type. It creates a full suite of operators that correspond to every built-in GraphBLAS operator, both binary and unary. In addition, it creates the operators listed in the following table, where $D$ is @@ -15746,7 +14039,7 @@ \section{Compiling and Installing SuiteSparse:GraphBLAS} \subsection{On Linux and Mac} %---------------------------------------- -GraphBLAS makes extensive use of features in the ANSI C11 standard, and thus a +GraphBLAS makes extensive use of features in the C11 standard, and thus a C compiler supporting this version of the C standard is required to use all features of GraphBLAS. @@ -15816,7 +14109,7 @@ \subsection{On Linux and Mac} GraphBLAS folder. If \verb'cmake' or \verb'make' fail, it might be that your default compiler -does not support ANSI C11. Try another compiler. For example, try one of +does not support C11. Try another compiler. For example, try one of these options. Go into the \verb'build' directory and type one of these: {\small @@ -15998,7 +14291,7 @@ \subsection{On Microsoft Windows} %---------------------------------------- SuiteSparse:GraphBLAS is now ported to Microsoft Visual Studio. However, that -compiler is not ANSI C11 compliant. As a result, GraphBLAS on Windows will have +compiler is not C11 compliant. As a result, GraphBLAS on Windows will have a few minor limitations. \begin{itemize} @@ -16341,7 +14634,7 @@ \subsection{Setting the C flags and using CMake} # check which compiler is being used. If you need to make # compiler-specific modifications, here is the place to do it. if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - # cmake 2.8 workaround: gcc needs to be told to do ANSI C11. + # cmake 2.8 workaround: gcc needs to be told to do C11. # cmake 3.0 doesn't have this problem. set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -lm " ) ... @@ -16475,16 +14768,36 @@ \section{Release Notes} \begin{itemize} -\item Dec 30, 2023: version 8.3.1 +\item Version 9.0.0, Jan 1, 2024 \begin{itemize} - \item remove \verb'#undef I' from \verb'GraphBLAS.h', so as not to conflict - with the definition of \verb'I' from \verb'complex.h'. + \item \verb'GrB_get/GrB_set': new functions from the v2.1 C API. + \item \verb'GrB_Type_new', \verb'GrB_UnaryOp_new', + \verb'GrB_IndexUnaryOp_new': no longer macros, since \verb'GrB_set' can + be used to set the names of the operators. These methods no longer + extract the name, so the default name is now the empty string. This is + because \verb'GrB_get/set' can only set these names once. This is a + non-compatible change of behavior for these 3 methods, so + SuiteSparse:GraphBLAS must become v9.0.0. + \item historical methods: many methods are replaced by \verb'GrB_get' and + \verb'GrB_set'. They remain in SuiteSparse:GraphBLAS but have been + declared historical. Terse prototypes exist in GraphBLAS.h, and any + discussion is removed from the User Guide: \verb'GxB_get', + \verb'GxB_set', and the methods they call, and many more. Use + \verb'GrB_get/set' in place those methods, and for: + \verb'GxB_*type_name', \verb'GxB_*type', \verb'GxB_Monoid_operator', + \verb'GxB_Monoid_identity', \verb'GxB_Monoid_terminal', + \verb'GxB_Semiring_add', \verb'GxB_Semiring_multiply'. Use \newline + \verb'GrB_STORAGE_ORIENTATION_HINT' in place of \verb'GxB_FORMAT'. + \item \verb'hyper_hash': constructed only if the number of non-empty + vectors in a hypersparse matrix is large ($> 1024$, by default). \end{itemize} -\item Dec 30, 2023: version 8.3.0 +\item Dec 30, 2023: version 8.3.1 \begin{itemize} + \item remove \verb'#undef I' from \verb'GraphBLAS.h', so as not to conflict + with the definition of \verb'I' from \verb'complex.h'. \item major change to build system: by Markus M\"{u}tzel \end{itemize} @@ -16499,7 +14812,7 @@ \section{Release Notes} \item cmake update: add "None" build type, from Antonio Rojas, for Arch Linux \end{itemize} -\item Version 8.2.0, Sept 5, 2023 +\item Version 8.2.0, Sept 8, 2023 \begin{itemize} \item cmake updates: \verb'SuiteSparse::' namespace by Markus M\"{u}tzel. @@ -16611,7 +14924,7 @@ \section{Release Notes} \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 + methods are 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 @@ -17202,7 +15515,7 @@ \section{Release Notes} are not available. Use the equivalent non-polymorphic functions instead, when compiling GraphBLAS with MS Visual Studio. In addition, variable-length arrays are not supported, so user-defined types are limited - to 128 bytes in size. These changes have no effect if you have an ANSI C11 + to 128 bytes in size. These changes have no effect if you have an C11 compliant compiler. \verb'@GrB' interface modified: \verb'GrB.init' is now required. diff --git a/GraphBLAS/Doc/GraphBLAS_version.tex b/GraphBLAS/Doc/GraphBLAS_version.tex index 391725e42e..71ebf2c8ea 100644 --- a/GraphBLAS/Doc/GraphBLAS_version.tex +++ b/GraphBLAS/Doc/GraphBLAS_version.tex @@ -1,5 +1,5 @@ % version of SuiteSparse:GraphBLAS \date{VERSION -8.3.1, -Dec 30, 2023} +9.0.0, +Jan 1, 2024} diff --git a/GraphBLAS/Doc/Makefile b/GraphBLAS/Doc/Makefile index 2d29532ab3..26b393ca65 100644 --- a/GraphBLAS/Doc/Makefile +++ b/GraphBLAS/Doc/Makefile @@ -10,7 +10,7 @@ # creates the user guide GraphBLAS_UserGuide.pdf: GraphBLAS_UserGuide.tex GraphBLAS_UserGuide.bib \ - GraphBLAS_API_version.tex GraphBLAS_version.tex + GraphBLAS_API_version.tex GraphBLAS_version.tex GrB_get_set.tex pdflatex GraphBLAS_UserGuide.tex bibtex GraphBLAS_UserGuide pdflatex GraphBLAS_UserGuide.tex diff --git a/GraphBLAS/Doc/README_Doc.txt b/GraphBLAS/Doc/README_Doc.txt index 6039388501..05ea770afb 100644 --- a/GraphBLAS/Doc/README_Doc.txt +++ b/GraphBLAS/Doc/README_Doc.txt @@ -9,7 +9,7 @@ This folder contains the following files: GraphBLAS_API_C_2.0.0.pdf v2.0 C API (see https://graphblas.org) GraphBLAS_API_version.tex the version of the C API that this version of SuiteSparse:GraphBLAS conforms to. - GraphBLAS_UserGuide.pdf the SuiteSparse:GraphBLAS User Guide + GraphBLAS_UserGuide.pdf the SuiteSparse:GraphBLAS User Guide GraphBLAS_UserGuide.tex LaTeX source of the User Guide GraphBLAS_UserGuide.bib diff --git a/GraphBLAS/Doc/TODO.txt b/GraphBLAS/Doc/TODO.txt deleted file mode 100644 index d855b49b68..0000000000 --- a/GraphBLAS/Doc/TODO.txt +++ /dev/null @@ -1,18 +0,0 @@ -For SS:GrB v9.0.0: - - track any changes to the v2.1 C API and release v9.0.0 when the - v2.1 C API is released. - -Future features: - - pack/unpack COO - kernel fusion - CUDA kernels - fine-grain parallelism for dot-product based mxm, mxv, vxm, - then add GxB_vxvt (outer product) and GxB_vtxv (inner product) - (or call them GxB_outerProduct and GxB_innerProduct?) - - aggregators - index binary ops - GrB_extract with GrB_Vectors instead of (GrB_Index *) arrays for I and J - diff --git a/GraphBLAS/GraphBLAS/@GrB/binopinfo.m b/GraphBLAS/GraphBLAS/@GrB/binopinfo.m index ce9c5ff3ea..5d9dcd8830 100644 --- a/GraphBLAS/GraphBLAS/@GrB/binopinfo.m +++ b/GraphBLAS/GraphBLAS/@GrB/binopinfo.m @@ -87,7 +87,7 @@ function binopinfo (op, optype) % and returns the double value 1.0 if true, or 0.0 if false. % % The following operators are avaiable for single and double (real); their -% definitions are identical to the ANSI C11 versions of these functions: +% definitions are identical to the C11 versions of these functions: % atan2, hypot, fmod, remainder, copysign, ldxep (also called 'pow2'). % All produce the same type as the input, on output. % diff --git a/GraphBLAS/GraphBLAS/@GrB/private/util/gb_error.c b/GraphBLAS/GraphBLAS/@GrB/private/util/gb_error.c index 37f9db650b..0f5e1b1106 100644 --- a/GraphBLAS/GraphBLAS/@GrB/private/util/gb_error.c +++ b/GraphBLAS/GraphBLAS/@GrB/private/util/gb_error.c @@ -38,6 +38,7 @@ const char *gb_error // return an error message from a GrB_Info value case GrB_DIMENSION_MISMATCH : return ("matrix dimensions are invalid") ; case GrB_OUTPUT_NOT_EMPTY : return ("output matrix already has values") ; case GrB_NOT_IMPLEMENTED : return ("method not implemented") ; + case GrB_ALREADY_SET : return ("name already set") ; case GrB_OUT_OF_MEMORY : return ("out of memory") ; case GrB_INSUFFICIENT_SPACE : return ("output array not large enough") ; case GrB_INVALID_OBJECT : return ("object is corrupted") ; diff --git a/GraphBLAS/GraphBLAS/@GrB/private/util/gb_export_to_mxstruct.c b/GraphBLAS/GraphBLAS/@GrB/private/util/gb_export_to_mxstruct.c index b2daf8f7dd..24dce5ac04 100644 --- a/GraphBLAS/GraphBLAS/@GrB/private/util/gb_export_to_mxstruct.c +++ b/GraphBLAS/GraphBLAS/@GrB/private/util/gb_export_to_mxstruct.c @@ -166,9 +166,12 @@ mxArray *gb_export_to_mxstruct // return exported built-in struct G // export and free the A->Y hyper_hash. It is always sparse, // GrB_UINT64, held by column, and non-iso OK (GxB_unpack_HyperHash (A, &Y, NULL)) ; - OK (GxB_Matrix_export_CSC (&Y, &ytype, &ynrows, &yvdim, - &Yp, &Yi, &Yx, &Yp_size, &Yi_size, &Yx_size, - NULL, NULL, NULL)) ; + if (Y != NULL) + { + OK (GxB_Matrix_export_CSC (&Y, &ytype, &ynrows, &yvdim, + &Yp, &Yi, &Yx, &Yp_size, &Yi_size, &Yx_size, + NULL, NULL, NULL)) ; + } // export and free the rest of the hypersparse matrix if (by_col) @@ -223,9 +226,10 @@ mxArray *gb_export_to_mxstruct // return exported built-in struct G break ; case GxB_HYPERSPARSE : - // A is hypersparse, with 9 fields: GraphBLAS*, s, x, p, i, h, + // A is hypersparse, with 6 or 9 fields: GraphBLAS*, s, x, p, i, h, // Yp, Yi, Yx - G = mxCreateStructMatrix (1, 1, 9, MatrixFields) ; + G = mxCreateStructMatrix (1, 1, (Yp == NULL) ? 6 : 9, + MatrixFields) ; break ; case GxB_BITMAP : @@ -308,26 +312,33 @@ mxArray *gb_export_to_mxstruct // return exported built-in struct G } mxSetFieldByNumber (G, 0, 5, Ah_mx) ; - // export Yp, of size yvdim+1 - mxArray *Yp_mx = mxCreateNumericMatrix (1, 0, mxUINT64_CLASS, mxREAL) ; - mxSetN (Yp_mx, yvdim+1) ; - void *p = (void *) mxGetData (Yp_mx) ; gb_mxfree (&p) ; - mxSetData (Yp_mx, Yp) ; - mxSetFieldByNumber (G, 0, 6, Yp_mx) ; - - // export Yi, of size nvec - mxArray *Yi_mx = mxCreateNumericMatrix (1, 0, mxUINT64_CLASS, mxREAL) ; - mxSetN (Yi_mx, nvec) ; - p = (void *) mxGetData (Yi_mx) ; gb_mxfree (&p) ; - mxSetData (Yi_mx, Yi) ; - mxSetFieldByNumber (G, 0, 7, Yi_mx) ; - - // export Yx, of size nvec - mxArray *Yx_mx = mxCreateNumericMatrix (1, 0, mxUINT64_CLASS, mxREAL) ; - mxSetN (Yx_mx, nvec) ; - p = (void *) mxGetData (Yx_mx) ; gb_mxfree (&p) ; - mxSetData (Yx_mx, Yx) ; - mxSetFieldByNumber (G, 0, 8, Yx_mx) ; + if (Yp != NULL) + { + + // export Yp, of size yvdim+1 + mxArray *Yp_mx = mxCreateNumericMatrix (1, 0, mxUINT64_CLASS, + mxREAL) ; + mxSetN (Yp_mx, yvdim+1) ; + void *p = (void *) mxGetData (Yp_mx) ; gb_mxfree (&p) ; + mxSetData (Yp_mx, Yp) ; + mxSetFieldByNumber (G, 0, 6, Yp_mx) ; + + // export Yi, of size nvec + mxArray *Yi_mx = mxCreateNumericMatrix (1, 0, mxUINT64_CLASS, + mxREAL) ; + mxSetN (Yi_mx, nvec) ; + p = (void *) mxGetData (Yi_mx) ; gb_mxfree (&p) ; + mxSetData (Yi_mx, Yi) ; + mxSetFieldByNumber (G, 0, 7, Yi_mx) ; + + // export Yx, of size nvec + mxArray *Yx_mx = mxCreateNumericMatrix (1, 0, mxUINT64_CLASS, + mxREAL) ; + mxSetN (Yx_mx, nvec) ; + p = (void *) mxGetData (Yx_mx) ; gb_mxfree (&p) ; + mxSetData (Yx_mx, Yx) ; + mxSetFieldByNumber (G, 0, 8, Yx_mx) ; + } } if (sparsity_status == GxB_BITMAP) diff --git a/GraphBLAS/GraphBLAS/@GrB/private/util/gb_get_shallow.c b/GraphBLAS/GraphBLAS/@GrB/private/util/gb_get_shallow.c index e99858af45..96d8ca6c60 100644 --- a/GraphBLAS/GraphBLAS/@GrB/private/util/gb_get_shallow.c +++ b/GraphBLAS/GraphBLAS/@GrB/private/util/gb_get_shallow.c @@ -344,10 +344,10 @@ GrB_Matrix gb_get_shallow // return a shallow copy of built-in sparse matrix } //---------------------------------------------------------------------- - // import the A->Y hyper_hash + // import the A->Y hyper_hash, if it exists //---------------------------------------------------------------------- - if (yvdim > 0) + if (nfields == 9) { // A->Y is sparse, uint64, (A->vdim)-by-yvdim, held by column OK (GrB_Matrix_new (&Y, GrB_UINT64, vdim, yvdim)) ; diff --git a/GraphBLAS/GraphBLAS/@GrB/unopinfo.m b/GraphBLAS/GraphBLAS/@GrB/unopinfo.m index 2c90e017ad..05e9a2c9af 100644 --- a/GraphBLAS/GraphBLAS/@GrB/unopinfo.m +++ b/GraphBLAS/GraphBLAS/@GrB/unopinfo.m @@ -71,8 +71,8 @@ function unopinfo (op, type) % erf z = erf (x) error function % erfc z = erfc (x) complementary error function % cbrt z = cbrt (x) cube root -% frexpx z = frexpx (x) mantissa from ANSI C11 frexp function -% frexpe z = frexpe (x) exponent from ANSI C11 frexp function; +% frexpx z = frexpx (x) mantissa from C11 frexp function +% frexpe z = frexpe (x) exponent from C11 frexp function; % the built-in [f,e]=log2(x) returns % f = frexpx (x) and e = frexpe (x). % diff --git a/GraphBLAS/GraphBLAS/demo/html/graphblas_demo.html b/GraphBLAS/GraphBLAS/demo/html/graphblas_demo.html index 308aa48591..cab72de9cc 100644 --- a/GraphBLAS/GraphBLAS/demo/html/graphblas_demo.html +++ b/GraphBLAS/GraphBLAS/demo/html/graphblas_demo.html @@ -404,7 +404,7 @@ and returns the double value 1.0 if true, or 0.0 if false. The following operators are avaiable for single and double (real); their - definitions are identical to the ANSI C11 versions of these functions: + definitions are identical to the C11 versions of these functions: atan2, hypot, fmod, remainder, copysign, ldxep (also called 'pow2'). All produce the same type as the input, on output. @@ -569,8 +569,8 @@ tgamma z = tgamma (x) gamma function, also 'gamma' erf z = erf (x) error function erfc z = erfc (x) complementary error function - frexpx z = frexpx (x) mantissa from ANSI C11 frexp function - frexpe z = frexpe (x) exponent from ANSI C11 frexp function; + frexpx z = frexpx (x) mantissa from C11 frexp function + frexpe z = frexpe (x) exponent from C11 frexp function; the built-in [f,e]=log2(x) returns f = frexpx (x) and e = frexpe (x). diff --git a/GraphBLAS/GraphBLAS/rename/GB_rename.h b/GraphBLAS/GraphBLAS/rename/GB_rename.h index 262192620d..a2a7b272ee 100644 --- a/GraphBLAS/GraphBLAS/rename/GB_rename.h +++ b/GraphBLAS/GraphBLAS/rename/GB_rename.h @@ -221,6 +221,7 @@ #define GB_clog2f GM_clog2f #define GB_clog2 GM_clog2 #define GB_code_check GM_code_check +#define GB_code_name_get GM_code_name_get #define GB_code_size GM_code_size #define GB_code_string GM_code_string #define GB_code_type GM_code_type @@ -409,6 +410,8 @@ #define GB_Global_hack_get GM_Global_hack_get #define GB_Global_hack_set GM_Global_hack_set #define GB_Global_have_realloc_function GM_Global_have_realloc_function +#define GB_Global_hyper_hash_get GM_Global_hyper_hash_get +#define GB_Global_hyper_hash_set GM_Global_hyper_hash_set #define GB_Global_hyper_switch_get GM_Global_hyper_switch_get #define GB_Global_hyper_switch_set GM_Global_hyper_switch_set #define GB_Global_is_csc_get GM_Global_is_csc_get @@ -494,6 +497,7 @@ #define GB_HUF_writeCTable_wksp GM_HUF_writeCTable_wksp #define GB_hyper_hash_build GM_hyper_hash_build #define GB_hyper_hash_free GM_hyper_hash_free +#define GB_hyper_hash_need GM_hyper_hash_need #define GB_hypermatrix_prune GM_hypermatrix_prune #define GB_hyper_prune GM_hyper_prune #define GB_hyper_realloc GM_hyper_realloc @@ -910,12 +914,19 @@ #define GB_Matrix_new GM_Matrix_new #define GB_Matrix_removeElement GM_Matrix_removeElement #define GB_matvec_check GM_matvec_check +#define GB_matvec_enum_get GM_matvec_enum_get +#define GB_matvec_name_get GM_matvec_name_get +#define GB_matvec_name_set GM_matvec_name_set +#define GB_matvec_name_size_get GM_matvec_name_size_get +#define GB_matvec_set GM_matvec_set #define GB_matvec_type GM_matvec_type #define GB_matvec_type_name GM_matvec_type_name #define GB_memcpy GM_memcpy #define GB_memoryUsage GM_memoryUsage #define GB_memset GM_memset #define GB_Monoid_check GM_Monoid_check +#define GB_monoid_get GM_monoid_get +#define GB_monoid_name_get GM_monoid_name_get #define GB_Monoid_new GM_Monoid_new #define GB_msort_1_create_merge_tasks GM_msort_1_create_merge_tasks #define GB_msort_1 GM_msort_1 @@ -935,10 +946,17 @@ #define GB_nvec_nonempty GM_nvec_nonempty #define GB_omp_get_max_threads GM_omp_get_max_threads #define GB_omp_get_wtime GM_omp_get_wtime +#define GB_op_enum_get GM_op_enum_get #define GB_Operator_check GM_Operator_check #define GB_Op_free GM_Op_free #define GB_op_is_second GM_op_is_second #define GB_op_name_and_defn GM_op_name_and_defn +#define GB_op_name_get GM_op_name_get +#define GB_op_or_type_string_set GM_op_or_type_string_set +#define GB_op_scalar_get GM_op_scalar_get +#define GB_op_size_get GM_op_size_get +#define GB_op_string_get GM_op_string_get +#define GB_op_string_set GM_op_string_set #define GB_Pending_alloc GM_Pending_alloc #define GB_Pending_free GM_Pending_free #define GB_Pending_n GM_Pending_n @@ -1009,6 +1027,7 @@ #define GB_select_sparse GM_select_sparse #define GB_select_value_iso GM_select_value_iso #define GB_Semiring_check GM_Semiring_check +#define GB_semiring_name_get GM_semiring_name_get #define GB_Semiring_new GM_Semiring_new #define GB_serialize_array GM_serialize_array #define GB_serialize_free_blocks GM_serialize_free_blocks @@ -1085,7 +1104,9 @@ #define GB_transpose_op GM_transpose_op #define GB_transpose_unop_jit GM_transpose_unop_jit #define GB_Type_check GM_Type_check +#define GB_type_code_get GM_type_code_get #define GB_Type_compatible GM_Type_compatible +#define GB_type_name_get GM_type_name_get #define GB_UnaryOp_check GM_UnaryOp_check #define GB_union_jit GM_union_jit #define GB_unjumble GM_unjumble @@ -1094,6 +1115,7 @@ #define GB_unop_iso GM_unop_iso #define GB_unop_new GM_unop_new #define GB_unop_one GM_unop_one +#define GB_user_name_set GM_user_name_set #define GB_user_op_jit GM_user_op_jit #define GB_user_type_jit GM_user_type_jit #define GB_Vector_check GM_Vector_check @@ -1421,6 +1443,16 @@ #define GrB_BAND_UINT8 GrM_BAND_UINT8 #define GrB_BinaryOp_error GrM_BinaryOp_error #define GrB_BinaryOp_free GrM_BinaryOp_free +#define GrB_BinaryOp_get_INT32 GrM_BinaryOp_get_INT32 +#define GrB_BinaryOp_get_Scalar GrM_BinaryOp_get_Scalar +#define GrB_BinaryOp_get_SIZE GrM_BinaryOp_get_SIZE +#define GrB_BinaryOp_get_String GrM_BinaryOp_get_String +#define GrB_BinaryOp_get_VOID GrM_BinaryOp_get_VOID +#define GrB_BinaryOp_new GrM_BinaryOp_new +#define GrB_BinaryOp_set_INT32 GrM_BinaryOp_set_INT32 +#define GrB_BinaryOp_set_Scalar GrM_BinaryOp_set_Scalar +#define GrB_BinaryOp_set_String GrM_BinaryOp_set_String +#define GrB_BinaryOp_set_VOID GrM_BinaryOp_set_VOID #define GrB_BinaryOp_wait GrM_BinaryOp_wait #define GrB_BNOT_INT16 GrM_BNOT_INT16 #define GrB_BNOT_INT32 GrM_BNOT_INT32 @@ -1472,8 +1504,17 @@ #define GrB_DESC_R GrM_DESC_R #define GrB_Descriptor_error GrM_Descriptor_error #define GrB_Descriptor_free GrM_Descriptor_free +#define GrB_Descriptor_get_INT32 GrM_Descriptor_get_INT32 +#define GrB_Descriptor_get_Scalar GrM_Descriptor_get_Scalar +#define GrB_Descriptor_get_SIZE GrM_Descriptor_get_SIZE +#define GrB_Descriptor_get_String GrM_Descriptor_get_String +#define GrB_Descriptor_get_VOID GrM_Descriptor_get_VOID #define GrB_Descriptor_new GrM_Descriptor_new #define GrB_Descriptor_set GrM_Descriptor_set +#define GrB_Descriptor_set_INT32 GrM_Descriptor_set_INT32 +#define GrB_Descriptor_set_Scalar GrM_Descriptor_set_Scalar +#define GrB_Descriptor_set_String GrM_Descriptor_set_String +#define GrB_Descriptor_set_VOID GrM_Descriptor_set_VOID #define GrB_Descriptor_wait GrM_Descriptor_wait #define GrB_DESC_RSC GrM_DESC_RSC #define GrB_DESC_RSCT0 GrM_DESC_RSCT0 @@ -1548,6 +1589,16 @@ #define GrB_GE_UINT32 GrM_GE_UINT32 #define GrB_GE_UINT64 GrM_GE_UINT64 #define GrB_GE_UINT8 GrM_GE_UINT8 +#define GrB_Global_get_INT32 GrM_Global_get_INT32 +#define GrB_Global_get_Scalar GrM_Global_get_Scalar +#define GrB_Global_get_SIZE GrM_Global_get_SIZE +#define GrB_Global_get_String GrM_Global_get_String +#define GrB_Global_get_VOID GrM_Global_get_VOID +#define GrB_GLOBAL GrM_GLOBAL +#define GrB_Global_set_INT32 GrM_Global_set_INT32 +#define GrB_Global_set_Scalar GrM_Global_set_Scalar +#define GrB_Global_set_String GrM_Global_set_String +#define GrB_Global_set_VOID GrM_Global_set_VOID #define GrB_GT_BOOL GrM_GT_BOOL #define GrB_GT_FP32 GrM_GT_FP32 #define GrB_GT_FP64 GrM_GT_FP64 @@ -1572,6 +1623,16 @@ #define GrB_IDENTITY_UINT8 GrM_IDENTITY_UINT8 #define GrB_IndexUnaryOp_error GrM_IndexUnaryOp_error #define GrB_IndexUnaryOp_free GrM_IndexUnaryOp_free +#define GrB_IndexUnaryOp_get_INT32 GrM_IndexUnaryOp_get_INT32 +#define GrB_IndexUnaryOp_get_Scalar GrM_IndexUnaryOp_get_Scalar +#define GrB_IndexUnaryOp_get_SIZE GrM_IndexUnaryOp_get_SIZE +#define GrB_IndexUnaryOp_get_String GrM_IndexUnaryOp_get_String +#define GrB_IndexUnaryOp_get_VOID GrM_IndexUnaryOp_get_VOID +#define GrB_IndexUnaryOp_new GrM_IndexUnaryOp_new +#define GrB_IndexUnaryOp_set_INT32 GrM_IndexUnaryOp_set_INT32 +#define GrB_IndexUnaryOp_set_Scalar GrM_IndexUnaryOp_set_Scalar +#define GrB_IndexUnaryOp_set_String GrM_IndexUnaryOp_set_String +#define GrB_IndexUnaryOp_set_VOID GrM_IndexUnaryOp_set_VOID #define GrB_IndexUnaryOp_wait GrM_IndexUnaryOp_wait #define GrB_init GrM_init #define GrB_INT16 GrM_INT16 @@ -1731,6 +1792,11 @@ #define GrB_Matrix_extractTuples_UINT64 GrM_Matrix_extractTuples_UINT64 #define GrB_Matrix_extractTuples_UINT8 GrM_Matrix_extractTuples_UINT8 #define GrB_Matrix_free GrM_Matrix_free +#define GrB_Matrix_get_INT32 GrM_Matrix_get_INT32 +#define GrB_Matrix_get_Scalar GrM_Matrix_get_Scalar +#define GrB_Matrix_get_SIZE GrM_Matrix_get_SIZE +#define GrB_Matrix_get_String GrM_Matrix_get_String +#define GrB_Matrix_get_VOID GrM_Matrix_get_VOID #define GrB_Matrix_import_BOOL GrM_Matrix_import_BOOL #define GrB_Matrix_import_FP32 GrM_Matrix_import_FP32 #define GrB_Matrix_import_FP64 GrM_Matrix_import_FP64 @@ -1796,6 +1862,10 @@ #define GrB_Matrix_setElement_UINT32 GrM_Matrix_setElement_UINT32 #define GrB_Matrix_setElement_UINT64 GrM_Matrix_setElement_UINT64 #define GrB_Matrix_setElement_UINT8 GrM_Matrix_setElement_UINT8 +#define GrB_Matrix_set_INT32 GrM_Matrix_set_INT32 +#define GrB_Matrix_set_Scalar GrM_Matrix_set_Scalar +#define GrB_Matrix_set_String GrM_Matrix_set_String +#define GrB_Matrix_set_VOID GrM_Matrix_set_VOID #define GrB_Matrix_wait GrM_Matrix_wait #define GrB_MAX_BOOL GrM_MAX_BOOL #define GrB_MAX_FIRST_SEMIRING_FP32 GrM_MAX_FIRST_SEMIRING_FP32 @@ -1963,6 +2033,11 @@ #define GrB_MINV_UINT8 GrM_MINV_UINT8 #define GrB_Monoid_error GrM_Monoid_error #define GrB_Monoid_free GrM_Monoid_free +#define GrB_Monoid_get_INT32 GrM_Monoid_get_INT32 +#define GrB_Monoid_get_Scalar GrM_Monoid_get_Scalar +#define GrB_Monoid_get_SIZE GrM_Monoid_get_SIZE +#define GrB_Monoid_get_String GrM_Monoid_get_String +#define GrB_Monoid_get_VOID GrM_Monoid_get_VOID #define GrB_Monoid_new_BOOL GrM_Monoid_new_BOOL #define GrB_Monoid_new_FP32 GrM_Monoid_new_FP32 #define GrB_Monoid_new_FP64 GrM_Monoid_new_FP64 @@ -1975,6 +2050,10 @@ #define GrB_Monoid_new_UINT32 GrM_Monoid_new_UINT32 #define GrB_Monoid_new_UINT64 GrM_Monoid_new_UINT64 #define GrB_Monoid_new_UINT8 GrM_Monoid_new_UINT8 +#define GrB_Monoid_set_INT32 GrM_Monoid_set_INT32 +#define GrB_Monoid_set_Scalar GrM_Monoid_set_Scalar +#define GrB_Monoid_set_String GrM_Monoid_set_String +#define GrB_Monoid_set_VOID GrM_Monoid_set_VOID #define GrB_Monoid_wait GrM_Monoid_wait #define GrB_mxm GrM_mxm #define GrB_mxv GrM_mxv @@ -2063,6 +2142,11 @@ #define GrB_Scalar_extractElement_UINT64 GrM_Scalar_extractElement_UINT64 #define GrB_Scalar_extractElement_UINT8 GrM_Scalar_extractElement_UINT8 #define GrB_Scalar_free GrM_Scalar_free +#define GrB_Scalar_get_INT32 GrM_Scalar_get_INT32 +#define GrB_Scalar_get_Scalar GrM_Scalar_get_Scalar +#define GrB_Scalar_get_SIZE GrM_Scalar_get_SIZE +#define GrB_Scalar_get_String GrM_Scalar_get_String +#define GrB_Scalar_get_VOID GrM_Scalar_get_VOID #define GrB_Scalar_new GrM_Scalar_new #define GrB_Scalar_nvals GrM_Scalar_nvals #define GrB_Scalar_setElement_BOOL GrM_Scalar_setElement_BOOL @@ -2077,6 +2161,10 @@ #define GrB_Scalar_setElement_UINT32 GrM_Scalar_setElement_UINT32 #define GrB_Scalar_setElement_UINT64 GrM_Scalar_setElement_UINT64 #define GrB_Scalar_setElement_UINT8 GrM_Scalar_setElement_UINT8 +#define GrB_Scalar_set_INT32 GrM_Scalar_set_INT32 +#define GrB_Scalar_set_Scalar GrM_Scalar_set_Scalar +#define GrB_Scalar_set_String GrM_Scalar_set_String +#define GrB_Scalar_set_VOID GrM_Scalar_set_VOID #define GrB_Scalar_wait GrM_Scalar_wait #define GrB_SECOND_BOOL GrM_SECOND_BOOL #define GrB_SECOND_FP32 GrM_SECOND_FP32 @@ -2091,7 +2179,16 @@ #define GrB_SECOND_UINT8 GrM_SECOND_UINT8 #define GrB_Semiring_error GrM_Semiring_error #define GrB_Semiring_free GrM_Semiring_free +#define GrB_Semiring_get_INT32 GrM_Semiring_get_INT32 +#define GrB_Semiring_get_Scalar GrM_Semiring_get_Scalar +#define GrB_Semiring_get_SIZE GrM_Semiring_get_SIZE +#define GrB_Semiring_get_String GrM_Semiring_get_String +#define GrB_Semiring_get_VOID GrM_Semiring_get_VOID #define GrB_Semiring_new GrM_Semiring_new +#define GrB_Semiring_set_INT32 GrM_Semiring_set_INT32 +#define GrB_Semiring_set_Scalar GrM_Semiring_set_Scalar +#define GrB_Semiring_set_String GrM_Semiring_set_String +#define GrB_Semiring_set_VOID GrM_Semiring_set_VOID #define GrB_Semiring_wait GrM_Semiring_wait #define GrB_TIMES_BOOL GrM_TIMES_BOOL #define GrB_TIMES_FP32 GrM_TIMES_FP32 @@ -2119,6 +2216,16 @@ #define GrB_TRIU GrM_TRIU #define GrB_Type_error GrM_Type_error #define GrB_Type_free GrM_Type_free +#define GrB_Type_get_INT32 GrM_Type_get_INT32 +#define GrB_Type_get_Scalar GrM_Type_get_Scalar +#define GrB_Type_get_SIZE GrM_Type_get_SIZE +#define GrB_Type_get_String GrM_Type_get_String +#define GrB_Type_get_VOID GrM_Type_get_VOID +#define GrB_Type_new GrM_Type_new +#define GrB_Type_set_INT32 GrM_Type_set_INT32 +#define GrB_Type_set_Scalar GrM_Type_set_Scalar +#define GrB_Type_set_String GrM_Type_set_String +#define GrB_Type_set_VOID GrM_Type_set_VOID #define GrB_Type_wait GrM_Type_wait #define GrB_UINT16 GrM_UINT16 #define GrB_UINT32 GrM_UINT32 @@ -2126,6 +2233,16 @@ #define GrB_UINT8 GrM_UINT8 #define GrB_UnaryOp_error GrM_UnaryOp_error #define GrB_UnaryOp_free GrM_UnaryOp_free +#define GrB_UnaryOp_get_INT32 GrM_UnaryOp_get_INT32 +#define GrB_UnaryOp_get_Scalar GrM_UnaryOp_get_Scalar +#define GrB_UnaryOp_get_SIZE GrM_UnaryOp_get_SIZE +#define GrB_UnaryOp_get_String GrM_UnaryOp_get_String +#define GrB_UnaryOp_get_VOID GrM_UnaryOp_get_VOID +#define GrB_UnaryOp_new GrM_UnaryOp_new +#define GrB_UnaryOp_set_INT32 GrM_UnaryOp_set_INT32 +#define GrB_UnaryOp_set_Scalar GrM_UnaryOp_set_Scalar +#define GrB_UnaryOp_set_String GrM_UnaryOp_set_String +#define GrB_UnaryOp_set_VOID GrM_UnaryOp_set_VOID #define GrB_UnaryOp_wait GrM_UnaryOp_wait #define GrB_VALUEEQ_BOOL GrM_VALUEEQ_BOOL #define GrB_VALUEEQ_FP32 GrM_VALUEEQ_FP32 @@ -2295,6 +2412,11 @@ #define GrB_Vector_extractTuples_UINT64 GrM_Vector_extractTuples_UINT64 #define GrB_Vector_extractTuples_UINT8 GrM_Vector_extractTuples_UINT8 #define GrB_Vector_free GrM_Vector_free +#define GrB_Vector_get_INT32 GrM_Vector_get_INT32 +#define GrB_Vector_get_Scalar GrM_Vector_get_Scalar +#define GrB_Vector_get_SIZE GrM_Vector_get_SIZE +#define GrB_Vector_get_String GrM_Vector_get_String +#define GrB_Vector_get_VOID GrM_Vector_get_VOID #define GrB_Vector_new GrM_Vector_new #define GrB_Vector_nvals GrM_Vector_nvals #define GrB_Vector_reduce_BinaryOp_Scalar GrM_Vector_reduce_BinaryOp_Scalar @@ -2339,6 +2461,10 @@ #define GrB_Vector_setElement_UINT32 GrM_Vector_setElement_UINT32 #define GrB_Vector_setElement_UINT64 GrM_Vector_setElement_UINT64 #define GrB_Vector_setElement_UINT8 GrM_Vector_setElement_UINT8 +#define GrB_Vector_set_INT32 GrM_Vector_set_INT32 +#define GrB_Vector_set_Scalar GrM_Vector_set_Scalar +#define GrB_Vector_set_String GrM_Vector_set_String +#define GrB_Vector_set_VOID GrM_Vector_set_VOID #define GrB_Vector_size GrM_Vector_size #define GrB_Vector_wait GrM_Vector_wait #define GrB_vxm GrM_vxm @@ -2858,10 +2984,19 @@ #define GxB_Context_get_FP64 GxM_Context_get_FP64 #define GxB_Context_get GxM_Context_get #define GxB_Context_get_INT32 GxM_Context_get_INT32 +#define GxB_Context_get_INT GxM_Context_get_INT +#define GxB_Context_get_Scalar GxM_Context_get_Scalar +#define GxB_Context_get_SIZE GxM_Context_get_SIZE +#define GxB_Context_get_String GxM_Context_get_String +#define GxB_Context_get_VOID GxM_Context_get_VOID #define GxB_Context_new GxM_Context_new #define GxB_Context_set_FP64 GxM_Context_set_FP64 #define GxB_Context_set GxM_Context_set #define GxB_Context_set_INT32 GxM_Context_set_INT32 +#define GxB_Context_set_INT GxM_Context_set_INT +#define GxB_Context_set_Scalar GxM_Context_set_Scalar +#define GxB_Context_set_String GxM_Context_set_String +#define GxB_Context_set_VOID GxM_Context_set_VOID #define GxB_Context_wait GxM_Context_wait #define GxB_CONTEXT_WORLD GxM_CONTEXT_WORLD #define GxB_COPYSIGN_FP32 GxM_COPYSIGN_FP32 @@ -4369,6 +4504,11 @@ #define GxB_Semiring_add GxM_Semiring_add #define GxB_Semiring_fprint GxM_Semiring_fprint #define GxB_Semiring_multiply GxM_Semiring_multiply +#define GxB_Serialized_get_INT32 GxM_Serialized_get_INT32 +#define GxB_Serialized_get_Scalar GxM_Serialized_get_Scalar +#define GxB_Serialized_get_SIZE GxM_Serialized_get_SIZE +#define GxB_Serialized_get_String GxM_Serialized_get_String +#define GxB_Serialized_get_VOID GxM_Serialized_get_VOID #define GxB_SIGNUM_FC32 GxM_SIGNUM_FC32 #define GxB_SIGNUM_FC64 GxM_SIGNUM_FC64 #define GxB_SIGNUM_FP32 GxM_SIGNUM_FP32 diff --git a/GraphBLAS/GraphBLAS/rename/Makefile b/GraphBLAS/GraphBLAS/rename/Makefile index 16d517e9a6..0b0f25624f 100644 --- a/GraphBLAS/GraphBLAS/rename/Makefile +++ b/GraphBLAS/GraphBLAS/rename/Makefile @@ -13,18 +13,14 @@ # libgraphblas_matlab.so with renamed symbols, to avoid conflicting with the # built-in libmwgraphblas.so (v3.3.3) in MATLAB R2021a and later. -# GrB_Type_new, GrB_UnaryOp_new, GrB_BinaryOp_new, and GxB_*Iterator* methods -# are #define'd as both macros and functions in GraphBLAS.h, so they are not -# renamed. Functions with "__" in their name are renamed using macros -# internally, and so they do not need to be renamed with GB_rename.h. +# GxB_*Iterator* methods are #define'd as both macros and functions in +# GraphBLAS.h, so they are not renamed. Functions with "__" in their name are +# renamed using macros internally, and so they do not need to be renamed with +# GB_rename.h. go: nm -gD ../../build/libgraphblas.so | grep -v "__" > lib - grep " GrB_" lib \ - | grep -v GrB_Type_new \ - | grep -v GrB_UnaryOp_new \ - | grep -v GrB_IndexUnaryOp_new \ - | grep -v GrB_BinaryOp_new > temp.h + grep " GrB_" lib > temp.h grep " GxB_" lib \ | grep -v Iterator >> temp.h grep " GB_" lib \ @@ -38,11 +34,7 @@ go: # on the Mac, use "make mac" mac: nm -gA ../../build/libgraphblas.dylib | grep -v "__" > lib - grep " _GrB_" lib \ - | grep -v GrB_Type_new \ - | grep -v GrB_UnaryOp_new \ - | grep -v GrB_IndexUnaryOp_new \ - | grep -v GrB_BinaryOp_new > temp.h + grep " _GrB_" lib > temp.h grep " _GxB_" lib \ | grep -v Iterator >> temp.h grep " _GB_" lib \ diff --git a/GraphBLAS/Include/GraphBLAS.h b/GraphBLAS/Include/GraphBLAS.h index 1078423462..9ca2ea35ba 100644 --- a/GraphBLAS/Include/GraphBLAS.h +++ b/GraphBLAS/Include/GraphBLAS.h @@ -1,9 +1,9 @@ -// SuiteSparse:GraphBLAS 8.3.1 +// SuiteSparse:GraphBLAS 9.0.0 //------------------------------------------------------------------------------ // GraphBLAS.h: definitions for the GraphBLAS package //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ @@ -32,10 +32,10 @@ // Regarding "historical" functions and symbols: when a GxB_* function or // symbol is added to the C API Specification, the new GrB_* name should be -// used instead. The old GxB_* name will be kept for historical reasons, -// documented here and in working order; it might no longer be mentioned in the -// user guide. Historical functions and symbols would only be removed in the -// rare case that they cause a serious conflict with future methods. +// used instead. The old GxB_* name will be kept in working order for +// historical reasons; it might no longer be mentioned in the user guide. +// Historical functions and symbols would only be removed in the rare case that +// they cause a serious conflict with future methods. #ifndef GRAPHBLAS_H #define GRAPHBLAS_H @@ -226,13 +226,13 @@ // The version of this implementation, and the GraphBLAS API version: #define GxB_IMPLEMENTATION_NAME "SuiteSparse:GraphBLAS" -#define GxB_IMPLEMENTATION_DATE "Dec 30, 2023" -#define GxB_IMPLEMENTATION_MAJOR 8 -#define GxB_IMPLEMENTATION_MINOR 3 -#define GxB_IMPLEMENTATION_SUB 1 -#define GxB_SPEC_DATE "Nov 15, 2021" +#define GxB_IMPLEMENTATION_DATE "Jan 1, 2024" +#define GxB_IMPLEMENTATION_MAJOR 9 +#define GxB_IMPLEMENTATION_MINOR 0 +#define GxB_IMPLEMENTATION_SUB 0 +#define GxB_SPEC_DATE "Dec 22, 2023" #define GxB_SPEC_MAJOR 2 -#define GxB_SPEC_MINOR 0 +#define GxB_SPEC_MINOR 1 #define GxB_SPEC_SUB 0 // compile-time access to the C API Version number of this library. @@ -246,12 +246,12 @@ // The 'about' string the describes this particular implementation of GraphBLAS: #define GxB_IMPLEMENTATION_ABOUT \ -"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved." \ +"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved." \ "\nhttp://suitesparse.com Dept of Computer Sci. & Eng, Texas A&M University.\n" // The GraphBLAS license for this particular implementation of GraphBLAS: #define GxB_IMPLEMENTATION_LICENSE \ -"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved." \ +"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved." \ "\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\n"\ "not use SuiteSparse:GraphBLAS except in compliance with the License. You\n" \ "may obtain a copy of the License at\n\n" \ @@ -270,10 +270,11 @@ // The 'spec' string describes the GraphBLAS spec: #define GxB_SPEC_ABOUT \ -"GraphBLAS C API, by Aydin Buluc, Timothy Mattson, Scott McMillan,\n" \ -"Jose' Moreira, Carl Yang, and Benjamin Brock. Based on 'GraphBLAS\n" \ -"Mathematics by Jeremy Kepner. See also 'Graph Algorithms in the Language\n" \ -"of Linear Algebra,' edited by J. Kepner and J. Gilbert, SIAM, 2011.\n" +"GraphBLAS C API, by Benjamin Brock, Aydin Buluc, Raye Kimmerer,\n" \ +"Jim Kitchen, Major Kumar, Timothy Mattson, Scott McMillan, Jose' Moreira,\n" \ +"Erik Welch, and Carl Yang. Based on 'GraphBLAS Mathematics by Jeremy\n" \ +"Kepner. See also 'Graph Algorithms in the Language of Linear Algebra,'\n" \ +"edited by J. Kepner and J. Gilbert, SIAM, 2011.\n" //============================================================================== // GrB_Index: the GraphBLAS integer @@ -330,6 +331,7 @@ typedef enum GrB_DIMENSION_MISMATCH = -6, // matrix dimensions do not match GrB_OUTPUT_NOT_EMPTY = -7, // output matrix already has values GrB_NOT_IMPLEMENTED = -8, // method not implemented + GrB_ALREADY_SET = -9, // field already written to GrB_PANIC = -101, // unknown error GrB_OUT_OF_MEMORY = -102, // out of memory GrB_INSUFFICIENT_SPACE = -103, // output array not large enough @@ -392,7 +394,12 @@ GrB_Info GrB_finalize (void) ; // finish GraphBLAS // GrB_getVersion: GraphBLAS C API version //============================================================================== -// GrB_getVersion provides a runtime access of the C API Version. +// GrB_getVersion provides a runtime access of the C API Version. Can also be +// done with two calls to GrB_Global_get_INT32 with the v2.1 C API: +// +// GrB_get (GrB_GLOBAL, &version, GrB_API_VER_MAJOR) ; +// GrB_get (GrB_GLOBAL, &subversion, GrB_API_VER_MINOR) ; + GrB_Info GrB_getVersion // runtime access to C API version number ( unsigned int *version, // returns GRB_VERSION @@ -405,13 +412,13 @@ GrB_Info GrB_getVersion // runtime access to C API version number // The GrB_Descriptor is used to modify the behavior of GraphBLAS operations. // -// GrB_OUTP: can be GxB_DEFAULT or GrB_REPLACE. If GrB_REPLACE, then C is +// GrB_OUTP: can be GrB_DEFAULT or GrB_REPLACE. If GrB_REPLACE, then C is // cleared after taking part in the accum operation but before the mask. // In other words, C = accum (C,T) is split into Z = accum(C,T) ; // C=0 ; C = Z. // -// GrB_MASK: can be GxB_DEFAULT, GrB_COMP, GrB_STRUCTURE, or set to both -// GrB_COMP and GrB_STRUCTURE. If GxB_DEFAULT, the mask is used +// GrB_MASK: can be GrB_DEFAULT, GrB_COMP, GrB_STRUCTURE, or set to both +// GrB_COMP and GrB_STRUCTURE. If GrB_DEFAULT, the mask is used // normally, where Mask(i,j)=1 means C(i,j) can be modified by C=Z, // and Mask(i,j)=0 means it cannot be modified even if Z(i,j) is has been // computed and differs from C(i,j). If GrB_COMP, this is the same as @@ -419,7 +426,7 @@ GrB_Info GrB_getVersion // runtime access to C API version number // the value of the mask is not considered, just its pattern. The // GrB_COMP and GrB_STRUCTURE settings can be combined. // -// GrB_INP0: can be GxB_DEFAULT or GrB_TRAN. If GxB_DEFAULT, the first input +// GrB_INP0: can be GrB_DEFAULT or GrB_TRAN. If GrB_DEFAULT, the first input // is used as-is. If GrB_TRAN, it is transposed. Only matrices are // transposed this way. Vectors are never transposed via the // GrB_Descriptor. @@ -429,7 +436,7 @@ GrB_Info GrB_getVersion // runtime access to C API version number // GxB_AxB_METHOD: this is a hint to SuiteSparse:GraphBLAS on which algorithm // it should use to compute C=A*B, in GrB_mxm, GrB_mxv, and GrB_vxm. // SuiteSparse:GraphBLAS has four different heuristics, and the default -// method (GxB_DEFAULT) selects between them automatically. The complete +// method (GrB_DEFAULT) selects between them automatically. The complete // rule is in the User Guide. The brief discussion here assumes all // matrices are stored by column. All methods compute the same result, // except that floating-point roundoff may differ when working on @@ -459,7 +466,7 @@ GrB_Info GrB_getVersion // runtime access to C API version number // state, with indices out of order. The sort is left pending. Some // methods can tolerate jumbled matrices on input, so this can be faster. // However, in some cases, it can be faster for GrB_mxm to sort its output -// as it is computed. With GxB_SORT set to GxB_DEFAULT, the sort is left +// as it is computed. With GxB_SORT set to GrB_DEFAULT, the sort is left // pending. With GxB_SORT set to a nonzero value, GrB_mxm typically sorts // the resulting matrix C (but not always; this is just a hint). If // GrB_init is called with GrB_BLOCKING mode, the sort will always be @@ -497,7 +504,8 @@ GrB_Desc_Field ; typedef enum { // for all GrB_Descriptor fields: - GxB_DEFAULT = 0, // default behavior of the method + GrB_DEFAULT = 0, // default behavior of the method + GxB_DEFAULT = 0, // historical; use GrB_DEFAULT instead // for GrB_OUTP only: GrB_REPLACE = 1, // clear the output before assigning new values to it @@ -505,6 +513,7 @@ typedef enum // for GrB_MASK only: GrB_COMP = 2, // use the structural complement of the input GrB_STRUCTURE = 4, // use the only pattern of the mask, not its values + GrB_COMP_STRUCTURE = 6, // shorthand for GrB_COMP + GrB_STRUCTURE // for GrB_INP0 and GrB_INP1 only: GrB_TRAN = 3, // use the transpose of the input @@ -521,7 +530,7 @@ typedef enum GrB_Desc_Value ; // default for GxB pack is to trust the input data -#define GxB_FAST_IMPORT GxB_DEFAULT +#define GxB_FAST_IMPORT ((int) GrB_DEFAULT) typedef struct GB_Descriptor_opaque *GrB_Descriptor ; @@ -530,61 +539,15 @@ GrB_Info GrB_Descriptor_new // create a new descriptor GrB_Descriptor *descriptor // handle of descriptor to create ) ; -GrB_Info GrB_Descriptor_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - GrB_Desc_Field field, // parameter to change - GrB_Desc_Value val // value to change it to -) ; - -GrB_Info GxB_Descriptor_get // get a parameter from a descriptor -( - GrB_Desc_Value *val, // value of the parameter - GrB_Descriptor desc, // descriptor to query; NULL means defaults - GrB_Desc_Field field // parameter to query -) ; - -GrB_Info GxB_Desc_set // set a parameter in a descriptor -( - GrB_Descriptor desc, // descriptor to modify - GrB_Desc_Field field, // parameter to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Desc_get // get a parameter from a descriptor -( - GrB_Descriptor desc, // descriptor to query; NULL means defaults - GrB_Desc_Field field, // parameter to query - ... // value of the parameter -) ; - -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 -) ; - -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 -) ; +// historical methods; use GrB_set and GrB_get instead: +GrB_Info GrB_Descriptor_set (GrB_Descriptor, GrB_Desc_Field, GrB_Desc_Value) ; +GrB_Info GxB_Descriptor_get (GrB_Desc_Value *, GrB_Descriptor, GrB_Desc_Field) ; +GrB_Info GxB_Desc_set (GrB_Descriptor, GrB_Desc_Field, ...) ; +GrB_Info GxB_Desc_set_INT32 (GrB_Descriptor, GrB_Desc_Field, int32_t) ; +GrB_Info GxB_Desc_set_FP64 (GrB_Descriptor, GrB_Desc_Field, double) ; +GrB_Info GxB_Desc_get (GrB_Descriptor, GrB_Desc_Field, ...) ; +GrB_Info GxB_Desc_get_INT32 (GrB_Descriptor, GrB_Desc_Field, int32_t *) ; +GrB_Info GxB_Desc_get_FP64 (GrB_Descriptor, GrB_Desc_Field, double *) ; GrB_Info GrB_Descriptor_free // free a descriptor ( @@ -731,32 +694,12 @@ GB_GLOBAL GrB_Type // GrB_Type_new: create a new type //------------------------------------------------------------------------------ -// GrB_Type_new is implemented both as a macro and a function. Both are -// user-callable. The default is to use the macro, since this allows the name -// of the type to be saved as a string, for subsequent error reporting by -// GrB_error. - -#undef GrB_Type_new -#undef GrM_Type_new - -GrB_Info GRB (Type_new) // create a new GraphBLAS type +GrB_Info GrB_Type_new // create a new GraphBLAS type ( GrB_Type *type, // handle of user type to create size_t sizeof_ctype // size = sizeof (ctype) of the C type ) ; -// user code should not directly use GB_STR or GB_XSTR -// GB_STR: convert the content of x into a string "x" -#define GB_XSTR(x) GB_STR(x) -#define GB_STR(x) #x - -// GrB_Type_new as a user-callable macro, which allows the name of the ctype -// to be added to the new type. The type_defn is unknown. -#define GrB_Type_new(utype, sizeof_ctype) \ - GxB_Type_new(utype, sizeof_ctype, GB_STR(sizeof_ctype), NULL) -#define GrM_Type_new(utype, sizeof_ctype) \ - GxB_Type_new(utype, sizeof_ctype, GB_STR(sizeof_ctype), NULL) - // GxB_Type_new creates a type with a name and definition that are known to // GraphBLAS, as strings. The type_name is any valid string (max length of 128 // characters, including the required null-terminating character) that may @@ -786,22 +729,16 @@ GrB_Info GxB_Type_new // create a new named GraphBLAS type const char *type_defn // typedef for the type (no max length) ) ; -GrB_Info GxB_Type_name // return the name of a GraphBLAS type -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Type type -) ; - -GrB_Info GxB_Type_size // determine the size of the type -( - size_t *size, // the sizeof the type - const GrB_Type type // type to determine the sizeof -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Type_name (char *type_name, const GrB_Type type) ; +GrB_Info GxB_Type_size (size_t *size, const GrB_Type type) ; GrB_Info GxB_Type_from_name // return the built-in GrB_Type from a name ( - GrB_Type *type, // built-in type, or NULL if user-defined + GrB_Type *type, // built-in type, or NULL if user-defined. + // The name can be the underlying C type + // ("int8_t") or the GraphBLAS name + // ("GrB_INT8"). const char *type_name // array of size at least GxB_MAX_NAME_LEN ) ; @@ -1006,23 +943,16 @@ GB_GLOBAL GrB_UnaryOp typedef void (*GxB_unary_function) (void *, const void *) ; -// GrB_UnaryOp_new creates a user-defined unary op, with an automatic -// detection of the operator name. -#undef GrB_UnaryOp_new -#undef GrM_UnaryOp_new -GrB_Info GRB (UnaryOp_new) // create a new user-defined unary operator +// GrB_UnaryOp_new creates a user-defined unary op (with no name or defn) +GrB_Info GrB_UnaryOp_new // create a new user-defined unary operator ( GrB_UnaryOp *unaryop, // handle for the new unary operator GxB_unary_function function, // pointer to the unary function GrB_Type ztype, // type of output z GrB_Type xtype // type of input x ) ; -#define GrB_UnaryOp_new(op,f,z,x) \ - GxB_UnaryOp_new(op,f,z,x, GB_STR(f), NULL) -#define GrM_UnaryOp_new(op,f,z,x) \ - GxM_UnaryOp_new(op,f,z,x, GB_STR(f), NULL) -// GxB_UnaryOp_new creates a named user-defined unary op. +// GxB_UnaryOp_new creates a named and defined user-defined unary op. GrB_Info GxB_UnaryOp_new // create a new user-defined unary operator ( GrB_UnaryOp *unaryop, // handle for the new unary operator @@ -1033,29 +963,11 @@ GrB_Info GxB_UnaryOp_new // create a new user-defined unary operator const char *unop_defn // definition of the user function ) ; -// GxB_UnaryOp_ztype is historical. Use GxB_UnaryOp_ztype_name instead. -GrB_Info GxB_UnaryOp_ztype // return the type of z -( - GrB_Type *ztype, // return type of output z - GrB_UnaryOp unaryop // unary operator -) ; -GrB_Info GxB_UnaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_UnaryOp unaryop // unary operator -) ; - -// GxB_UnaryOp_xtype is historical. Use GxB_UnaryOp_xtype_name instead. -GrB_Info GxB_UnaryOp_xtype // return the type of x -( - GrB_Type *xtype, // return type of input x - GrB_UnaryOp unaryop // unary operator -) ; -GrB_Info GxB_UnaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_UnaryOp unaryop // unary operator -) ; +// historical; use GrB_get instead: +GrB_Info GxB_UnaryOp_ztype (GrB_Type *ztype, GrB_UnaryOp unaryop) ; +GrB_Info GxB_UnaryOp_ztype_name (char *type_name, const GrB_UnaryOp unaryop) ; +GrB_Info GxB_UnaryOp_xtype (GrB_Type *xtype, GrB_UnaryOp unaryop) ; +GrB_Info GxB_UnaryOp_xtype_name (char *type_name, const GrB_UnaryOp unaryop) ; GrB_Info GrB_UnaryOp_free // free a user-created unary operator ( @@ -1467,11 +1379,8 @@ GB_GLOBAL GrB_BinaryOp GxB_IGNORE_DUP ; typedef void (*GxB_binary_function) (void *, const void *, const void *) ; -// GrB_BinaryOp_new creates a user-defined binary op, with an automatic -// detection of the operator name. -#undef GrB_BinaryOp_new -#undef GrM_BinaryOp_new -GrB_Info GRB (BinaryOp_new) +// GrB_BinaryOp_new creates a user-defined binary op (no name or defn) +GrB_Info GrB_BinaryOp_new ( GrB_BinaryOp *binaryop, // handle for the new binary operator GxB_binary_function function, // pointer to the binary function @@ -1479,12 +1388,8 @@ GrB_Info GRB (BinaryOp_new) GrB_Type xtype, // type of input x GrB_Type ytype // type of input y ) ; -#define GrB_BinaryOp_new(op,f,z,x,y) \ - GxB_BinaryOp_new(op,f,z,x,y, GB_STR(f), NULL) -#define GrM_BinaryOp_new(op,f,z,x,y) \ - GxM_BinaryOp_new(op,f,z,x,y, GB_STR(f), NULL) -// GxB_BinaryOp_new creates a named user-defined binary op. +// GxB_BinaryOp_new creates a named and defined user-defined binary op. GrB_Info GxB_BinaryOp_new ( GrB_BinaryOp *op, // handle for the new binary operator @@ -1496,41 +1401,13 @@ GrB_Info GxB_BinaryOp_new const char *binop_defn // definition of the user function ) ; -// NOTE: GxB_BinaryOp_ztype is historical. Use GxB_BinaryOp_ztype_name instead. -GrB_Info GxB_BinaryOp_ztype // return the type of z -( - GrB_Type *ztype, // return type of output z - GrB_BinaryOp binaryop // binary operator to query -) ; -GrB_Info GxB_BinaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; - -// NOTE: GxB_BinaryOp_xtype is historical. Use GxB_BinaryOp_xtype_name instead. -GrB_Info GxB_BinaryOp_xtype // return the type of x -( - GrB_Type *xtype, // return type of input x - GrB_BinaryOp binaryop // binary operator to query -) ; -GrB_Info GxB_BinaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; - -// NOTE: GxB_BinaryOp_ytype is historical. Use GxB_BinaryOp_ytype_name instead. -GrB_Info GxB_BinaryOp_ytype // return the type of y -( - GrB_Type *ytype, // return type of input y - GrB_BinaryOp binaryop // binary operator to query -) ; -GrB_Info GxB_BinaryOp_ytype_name // return the type_name of y -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_BinaryOp binaryop // binary operator to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_BinaryOp_ztype (GrB_Type *ztype, GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_ztype_name (char *type_name, const GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_xtype (GrB_Type *xtype, GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_xtype_name (char *type_name, const GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_ytype (GrB_Type *ytype, GrB_BinaryOp op) ; +GrB_Info GxB_BinaryOp_ytype_name (char *type_name, const GrB_BinaryOp op) ; GrB_Info GrB_BinaryOp_free // free a user-created binary operator ( @@ -1541,8 +1418,7 @@ GrB_Info GrB_BinaryOp_free // free a user-created binary operator // GxB_SelectOp: select operators (DEPRECATED: do not use) //============================================================================== -// GrB_select and GrB_IndexUnaryOp should be used instead of GxB_select. - +// historical; use GrB_select and GrB_IndexUnaryOp instead: typedef struct GB_SelectOp_opaque *GxB_SelectOp ; GB_GLOBAL GxB_SelectOp GxB_TRIL, GxB_TRIU, GxB_DIAG, GxB_OFFDIAG, GxB_NONZERO, GxB_EQ_ZERO, GxB_GT_ZERO, GxB_GE_ZERO, GxB_LT_ZERO, GxB_LE_ZERO, GxB_NE_THUNK, @@ -1569,12 +1445,9 @@ typedef void (*GxB_index_unary_function) const void *y // input scalar y ) ; -// GrB_IndexUnaryOp_new creates a user-defined unary op, with an automatic -// detection of the operator name. -#undef GrB_IndexUnaryOp_new -#undef GrM_IndexUnaryOp_new +// GrB_IndexUnaryOp_new creates a user-defined unary op (no name or defn) -GrB_Info GRB (IndexUnaryOp_new) // create a new user-defined IndexUnary op +GrB_Info GrB_IndexUnaryOp_new // create a new user-defined IndexUnary op ( GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator GxB_index_unary_function function, // pointer to IndexUnary function @@ -1583,11 +1456,6 @@ GrB_Info GRB (IndexUnaryOp_new) // create a new user-defined IndexUnary op GrB_Type ytype // type of input y (the scalar) ) ; -#define GrB_IndexUnaryOp_new(op,f,z,x,y) \ - GxB_IndexUnaryOp_new(op,f,z,x,y, GB_STR(f), NULL) -#define GrM_IndexUnaryOp_new(op,f,z,x,y) \ - GxM_IndexUnaryOp_new(op,f,z,x,y, GB_STR(f), NULL) - GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp ( GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator @@ -1599,26 +1467,10 @@ GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp const char *idxop_defn // definition of the user function ) ; -GrB_Info GxB_IndexUnaryOp_ztype_name // return the type_name of z -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // IndexUnary operator -) ; - -// For TRIL, TRIU, DIAG, OFFDIAG, COLLE, COLGT, ROWLE, and ROWGT, -// the xtype_name is an empty string (""), since these functions do not depend -// on the type of the matrix input. -GrB_Info GxB_IndexUnaryOp_xtype_name // return the type_name of x -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // select operator -) ; - -GrB_Info GxB_IndexUnaryOp_ytype_name // return the type_name of the scalary y -( - char *type_name, // user array of size GxB_MAX_NAME_LEN - const GrB_IndexUnaryOp op // select operator -) ; +// historical; use GrB_get instead: +GrB_Info GxB_IndexUnaryOp_ztype_name (char *, const GrB_IndexUnaryOp op) ; +GrB_Info GxB_IndexUnaryOp_xtype_name (char *, const GrB_IndexUnaryOp op) ; +GrB_Info GxB_IndexUnaryOp_ytype_name (char *, const GrB_IndexUnaryOp op) ; GrB_Info GrB_IndexUnaryOp_free // free a user-created IndexUnaryOp ( @@ -1820,14 +1672,12 @@ GrB_Info GrB_Monoid_new_UDT // create a monoid with a user-defined type // Type-generic method for creating a new monoid: /* - GrB_Info GrB_Monoid_new // create a monoid ( GrB_Monoid *monoid, // handle of monoid to create GrB_BinaryOp op, // binary operator of the monoid identity // identity value of the monoid ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -1960,7 +1810,6 @@ GrB_Info GxB_Monoid_terminal_new_UDT // create a monoid with a user type // Type-generic method for creating a new monoid with a terminal value: /* - GrB_Info GxB_Monoid_terminal_new // create a monoid ( GrB_Monoid *monoid, // handle of monoid to create @@ -1968,7 +1817,6 @@ GrB_Info GxB_Monoid_terminal_new // create a monoid identity, // identity value of the monoid terminal // terminal value of the monoid ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -1981,25 +1829,10 @@ GrB_Info GxB_Monoid_terminal_new // create a monoid (monoid, op, identity, terminal) #endif -GrB_Info GxB_Monoid_operator // return the monoid operator -( - GrB_BinaryOp *op, // returns the binary op of the monoid - GrB_Monoid monoid // monoid to query -) ; - -GrB_Info GxB_Monoid_identity // return the monoid identity -( - void *identity, // returns the identity of the monoid - GrB_Monoid monoid // monoid to query -) ; - -GrB_Info GxB_Monoid_terminal // return the monoid terminal -( - bool *has_terminal, // true if the monoid has a terminal value - void *terminal, // returns the terminal of the monoid, - // unmodified if has_terminal is false - GrB_Monoid monoid // monoid to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Monoid_operator (GrB_BinaryOp *op, GrB_Monoid monoid) ; +GrB_Info GxB_Monoid_identity (void *identity, GrB_Monoid monoid) ; +GrB_Info GxB_Monoid_terminal (bool *, void *terminal, GrB_Monoid monoid) ; GrB_Info GrB_Monoid_free // free a user-created monoid ( @@ -2019,17 +1852,9 @@ GrB_Info GrB_Semiring_new // create a semiring GrB_BinaryOp multiply // multiply operator of the semiring ) ; -GrB_Info GxB_Semiring_add // return the add monoid of a semiring -( - GrB_Monoid *add, // returns add monoid of the semiring - GrB_Semiring semiring // semiring to query -) ; - -GrB_Info GxB_Semiring_multiply // return multiply operator of a semiring -( - GrB_BinaryOp *multiply, // returns multiply operator of the semiring - GrB_Semiring semiring // semiring to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Semiring_add (GrB_Monoid *add, GrB_Semiring semiring) ; +GrB_Info GxB_Semiring_multiply (GrB_BinaryOp *multiply, GrB_Semiring semiring) ; GrB_Info GrB_Semiring_free // free a user-created semiring ( @@ -2040,9 +1865,6 @@ GrB_Info GrB_Semiring_free // free a user-created semiring // GrB_Scalar: a GraphBLAS scalar //============================================================================== -// GxB_Scalar has become GrB_Scalar. The older name GxB_Scalar is kept as -// historical, but GrB_Scalar should be used instead. - typedef struct GB_Scalar_opaque *GxB_Scalar ; // historical: use GrB_Scalar typedef struct GB_Scalar_opaque *GrB_Scalar ; // use this instead @@ -2072,18 +1894,9 @@ GrB_Info GrB_Scalar_nvals // get the number of entries in a GrB_Scalar const GrB_Scalar s // GrB_Scalar to query ) ; -// NOTE: GxB_Scalar_type is historical. Use GxB_Scalar_type_name instead. -GrB_Info GxB_Scalar_type // get the type of a GrB_Scalar -( - GrB_Type *type, // returns the type of the GrB_Scalar - const GrB_Scalar s // GrB_Scalar to query -) ; -GrB_Info GxB_Scalar_type_name // return the name of the type of a scalar -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Scalar s // GrB_Scalar to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Scalar_type (GrB_Type *type, const GrB_Scalar s) ; +GrB_Info GxB_Scalar_type_name (char *type_name, const GrB_Scalar s) ; GrB_Info GxB_Scalar_memoryUsage // return # of bytes used for a scalar ( @@ -2212,13 +2025,11 @@ GrB_Info GxB_Scalar_setElement_UDT (GrB_Scalar s, void *x) ; // user-defined type. /* - GrB_Info GrB_Scalar_setElement // s = x ( GrB_Scalar s, // GrB_Scalar to modify x // user scalar to assign to s ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -2230,6 +2041,7 @@ GrB_Info GrB_Scalar_setElement // s = x ) \ (s, x) +// historical; use GrB_Scalar_setElement instead: #define GxB_Scalar_setElement(s,x) GrB_Scalar_setElement (s, x) #endif @@ -2360,6 +2172,7 @@ GrB_Info GrB_Scalar_extractElement // x = s ) \ (x, s) +// historical; use GrB_Scalar_extractElement instead: #define GxB_Scalar_extractElement(x,s) GrB_Scalar_extractElement (x, s) #endif @@ -2403,18 +2216,9 @@ GrB_Info GrB_Vector_nvals // get the number of entries in a vector const GrB_Vector v // vector to query ) ; -// NOTE: GxB_Vector_type is historical. Use GxB_Vector_type_name instead. -GrB_Info GxB_Vector_type // get the type of a vector -( - GrB_Type *type, // returns the type of the vector - const GrB_Vector v // vector to query -) ; -GrB_Info GxB_Vector_type_name // return the name of the type of a vector -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Vector v // vector to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Vector_type (GrB_Type *type, const GrB_Vector v) ; +GrB_Info GxB_Vector_type_name (char *type_name, const GrB_Vector v) ; GrB_Info GxB_Vector_memoryUsage // return # of bytes used for a vector ( @@ -2578,7 +2382,6 @@ GrB_Info GxB_Vector_build_Scalar // build a vector from (i,scalar) tuples // for a user-defined type. /* - GrB_Info GrB_Vector_build // build a vector from (I,X) tuples ( GrB_Vector w, // vector to build @@ -2587,7 +2390,6 @@ GrB_Info GrB_Vector_build // build a vector from (I,X) tuples GrB_Index nvals, // number of tuples const GrB_BinaryOp dup // binary function to assemble duplicates ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -2716,14 +2518,12 @@ GrB_Info GrB_Vector_setElement_Scalar // w(i) = x // user-defined type. /* - GrB_Info GrB_Vector_setElement // w(i) = x ( GrB_Vector w, // vector to modify x, // scalar to assign to w(i) GrB_Index i // row index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -2853,14 +2653,12 @@ GrB_Info GrB_Vector_extractElement_Scalar // x = v(i) // for a user-defined type. /* - GrB_Info GrB_Vector_extractElement // x = v(i) ( *x, // scalar extracted const GrB_Vector v, // vector to extract an entry from GrB_Index i // row index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3021,7 +2819,6 @@ GrB_Info GrB_Vector_extractTuples_UDT // [I,~,X] = find (v) // for a user-defined type. /* - GrB_Info GrB_Vector_extractTuples // [I,~,X] = find (v) ( GrB_Index *Ilist, // array for returning row indices of tuples @@ -3029,11 +2826,10 @@ GrB_Info GrB_Vector_extractTuples // [I,~,X] = find (v) GrB_Index *nvals, // I, X size on input; # tuples on output const GrB_Vector v // vector to extract tuples from ) ; - */ #if GxB_STDC_VERSION >= 201112L -#define GrB_Vector_extractTuples(Ilist,X,nvals,v) \ +#define GrB_Vector_extractTuples(Ilist,X,nvals,v) \ _Generic \ ( \ (X), \ @@ -3088,18 +2884,9 @@ GrB_Info GrB_Matrix_nvals // get the number of entries in a matrix const GrB_Matrix A // matrix to query ) ; -// NOTE: GxB_Matrix_type is historical. Use GxB_Matrix_type_name instead. -GrB_Info GxB_Matrix_type // get the type of a matrix -( - GrB_Type *type, // returns the type of the matrix - const GrB_Matrix A // matrix to query -) ; -GrB_Info GxB_Matrix_type_name // return the name of the type of a matrix -( - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - const GrB_Matrix A // matrix to query -) ; +// historical; use GrB_get instead: +GrB_Info GxB_Matrix_type (GrB_Type *type, const GrB_Matrix A) ; +GrB_Info GxB_Matrix_type_name (char *type_name, const GrB_Matrix A) ; GrB_Info GxB_Matrix_memoryUsage // return # of bytes used for a matrix ( @@ -3128,7 +2915,7 @@ GrB_Info GrB_Matrix_free // free a matrix GrB_Info GrB_Matrix_build_BOOL // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const bool *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3138,7 +2925,7 @@ GrB_Info GrB_Matrix_build_BOOL // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT8 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int8_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3148,7 +2935,7 @@ GrB_Info GrB_Matrix_build_INT8 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT8 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint8_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3158,7 +2945,7 @@ GrB_Info GrB_Matrix_build_UINT8 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT16 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int16_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3168,7 +2955,7 @@ GrB_Info GrB_Matrix_build_INT16 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT16 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint16_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3178,7 +2965,7 @@ GrB_Info GrB_Matrix_build_UINT16 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int32_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3188,7 +2975,7 @@ GrB_Info GrB_Matrix_build_INT32 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint32_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3198,7 +2985,7 @@ GrB_Info GrB_Matrix_build_UINT32 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_INT64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const int64_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3208,7 +2995,7 @@ GrB_Info GrB_Matrix_build_INT64 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UINT64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const uint64_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3218,7 +3005,7 @@ GrB_Info GrB_Matrix_build_UINT64 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_FP32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const float *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3228,7 +3015,7 @@ GrB_Info GrB_Matrix_build_FP32 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_FP64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const double *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3238,7 +3025,7 @@ GrB_Info GrB_Matrix_build_FP64 // build a matrix from (I,J,X) tuples GrB_Info GxB_Matrix_build_FC32 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const GxB_FC32_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3248,7 +3035,7 @@ GrB_Info GxB_Matrix_build_FC32 // build a matrix from (I,J,X) tuples GrB_Info GxB_Matrix_build_FC64 // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const GxB_FC64_t *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3258,7 +3045,7 @@ GrB_Info GxB_Matrix_build_FC64 // build a matrix from (I,J,X) tuples GrB_Info GrB_Matrix_build_UDT // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const void *X, // array of values of tuples GrB_Index nvals, // number of tuples @@ -3268,7 +3055,7 @@ GrB_Info GrB_Matrix_build_UDT // build a matrix from (I,J,X) tuples GrB_Info GxB_Matrix_build_Scalar // build a matrix from (I,J,scalar) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples GrB_Scalar scalar, // value for all tuples GrB_Index nvals // number of tuples @@ -3278,21 +3065,19 @@ GrB_Info GxB_Matrix_build_Scalar // build a matrix from (I,J,scalar) tuples // for a user-defined type. /* - GrB_Info GrB_Matrix_build // build a matrix from (I,J,X) tuples ( GrB_Matrix C, // matrix to build - const GrB_Index *Ilist, // array of row indices of tuples + const GrB_Index *Ilist, // array of row indices of tuples const GrB_Index *J, // array of column indices of tuples const *X, // array of values of tuples GrB_Index nvals, // number of tuples const GrB_BinaryOp dup // binary function to assemble duplicates ) ; - */ #if GxB_STDC_VERSION >= 201112L -#define GrB_Matrix_build(C,Ilist,J,X,nvals,dup) \ +#define GrB_Matrix_build(C,Ilist,J,X,nvals,dup) \ _Generic \ ( \ (X), \ @@ -3432,7 +3217,6 @@ GrB_Info GrB_Matrix_setElement_Scalar // C (i,j) = x // user-defined type. /* - GrB_Info GrB_Matrix_setElement // C (i,j) = x ( GrB_Matrix C, // matrix to modify @@ -3440,7 +3224,6 @@ GrB_Info GrB_Matrix_setElement // C (i,j) = x GrB_Index i, // row index GrB_Index j // column index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3585,7 +3368,6 @@ GrB_Info GrB_Matrix_extractElement_Scalar // x = A(i,j) // for a user-defined type. /* - GrB_Info GrB_Matrix_extractElement // x = A(i,j) ( *x, // extracted scalar @@ -3593,7 +3375,6 @@ GrB_Info GrB_Matrix_extractElement // x = A(i,j) GrB_Index i, // row index GrB_Index j // column index ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3770,7 +3551,6 @@ GrB_Info GrB_Matrix_extractTuples_UDT // [I,J,X] = find (A) // for a user-defined type. /* - GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A) ( GrB_Index *Ilist, // array for returning row indices of tuples @@ -3779,7 +3559,6 @@ GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A) GrB_Index *nvals, // I,J,X size on input; # tuples on output const GrB_Matrix A // matrix to extract tuples from ) ; - */ #if GxB_STDC_VERSION >= 201112L @@ -3819,7 +3598,7 @@ GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A) // ncols(A{i,j}) for all i). // The type of C is unchanged, and all matrices A{i,j} are typecasted into the -// type of C. Any settings made to C by GxB_Matrix_Option_set (format by row +// type of C. Any settings made to C by GrB_set (format by row // or by column, bitmap switch, hyper switch, and sparsity control) are // unchanged. @@ -3877,7 +3656,7 @@ GrB_Info GrB_Matrix_diag // build a diagonal matrix from a vector // already exist on input, of the correct size. Any existing entries in C are // discarded. The type of C is preserved, so that if the type of C and v // differ, the entries are typecasted into the type of C. Any settings made to -// C by GxB_Matrix_Option_set (format by row or by column, bitmap switch, hyper +// C by GrB_set (format by row or by column, bitmap switch, hyper // switch, and sparsity control) are unchanged. GrB_Info GxB_Matrix_diag // construct a diagonal matrix from a vector @@ -3902,7 +3681,7 @@ GrB_Info GxB_Matrix_diag // construct a diagonal matrix from a vector // the range -1 to -m+1. Any existing entries in v are discarded. The type of // v is preserved, so that if the type of A and v differ, the entries are // typecasted into the type of v. Any settings made to v by -// GxB_Vector_Option_set (bitmap switch and sparsity control) are unchanged. +// GrB_set (bitmap switch and sparsity control) are unchanged. GrB_Info GxB_Vector_diag // extract a diagonal from a matrix, as a vector ( @@ -3917,60 +3696,58 @@ GrB_Info GxB_Vector_diag // extract a diagonal from a matrix, as a vector //============================================================================== // The following options modify how SuiteSparse:GraphBLAS stores and operates -// on its matrices. The GxB_*Option* methods allow the user to suggest how the +// on its matrices. The GrB_get/set methods allow the user to suggest how the // internal representation of a matrix, or all matrices, should be held. These // options have no effect on the result (except for minor roundoff differences // for floating-point types). They only affect the time and memory usage of the // computations. -// GxB_Matrix_Option_set: sets an option for a specific matrix -// GxB_Matrix_Option_get: queries the current option of a specific matrix -// GxB_Vector_Option_set: sets an option for a specific vector -// GxB_Vector_Option_get: queries the current option of a specific vector -// GxB_Global_Option_set: sets an option for all future matrices -// GxB_Global_Option_get: queries current option for all future matrices - typedef enum // for global options or matrix options { //------------------------------------------------------------ - // for GxB_Matrix_Option_get/set and GxB_Global_Option_get/set: + // GrB_get / GrB_set for GrB_Matrix and GrB_GLOBAL: //------------------------------------------------------------ GxB_HYPER_SWITCH = 7000, // switch to hypersparse (double value) + GxB_HYPER_HASH = 7048, // hyper_hash control (int64 value) GxB_BITMAP_SWITCH = 7001, // switch to bitmap (double value) - GxB_FORMAT = 7002, // CSR/CSC format: GxB_BY_ROW or GxB_BY_COL + GxB_FORMAT = 7002, // historical; use GrB_STORAGE_ORIENTATION_HINT //------------------------------------------------------------ - // for GxB_Global_Option_get only: + // GrB_get for GrB_GLOBAL: //------------------------------------------------------------ - GxB_MODE = 7003, // mode passed to GrB_init - GxB_LIBRARY_NAME = 7004, // name of the library (char *) - GxB_LIBRARY_VERSION = 7005, // library version (3 int's) + GxB_MODE = 7003, // historical; use GrB_BLOCKING_MODE + GxB_LIBRARY_NAME = 7004, // historical; use GrB_NAME + GxB_LIBRARY_VERSION = 7005, // historical; use GrB_LIBRARY_VER_* GxB_LIBRARY_DATE = 7006, // date of the library (char *) GxB_LIBRARY_ABOUT = 7007, // about the library (char *) GxB_LIBRARY_URL = 7008, // URL for the library (char *) GxB_LIBRARY_LICENSE = 7009, // license of the library (char *) GxB_LIBRARY_COMPILE_DATE = 7010, // date library was compiled (char *) GxB_LIBRARY_COMPILE_TIME = 7011, // time library was compiled (char *) - GxB_API_VERSION = 7012, // API version (3 int's) + GxB_API_VERSION = 7012, // historical; use GrB_API_VER_* GxB_API_DATE = 7013, // date of the API (char *) GxB_API_ABOUT = 7014, // about the API (char *) GxB_API_URL = 7015, // URL for the API (char *) GxB_COMPILER_VERSION = 7016, // compiler version (3 int's) GxB_COMPILER_NAME = 7017, // compiler name (char *) GxB_LIBRARY_OPENMP = 7018, // library compiled with OpenMP + GxB_MALLOC_FUNCTION = 7037, // malloc function pointer + GxB_CALLOC_FUNCTION = 7038, // calloc function pointer + GxB_REALLOC_FUNCTION = 7039, // realloc function pointer + GxB_FREE_FUNCTION = 7040, // free function pointer //------------------------------------------------------------ - // for GxB_Global_Option_get/set only: + // GrB_get / GrB_set for GrB_GLOBAL: //------------------------------------------------------------ GxB_GLOBAL_NTHREADS = GxB_NTHREADS, // max number of threads to use GxB_GLOBAL_CHUNK = GxB_CHUNK, // chunk size for small problems. GxB_GLOBAL_GPU_ID = GxB_GPU_ID, // which GPU to use (DRAFT) - GxB_BURBLE = 7019, // diagnostic output (bool *) + GxB_BURBLE = 7019, // diagnostic output GxB_PRINTF = 7020, // printf function diagnostic output GxB_FLUSH = 7021, // flush function diagnostic output GxB_MEMORY_POOL = 7022, // no longer used @@ -3988,27 +3765,18 @@ typedef enum // for global options or matrix options GxB_JIT_ERROR_LOG = 7033, // CPU JIT: error log file //------------------------------------------------------------ - // for GxB_Matrix_Option_get only: + // GrB_get for GrB_Matrix: //------------------------------------------------------------ GxB_SPARSITY_STATUS = 7034, // hyper, sparse, bitmap or full (1,2,4,8) GxB_IS_HYPER = 7035, // historical; use GxB_SPARSITY_STATUS //------------------------------------------------------------ - // for GxB_Matrix_Option_get/set only: + // GrB_get/GrB_set for GrB_Matrix: //------------------------------------------------------------ GxB_SPARSITY_CONTROL = 7036, // sparsity control: 0 to 15; see below - //------------------------------------------------------------ - // memory functions (GxB_Global_Option_get only): - //------------------------------------------------------------ - - GxB_MALLOC_FUNCTION = 7037, - GxB_CALLOC_FUNCTION = 7038, - GxB_REALLOC_FUNCTION = 7039, - GxB_FREE_FUNCTION = 7040, - } GxB_Option_Field ; // for GxB_JIT_C_CONTROL: @@ -4022,7 +3790,7 @@ typedef enum } GxB_JIT_Control ; -// GxB_FORMAT can be by row or by column: +// GxB_FORMAT is historical, but it can be by row or by column: typedef enum { GxB_BY_ROW = 0, // CSR: compressed sparse row format @@ -4055,7 +3823,7 @@ GB_GLOBAL const double GxB_HYPER_DEFAULT ; // the default sparsity control is any format: #define GxB_AUTO_SPARSITY GxB_ANY_SPARSITY -// GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, scontrol) provides hints +// GrB_set (A, scontrol, GxB_SPARSITY_CONTROL) provides hints // about which data structure GraphBLAS should use for the matrix A: // // GxB_AUTO_SPARSITY: GraphBLAS selects automatically. @@ -4078,11 +3846,11 @@ GB_GLOBAL const double GxB_HYPER_DEFAULT ; // formats can be bitwise negated. For example, to allow for any format // except full, use ~GxB_FULL. // -// GxB_Matrix_Option_get (A, GxB_SPARSITY_STATUS, &sparsity) returns the +// GrB_get (A, &sparsity, GxB_SPARSITY_STATUS) returns the // current data structure currently used for the matrix A (either hypersparse, // sparse, bitmap, or full). // -// GxB_Matrix_Option_get (A, GxB_SPARSITY_CONTROL, &scontrol) returns the hint +// GrB_get (A, &scontrol, GxB_SPARSITY_CONTROL) returns the hint // for how A should be stored (hypersparse, sparse, bitmap, or full, or any // combination). @@ -4113,183 +3881,6 @@ GB_GLOBAL const double GxB_HYPER_DEFAULT ; GB_GLOBAL const double GxB_ALWAYS_HYPER, GxB_NEVER_HYPER ; -GrB_Info GxB_Matrix_Option_set // set an option in a matrix -( - GrB_Matrix A, // matrix to modify - GxB_Option_Field field, // option to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix -( - GrB_Matrix A, // matrix to query - GxB_Option_Field field, // option to query - ... // return value of the matrix option -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Vector_Option_set // set an option in a vector -( - GrB_Vector A, // vector to modify - GxB_Option_Field field, // option to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Vector_Option_get // gets the current option of a vector -( - GrB_Vector A, // vector to query - GxB_Option_Field field, // option to query - ... // return value of the vector option -) ; - -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 -) ; - -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: -// -// GxB_Global_Option_set (GxB_HYPER_SWITCH, GxB_HYPER_DEFAULT) ; -// GxB_Global_Option_set (GxB_BITMAP_SWITCH, NULL) ; -// GxB_Global_Option_set (GxB_FORMAT, GxB_FORMAT_DEFAULT) ; -// -// The compile-time constants GxB_HYPER_DEFAULT and GxB_FORMAT_DEFAULT are -// equal to 0.0625 and GxB_BY_ROW, by default. That is, by default, all new -// matrices are held by row in CSR format. If a matrix has fewer than n/16 -// columns, it can be converted to hypersparse structure. If it has more than -// n/8 columns, it can be converted to a sparse structure. Modifying these -// global settings via GxB_Global_Option_set has no effect on matrices already -// created. - -GrB_Info GxB_Global_Option_set // set a global default option -( - GxB_Option_Field field, // option to change - ... // value to change it to -) ; - -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 -) ; - -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 -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Global_Option_set_CHAR // set a global default option -( - GxB_Option_Field field, // option to change - const char *value // value to change it to -) ; - -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 -) ; - -GrB_Info GxB_Global_Option_get // gets the current global default option -( - GxB_Option_Field field, // option to query - ... // return value of the global option -) ; - -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 -) ; - -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 -) ; - -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 -) ; - -GrB_Info GxB_Global_Option_get_CHAR // gets the current global option -( - GxB_Option_Field field, // option to query - const char **value // return value of the global option -) ; - -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_Context: for managing computational resources //============================================================================== @@ -4322,48 +3913,6 @@ GrB_Info GxB_Context_free // free a Context GxB_Context *Context // handle of Context to free ) ; -GrB_Info GxB_Context_set_INT32 // set a parameter in a Context -( - GxB_Context Context, // Context to modify - GxB_Context_Field field, // parameter to change - int32_t value // value to change it to -) ; - -GrB_Info GxB_Context_set_FP64 // set a parameter in a Context -( - GxB_Context Context, // Context to modify - GxB_Context_Field field, // parameter to change - double value // value to change it to -) ; - -GrB_Info GxB_Context_set // set a parameter in a Context -( - GxB_Context Context, // Context to modify - GxB_Context_Field field, // parameter to change - ... // value to change it to -) ; - -GrB_Info GxB_Context_get_INT32 // get a parameter of a Context -( - GxB_Context Context, // Context to query - GxB_Context_Field field, // parameter to query - int32_t *value // return value from the Context -) ; - -GrB_Info GxB_Context_get_FP64 // get a parameter in a Context -( - GxB_Context Context, // Context to query - GxB_Context_Field field, // parameter to query - double *value // return value from the Context -) ; - -GrB_Info GxB_Context_get // get a parameter in a Context -( - GxB_Context Context, // Context to query - GxB_Context_Field field, // parameter to query - ... // return value of the descriptor -) ; - GrB_Info GxB_Context_engage // engage a Context ( GxB_Context Context // Context to engage @@ -4375,152 +3924,41 @@ GrB_Info GxB_Context_disengage // disengage a Context ) ; //============================================================================== -// GxB_set and GxB_get +// GxB_set and GxB_get: historical; use GrB_set and GrB_get instead //============================================================================== -// The simplest way to set/get a value of a GrB_Descriptor is with -// the generic GxB_set and GxB_get functions: - -// GxB_set (desc, field, value) ; -// GxB_get (desc, field, &value) ; - -// GxB_set and GxB_get are generic methods that and set or query the options in -// a GrB_Matrix, a GrB_Descriptor, or in the global options. They can be used -// with the following syntax. - -// To set/get the global options: -// -// GxB_set (GxB_HYPER_SWITCH, double h) ; -// GxB_set (GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ; -// GxB_set (GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; -// GxB_get (GxB_HYPER_SWITCH, double *h) ; -// -// double b [GxB_NBITMAP_SWITCH] ; -// GxB_set (GxB_BITMAP_SWITCH, b) ; -// GxB_set (GxB_BITMAP_SWITCH, NULL) ; // set defaults -// GxB_get (GxB_BITMAP_SWITCH, b) ; -// -// GxB_set (GxB_FORMAT, GxB_BY_ROW) ; -// GxB_set (GxB_FORMAT, GxB_BY_COL) ; -// GxB_get (GxB_FORMAT, GxB_Format_Value *s) ; -// -// GxB_set (GxB_NTHREADS, nthreads_max) ; -// GxB_get (GxB_NTHREADS, int *nthreads_max) ; -// -// GxB_set (GxB_CHUNK, double chunk) ; -// GxB_get (GxB_CHUNK, double *chunk) ; -// -// GxB_set (GxB_BURBLE, bool burble) ; -// GxB_get (GxB_BURBLE, bool *burble) ; -// -// GxB_set (GxB_PRINTF, void *printf_function) ; -// GxB_get (GxB_PRINTF, void **printf_function) ; -// -// GxB_set (GxB_FLUSH, void *flush_function) ; -// GxB_get (GxB_FLUSH, void **flush_function) ; - -// GxB_set (GxB_JIT_C_COMPILER_NAME, const char *compiler) ; -// GxB_get (GxB_JIT_C_COMPILER_NAME, const char **compiler) ; -// GxB_set (GxB_JIT_C_COMPILER_FLAGS, const char *flags) ; -// GxB_get (GxB_JIT_C_COMPILER_FLAGS, const char **flags) ; -// GxB_set (GxB_JIT_C_LINKER_FLAGS, const char *flags) ; -// GxB_get (GxB_JIT_C_LINKER_FLAGS, const char **flags) ; -// GxB_set (GxB_JIT_CACHE_PATH, const char *cache_path) ; -// GxB_get (GxB_JIT_CACHE_PATH, const char **cache_path) ; -// GxB_set (GxB_JIT_C_CONTROL, int control) ; -// GxB_get (GxB_JIT_C_CONTROL, int *control) ; - -// To set/get the GxB_CONTEXT_WORLD options: These have the same effect as -// the global set/get for NTHREADS and CHUNK, listed above. -// -// GxB_set (GxB_CONTEXT_WORLD, GxB_NTHREADS, nthreads_max) ; -// GxB_get (GxB_CONTEXT_WORLD, GxB_NTHREADS, int *nthreads_max) ; -// -// GxB_set (GxB_CONTEXT_WORLD, GxB_CHUNK, double chunk) ; -// GxB_get (GxB_CONTEXT_WORLD, GxB_CHUNK, double *chunk) ; - -// To set/get a Context option: -// -// GxB_set (GxB_Context Context, GxB_NTHREADS, nthreads_max) ; -// GxB_get (GxB_Context Context, GxB_NTHREADS, int *nthreads_max) ; -// -// GxB_set (GxB_Context Context, GxB_CHUNK, double chunk) ; -// GxB_get (GxB_Context Context, GxB_CHUNK, double *chunk) ; - -// To get global options that can be queried but not modified: -// -// GxB_get (GxB_MODE, GrB_Mode *mode) ; - -// To set/get a matrix option: -// -// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, double h) ; -// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ; -// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ; -// GxB_get (GrB_Matrix A, GxB_HYPER_SWITCH, double *h) ; -// -// GxB_set (GrB_Matrix A, GxB_BITMAP_SWITCH, double b) ; -// GxB_get (GrB_Matrix A, GxB_BITMAP_SWITCH, double *b) ; -// -// GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_ROW) ; -// GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_COL) ; -// GxB_get (GrB_Matrix A, GxB_FORMAT, GxB_Format_Value *s) ; -// -// GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ; -// GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, scontrol) ; -// GxB_get (GrB_Matrix A, GxB_SPARSITY_CONTROL, int *scontrol) ; -// -// GxB_get (GrB_Matrix A, GxB_SPARSITY_STATUS, int *sparsity) ; - -// To set/get a vector option or status: -// -// GxB_set (GrB_Vector v, GxB_BITMAP_SWITCH, double b) ; -// GxB_get (GrB_Vector v, GxB_BITMAP_SWITCH, double *b) ; -// -// GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_ROW) ; -// GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_COL) ; -// GxB_get (GrB_Vector v, GxB_FORMAT, GxB_Format_Value *s) ; -// -// GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ; -// GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, scontrol) ; -// GxB_get (GrB_Vector v, GxB_SPARSITY_CONTROL, int *scontrol) ; -// -// GxB_get (GrB_Vector v, GxB_SPARSITY_STATUS, int *sparsity) ; - -// To set/get a descriptor field: -// -// GxB_set (GrB_Descriptor d, GrB_OUTP, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_OUTP, GrB_REPLACE) ; -// GxB_get (GrB_Descriptor d, GrB_OUTP, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GrB_MASK, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP) ; -// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_STRUCTURE) ; -// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP + GrB_STRUCTURE) ; -// GxB_get (GrB_Descriptor d, GrB_MASK, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GrB_INP0, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_INP0, GrB_TRAN) ; -// GxB_get (GrB_Descriptor d, GrB_INP0, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GrB_INP1, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GrB_INP1, GrB_TRAN) ; -// GxB_get (GrB_Descriptor d, GrB_INP1, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_DEFAULT) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_GUSTAVSON) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_HASH) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_SAXPY) ; -// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_DOT) ; -// GxB_get (GrB_Descriptor d, GrB_AxB_METHOD, GrB_Desc_Value *v) ; -// -// GxB_set (GrB_Descriptor d, GxB_SORT, int sort) ; -// GxB_get (GrB_Descriptor d, GxB_SORT, int *sort) ; -// -// GxB_set (GrB_Descriptor d, GxB_COMPRESSION, int method) ; -// GxB_get (GrB_Descriptor d, GxB_COMPRESSION, int *method) ; -// -// GxB_set (GrB_Descriptor d, GxB_IMPORT, int method) ; -// GxB_get (GrB_Descriptor d, GxB_IMPORT, int *method) ; +// historical: use GrB_set and GrB_get instead of these methods: +GrB_Info GxB_Matrix_Option_set (GrB_Matrix, GxB_Option_Field, ...) ; +GrB_Info GxB_Matrix_Option_set_INT32 (GrB_Matrix, GxB_Option_Field, int32_t) ; +GrB_Info GxB_Matrix_Option_set_FP64 (GrB_Matrix, GxB_Option_Field, double) ; +GrB_Info GxB_Matrix_Option_get (GrB_Matrix, GxB_Option_Field, ...) ; +GrB_Info GxB_Matrix_Option_get_INT32 (GrB_Matrix, GxB_Option_Field, int32_t *) ; +GrB_Info GxB_Matrix_Option_get_FP64 (GrB_Matrix, GxB_Option_Field, double *) ; +GrB_Info GxB_Vector_Option_set (GrB_Vector, GxB_Option_Field, ...) ; +GrB_Info GxB_Vector_Option_set_INT32 (GrB_Vector, GxB_Option_Field, int32_t) ; +GrB_Info GxB_Vector_Option_set_FP64 (GrB_Vector, GxB_Option_Field, double) ; +GrB_Info GxB_Vector_Option_get (GrB_Vector, GxB_Option_Field, ...) ; +GrB_Info GxB_Vector_Option_get_INT32 (GrB_Vector, GxB_Option_Field, int32_t *) ; +GrB_Info GxB_Vector_Option_get_FP64 (GrB_Vector, GxB_Option_Field, double *) ; +GrB_Info GxB_Global_Option_set (GxB_Option_Field, ...) ; +GrB_Info GxB_Global_Option_set_INT32 (GxB_Option_Field, int32_t) ; +GrB_Info GxB_Global_Option_set_FP64 (GxB_Option_Field, double) ; +GrB_Info GxB_Global_Option_set_FP64_ARRAY (GxB_Option_Field, double *) ; +GrB_Info GxB_Global_Option_set_INT64_ARRAY (GxB_Option_Field, int64_t *) ; +GrB_Info GxB_Global_Option_set_CHAR (GxB_Option_Field, const char *) ; +GrB_Info GxB_Global_Option_set_FUNCTION (GxB_Option_Field, void *) ; +GrB_Info GxB_Global_Option_get (GxB_Option_Field, ...) ; +GrB_Info GxB_Global_Option_get_INT32 (GxB_Option_Field, int32_t *) ; +GrB_Info GxB_Global_Option_get_FP64 (GxB_Option_Field, double *) ; +GrB_Info GxB_Global_Option_get_INT64 (GxB_Option_Field, int64_t *) ; +GrB_Info GxB_Global_Option_get_CHAR (GxB_Option_Field, const char **) ; +GrB_Info GxB_Global_Option_get_FUNCTION (GxB_Option_Field, void **) ; +GrB_Info GxB_Context_set_INT32 (GxB_Context, GxB_Context_Field, int32_t) ; +GrB_Info GxB_Context_set_FP64 (GxB_Context, GxB_Context_Field, double) ; +GrB_Info GxB_Context_set (GxB_Context, GxB_Context_Field, ...) ; +GrB_Info GxB_Context_get_INT32 (GxB_Context, GxB_Context_Field, int32_t *) ; +GrB_Info GxB_Context_get_FP64 (GxB_Context, GxB_Context_Field, double *) ; +GrB_Info GxB_Context_get (GxB_Context, GxB_Context_Field, ...) ; #if GxB_STDC_VERSION >= 201112L #define GxB_set(arg1,...) \ @@ -4550,6 +3988,518 @@ GrB_Info GxB_Context_disengage // disengage a Context (arg1, __VA_ARGS__) #endif +//============================================================================== +// GrB_set and GrB_get +//============================================================================== + +typedef struct GB_Global_opaque *GrB_Global ; +GB_GLOBAL const GrB_Global GrB_GLOBAL ; + +typedef enum +{ + + //-------------------------------------------------------------------------- + // GrB enums in the C API + //-------------------------------------------------------------------------- + + // GrB_Descriptor only: + GrB_OUTP_FIELD = 0, // descriptor for output of a method + GrB_MASK_FIELD = 1, // descriptor for the mask input of a method + GrB_INP0_FIELD = 2, // descriptor for the first input of a method + GrB_INP1_FIELD = 3, // descriptor for the second input of a method + + // all objects, including GrB_GLOBAL: + GrB_NAME = 10, // name of the object, as a string + + // GrB_GLOBAL only: + GrB_LIBRARY_VER_MAJOR = 11, // SuiteSparse:GraphBLAS version + GrB_LIBRARY_VER_MINOR = 12, + GrB_LIBRARY_VER_PATCH = 13, + GrB_API_VER_MAJOR = 14, // C API version + GrB_API_VER_MINOR = 15, + GrB_API_VER_PATCH = 16, + GrB_BLOCKING_MODE = 17, // GrB_Mode + + // GrB_GLOBAL, GrB_Matrix, GrB_Vector, GrB_Scalar: + GrB_STORAGE_ORIENTATION_HINT = 100, // GrB_Orientation + + // GrB_Matrix, GrB_Vector, GrB_Scalar (and void * serialize): + GrB_EL_TYPE_CODE = 102, // a GrB_Type_code (see below) + GrB_EL_TYPE_STRING = 106, // name of the type + + // GrB_*Op, GrB_Monoid, and GrB_Semiring: + GrB_INP0_TYPE_CODE = 103, // GrB_Type_code + GrB_INP1_TYPE_CODE = 104, + GrB_OUTP_TYPE_CODE = 105, + GrB_INP0_TYPE_STRING = 107, // name of the type, as a string + GrB_INP1_TYPE_STRING = 108, + GrB_OUTP_TYPE_STRING = 109, + + // GrB_Type (readable only): + GrB_SIZE = 110, // size of the type + + //-------------------------------------------------------------------------- + // SuiteSparse extensions: + //-------------------------------------------------------------------------- + + // GrB_Type, GrB_UnaryOp, GrB_BinaryOp, and GrB_IndexUnaryOp: + GxB_JIT_C_NAME = 7041, // C type or function name + GxB_JIT_C_DEFINITION = 7042, // C typedef or function definition + + // GrB_Monoid and GrB_Semiring: + GxB_MONOID_IDENTITY = 7043, // monoid identity value + GxB_MONOID_TERMINAL = 7044, // monoid terminal value + GxB_MONOID_OPERATOR = 7045, // monoid binary operator + + // GrB_Semiring only: + GxB_SEMIRING_MONOID = 7046, // semiring monoid + GxB_SEMIRING_MULTIPLY = 7047, // semiring multiplicative op +} +GrB_Field ; + +typedef enum +{ + GrB_ROWMAJOR = 0, + GrB_COLMAJOR = 1, + GrB_BOTH = 2, + GrB_UNKNOWN = 3, +} +GrB_Orientation ; + +typedef enum +{ + GrB_UDT_CODE = 0, // user-defined type + GrB_BOOL_CODE = 1, // GraphBLAS: GrB_BOOL C: bool + GrB_INT8_CODE = 2, // GraphBLAS: GrB_INT8 C: int8_t + GrB_UINT8_CODE = 3, // GraphBLAS: GrB_UINT8 C: uint8_t + GrB_INT16_CODE = 4, // GraphBLAS: GrB_INT16 C: int16_t + GrB_UINT16_CODE = 5, // GraphBLAS: GrB_UINT16 C: uint16_t + GrB_INT32_CODE = 6, // GraphBLAS: GrB_INT32 C: int32_t + GrB_UINT32_CODE = 7, // GraphBLAS: GrB_UINT32 C: uint32_t + GrB_INT64_CODE = 8, // GraphBLAS: GrB_INT64 C: int64_t + GrB_UINT64_CODE = 9, // GraphBLAS: GrB_UINT64 C: uint64_t + GrB_FP32_CODE = 10, // GraphBLAS: GrB_FP32 C: float + GrB_FP64_CODE = 11, // GraphBLAS: GrB_FP64 C: double + GxB_FC32_CODE = 7070, // GraphBLAS: GxB_FC32 C: float complex + GxB_FC64_CODE = 7071, // GraphBLAS: GxB_FC64 C: double complex +} +GrB_Type_Code ; + +//------------------------------------------------------------------------------ +// GrB_get: get a scalar, string, enum, size, or void * from an object +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_Scalar (GrB_Scalar, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Scalar_get_String (GrB_Scalar, char * , GrB_Field) ; +GrB_Info GrB_Scalar_get_INT32 (GrB_Scalar, int32_t * , GrB_Field) ; +GrB_Info GrB_Scalar_get_SIZE (GrB_Scalar, size_t * , GrB_Field) ; +GrB_Info GrB_Scalar_get_VOID (GrB_Scalar, void * , GrB_Field) ; + +GrB_Info GrB_Vector_get_Scalar (GrB_Vector, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Vector_get_String (GrB_Vector, char * , GrB_Field) ; +GrB_Info GrB_Vector_get_INT32 (GrB_Vector, int32_t * , GrB_Field) ; +GrB_Info GrB_Vector_get_SIZE (GrB_Vector, size_t * , GrB_Field) ; +GrB_Info GrB_Vector_get_VOID (GrB_Vector, void * , GrB_Field) ; + +GrB_Info GrB_Matrix_get_Scalar (GrB_Matrix, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Matrix_get_String (GrB_Matrix, char * , GrB_Field) ; +GrB_Info GrB_Matrix_get_INT32 (GrB_Matrix, int32_t * , GrB_Field) ; +GrB_Info GrB_Matrix_get_SIZE (GrB_Matrix, size_t * , GrB_Field) ; +GrB_Info GrB_Matrix_get_VOID (GrB_Matrix, void * , GrB_Field) ; + +GrB_Info GxB_Serialized_get_Scalar (const void *, GrB_Scalar, GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_String (const void *, char * , GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_INT32 (const void *, int32_t * , GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_SIZE (const void *, size_t * , GrB_Field, size_t) ; +GrB_Info GxB_Serialized_get_VOID (const void *, void * , GrB_Field, size_t) ; + +GrB_Info GrB_UnaryOp_get_Scalar (GrB_UnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_UnaryOp_get_String (GrB_UnaryOp, char * , GrB_Field) ; +GrB_Info GrB_UnaryOp_get_INT32 (GrB_UnaryOp, int32_t * , GrB_Field) ; +GrB_Info GrB_UnaryOp_get_SIZE (GrB_UnaryOp, size_t * , GrB_Field) ; +GrB_Info GrB_UnaryOp_get_VOID (GrB_UnaryOp, void * , GrB_Field) ; + +GrB_Info GrB_IndexUnaryOp_get_Scalar (GrB_IndexUnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_String (GrB_IndexUnaryOp, char * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_INT32 (GrB_IndexUnaryOp, int32_t * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_SIZE (GrB_IndexUnaryOp, size_t * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_get_VOID (GrB_IndexUnaryOp, void * , GrB_Field) ; + +GrB_Info GrB_BinaryOp_get_Scalar (GrB_BinaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_BinaryOp_get_String (GrB_BinaryOp, char * , GrB_Field) ; +GrB_Info GrB_BinaryOp_get_INT32 (GrB_BinaryOp, int32_t * , GrB_Field) ; +GrB_Info GrB_BinaryOp_get_SIZE (GrB_BinaryOp, size_t * , GrB_Field) ; +GrB_Info GrB_BinaryOp_get_VOID (GrB_BinaryOp, void * , GrB_Field) ; + +GrB_Info GrB_Monoid_get_Scalar (GrB_Monoid, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Monoid_get_String (GrB_Monoid, char * , GrB_Field) ; +GrB_Info GrB_Monoid_get_INT32 (GrB_Monoid, int32_t * , GrB_Field) ; +GrB_Info GrB_Monoid_get_SIZE (GrB_Monoid, size_t * , GrB_Field) ; +GrB_Info GrB_Monoid_get_VOID (GrB_Monoid, void * , GrB_Field) ; + +GrB_Info GrB_Semiring_get_Scalar (GrB_Semiring, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Semiring_get_String (GrB_Semiring, char * , GrB_Field) ; +GrB_Info GrB_Semiring_get_INT32 (GrB_Semiring, int32_t * , GrB_Field) ; +GrB_Info GrB_Semiring_get_SIZE (GrB_Semiring, size_t * , GrB_Field) ; +GrB_Info GrB_Semiring_get_VOID (GrB_Semiring, void * , GrB_Field) ; + +GrB_Info GrB_Descriptor_get_Scalar (GrB_Descriptor, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Descriptor_get_String (GrB_Descriptor, char * , GrB_Field) ; +GrB_Info GrB_Descriptor_get_INT32 (GrB_Descriptor, int32_t * , GrB_Field) ; +GrB_Info GrB_Descriptor_get_SIZE (GrB_Descriptor, size_t * , GrB_Field) ; +GrB_Info GrB_Descriptor_get_VOID (GrB_Descriptor, void * , GrB_Field) ; + +GrB_Info GrB_Type_get_Scalar (GrB_Type, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Type_get_String (GrB_Type, char * , GrB_Field) ; +GrB_Info GrB_Type_get_INT32 (GrB_Type, int32_t * , GrB_Field) ; +GrB_Info GrB_Type_get_SIZE (GrB_Type, size_t * , GrB_Field) ; +GrB_Info GrB_Type_get_VOID (GrB_Type, void * , GrB_Field) ; + +GrB_Info GrB_Global_get_Scalar (GrB_Global, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Global_get_String (GrB_Global, char * , GrB_Field) ; +GrB_Info GrB_Global_get_INT32 (GrB_Global, int32_t * , GrB_Field) ; +GrB_Info GrB_Global_get_SIZE (GrB_Global, size_t * , GrB_Field) ; +GrB_Info GrB_Global_get_VOID (GrB_Global, void * , GrB_Field) ; + +GrB_Info GxB_Context_get_Scalar (GxB_Context, GrB_Scalar, GrB_Field) ; +GrB_Info GxB_Context_get_String (GxB_Context, char * , GrB_Field) ; +GrB_Info GxB_Context_get_INT (GxB_Context, int32_t * , GrB_Field) ; +GrB_Info GxB_Context_get_SIZE (GxB_Context, size_t * , GrB_Field) ; +GrB_Info GxB_Context_get_VOID (GxB_Context, void * , GrB_Field) ; + +// GrB_get (object, value, field): +#if GxB_STDC_VERSION >= 201112L +#define GrB_get(object,value,...) \ + _Generic \ + ( \ + (object), \ + GrB_Scalar : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Scalar_get_Scalar , \ + char * : GrB_Scalar_get_String , \ + int32_t * : GrB_Scalar_get_INT32 , \ + size_t * : GrB_Scalar_get_SIZE , \ + void * : GrB_Scalar_get_VOID \ + ) , \ + GrB_Vector : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Vector_get_Scalar , \ + char * : GrB_Vector_get_String , \ + int32_t * : GrB_Vector_get_INT32 , \ + size_t * : GrB_Vector_get_SIZE , \ + void * : GrB_Vector_get_VOID \ + ) , \ + GrB_Matrix : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Matrix_get_Scalar , \ + char * : GrB_Matrix_get_String , \ + int32_t * : GrB_Matrix_get_INT32 , \ + size_t * : GrB_Matrix_get_SIZE , \ + void * : GrB_Matrix_get_VOID \ + ) , \ + GrB_UnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_UnaryOp_get_Scalar , \ + char * : GrB_UnaryOp_get_String , \ + int32_t * : GrB_UnaryOp_get_INT32 , \ + size_t * : GrB_UnaryOp_get_SIZE , \ + void * : GrB_UnaryOp_get_VOID \ + ) , \ + GrB_IndexUnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_IndexUnaryOp_get_Scalar , \ + char * : GrB_IndexUnaryOp_get_String , \ + int32_t * : GrB_IndexUnaryOp_get_INT32 , \ + size_t * : GrB_IndexUnaryOp_get_SIZE , \ + void * : GrB_IndexUnaryOp_get_VOID \ + ) , \ + GrB_BinaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_BinaryOp_get_Scalar , \ + char * : GrB_BinaryOp_get_String , \ + int32_t * : GrB_BinaryOp_get_INT32 , \ + size_t * : GrB_BinaryOp_get_SIZE , \ + void * : GrB_BinaryOp_get_VOID \ + ) , \ + GrB_Monoid : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Monoid_get_Scalar , \ + char * : GrB_Monoid_get_String , \ + int32_t * : GrB_Monoid_get_INT32 , \ + size_t * : GrB_Monoid_get_SIZE , \ + void * : GrB_Monoid_get_VOID \ + ) , \ + GrB_Semiring : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Semiring_get_Scalar , \ + char * : GrB_Semiring_get_String , \ + int32_t * : GrB_Semiring_get_INT32 , \ + size_t * : GrB_Semiring_get_SIZE , \ + void * : GrB_Semiring_get_VOID \ + ) , \ + GrB_Type : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Type_get_Scalar , \ + char * : GrB_Type_get_String , \ + int32_t * : GrB_Type_get_INT32 , \ + size_t * : GrB_Type_get_SIZE , \ + void * : GrB_Type_get_VOID \ + ) , \ + GrB_Descriptor : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Descriptor_get_Scalar , \ + char * : GrB_Descriptor_get_String , \ + int32_t * : GrB_Descriptor_get_INT32 , \ + size_t * : GrB_Descriptor_get_SIZE , \ + void * : GrB_Descriptor_get_VOID \ + ) , \ + GrB_Global : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Global_get_Scalar , \ + char * : GrB_Global_get_String , \ + int32_t * : GrB_Global_get_INT32 , \ + size_t * : GrB_Global_get_SIZE , \ + void * : GrB_Global_get_VOID \ + ) , \ + GxB_Context : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Context_get_Scalar , \ + char * : GxB_Context_get_String , \ + int32_t * : GxB_Context_get_INT , \ + size_t * : GxB_Context_get_SIZE , \ + void * : GxB_Context_get_VOID \ + ) , \ + const void *: \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Serialized_get_Scalar , \ + char * : GxB_Serialized_get_String , \ + int32_t * : GxB_Serialized_get_INT32 , \ + size_t * : GxB_Serialized_get_SIZE , \ + void * : GxB_Serialized_get_VOID \ + ) , \ + void *: \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Serialized_get_Scalar , \ + char * : GxB_Serialized_get_String , \ + int32_t * : GxB_Serialized_get_INT32 , \ + size_t * : GxB_Serialized_get_SIZE , \ + void * : GxB_Serialized_get_VOID \ + ) \ + ) (object, value, __VA_ARGS__) + +//------------------------------------------------------------------------------ +// GrB_set: set a scalar, string, enum, size, or void * of an object +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_set_Scalar (GrB_Scalar, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Scalar_set_String (GrB_Scalar, char * , GrB_Field) ; +GrB_Info GrB_Scalar_set_INT32 (GrB_Scalar, int32_t , GrB_Field) ; +GrB_Info GrB_Scalar_set_VOID (GrB_Scalar, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Vector_set_Scalar (GrB_Vector, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Vector_set_String (GrB_Vector, char * , GrB_Field) ; +GrB_Info GrB_Vector_set_INT32 (GrB_Vector, int32_t , GrB_Field) ; +GrB_Info GrB_Vector_set_VOID (GrB_Vector, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Matrix_set_Scalar (GrB_Matrix, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Matrix_set_String (GrB_Matrix, char * , GrB_Field) ; +GrB_Info GrB_Matrix_set_INT32 (GrB_Matrix, int32_t , GrB_Field) ; +GrB_Info GrB_Matrix_set_VOID (GrB_Matrix, void * , GrB_Field, size_t) ; + +GrB_Info GrB_UnaryOp_set_Scalar (GrB_UnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_UnaryOp_set_String (GrB_UnaryOp, char * , GrB_Field) ; +GrB_Info GrB_UnaryOp_set_INT32 (GrB_UnaryOp, int32_t , GrB_Field) ; +GrB_Info GrB_UnaryOp_set_VOID (GrB_UnaryOp, void * , GrB_Field, size_t) ; + +GrB_Info GrB_IndexUnaryOp_set_Scalar (GrB_IndexUnaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_set_String (GrB_IndexUnaryOp, char * , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_set_INT32 (GrB_IndexUnaryOp, int32_t , GrB_Field) ; +GrB_Info GrB_IndexUnaryOp_set_VOID (GrB_IndexUnaryOp, void * , GrB_Field, + size_t) ; + +GrB_Info GrB_BinaryOp_set_Scalar (GrB_BinaryOp, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_BinaryOp_set_String (GrB_BinaryOp, char * , GrB_Field) ; +GrB_Info GrB_BinaryOp_set_INT32 (GrB_BinaryOp, int32_t , GrB_Field) ; +GrB_Info GrB_BinaryOp_set_VOID (GrB_BinaryOp, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Monoid_set_Scalar (GrB_Monoid, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Monoid_set_String (GrB_Monoid, char * , GrB_Field) ; +GrB_Info GrB_Monoid_set_INT32 (GrB_Monoid, int32_t , GrB_Field) ; +GrB_Info GrB_Monoid_set_VOID (GrB_Monoid, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Semiring_set_Scalar (GrB_Semiring, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Semiring_set_String (GrB_Semiring, char * , GrB_Field) ; +GrB_Info GrB_Semiring_set_INT32 (GrB_Semiring, int32_t , GrB_Field) ; +GrB_Info GrB_Semiring_set_VOID (GrB_Semiring, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Descriptor_set_Scalar (GrB_Descriptor, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Descriptor_set_String (GrB_Descriptor, char * , GrB_Field) ; +GrB_Info GrB_Descriptor_set_INT32 (GrB_Descriptor, int32_t , GrB_Field) ; +GrB_Info GrB_Descriptor_set_VOID (GrB_Descriptor, void * , GrB_Field, + size_t) ; + +GrB_Info GrB_Type_set_Scalar (GrB_Type, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Type_set_String (GrB_Type, char * , GrB_Field) ; +GrB_Info GrB_Type_set_INT32 (GrB_Type, int32_t , GrB_Field) ; +GrB_Info GrB_Type_set_VOID (GrB_Type, void * , GrB_Field, size_t) ; + +GrB_Info GrB_Global_set_Scalar (GrB_Global, GrB_Scalar, GrB_Field) ; +GrB_Info GrB_Global_set_String (GrB_Global, char * , GrB_Field) ; +GrB_Info GrB_Global_set_INT32 (GrB_Global, int32_t , GrB_Field) ; +GrB_Info GrB_Global_set_VOID (GrB_Global, void * , GrB_Field, size_t) ; + +GrB_Info GxB_Context_set_Scalar (GxB_Context, GrB_Scalar, GrB_Field) ; +GrB_Info GxB_Context_set_String (GxB_Context, char * , GrB_Field) ; +GrB_Info GxB_Context_set_INT (GxB_Context, int32_t , GrB_Field) ; +GrB_Info GxB_Context_set_VOID (GxB_Context, void * , GrB_Field, size_t) ; + +// GrB_set (object, value, field) or (object, value, field, size) for _VOID +#if GxB_STDC_VERSION >= 201112L +#define GrB_set(object,value,...) \ + _Generic \ + ( \ + (object), \ + GrB_Scalar : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Scalar_set_Scalar , \ + char * : GrB_Scalar_set_String , \ + int32_t : GrB_Scalar_set_INT32 , \ + void * : GrB_Scalar_set_VOID \ + ) , \ + GrB_Vector : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Vector_set_Scalar , \ + char * : GrB_Vector_set_String , \ + int32_t : GrB_Vector_set_INT32 , \ + void * : GrB_Vector_set_VOID \ + ) , \ + GrB_Matrix : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Matrix_set_Scalar , \ + char * : GrB_Matrix_set_String , \ + int32_t : GrB_Matrix_set_INT32 , \ + void * : GrB_Matrix_set_VOID \ + ) , \ + GrB_UnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_UnaryOp_set_Scalar , \ + char * : GrB_UnaryOp_set_String , \ + int32_t : GrB_UnaryOp_set_INT32 , \ + void * : GrB_UnaryOp_set_VOID \ + ) , \ + GrB_IndexUnaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_IndexUnaryOp_set_Scalar , \ + char * : GrB_IndexUnaryOp_set_String , \ + int32_t : GrB_IndexUnaryOp_set_INT32 , \ + void * : GrB_IndexUnaryOp_set_VOID \ + ) , \ + GrB_BinaryOp : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_BinaryOp_set_Scalar , \ + char * : GrB_BinaryOp_set_String , \ + int32_t : GrB_BinaryOp_set_INT32 , \ + void * : GrB_BinaryOp_set_VOID \ + ) , \ + GrB_Monoid : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Monoid_set_Scalar , \ + char * : GrB_Monoid_set_String , \ + int32_t : GrB_Monoid_set_INT32 , \ + void * : GrB_Monoid_set_VOID \ + ) , \ + GrB_Semiring : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Semiring_set_Scalar , \ + char * : GrB_Semiring_set_String , \ + int32_t : GrB_Semiring_set_INT32 , \ + void * : GrB_Semiring_set_VOID \ + ) , \ + GrB_Type : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Type_set_Scalar , \ + char * : GrB_Type_set_String , \ + int32_t : GrB_Type_set_INT32 , \ + void * : GrB_Type_set_VOID \ + ) , \ + GrB_Descriptor : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Descriptor_set_Scalar , \ + char * : GrB_Descriptor_set_String , \ + int32_t : GrB_Descriptor_set_INT32 , \ + void * : GrB_Descriptor_set_VOID \ + ) , \ + GrB_Global : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GrB_Global_set_Scalar , \ + char * : GrB_Global_set_String , \ + int32_t : GrB_Global_set_INT32 , \ + void * : GrB_Global_set_VOID \ + ) , \ + GxB_Context : \ + _Generic \ + ( \ + (value), \ + GrB_Scalar : GxB_Context_set_Scalar , \ + char * : GxB_Context_set_String , \ + int32_t : GxB_Context_set_INT , \ + void * : GxB_Context_set_VOID \ + ) \ + ) (object, value, __VA_ARGS__) +#endif + +#endif + //============================================================================== // GrB_free: free any GraphBLAS object //============================================================================== @@ -5023,7 +4973,7 @@ GrB_Info GrB_Vector_extract // w = accum (w, u(I)) const GrB_Vector mask, // optional mask for w, unused if NULL const GrB_BinaryOp accum, // optional accum for z=accum(w,t) const GrB_Vector u, // first input: vector u - const GrB_Index *Ilist, // row indices + const GrB_Index *Ilist, // row indices GrB_Index ni, // number of row indices const GrB_Descriptor desc // descriptor for w and mask ) ; @@ -5034,7 +4984,7 @@ GrB_Info GrB_Matrix_extract // C = accum (C, A(I,J)) const GrB_Matrix Mask, // optional mask for C, unused if NULL const GrB_BinaryOp accum, // optional accum for Z=accum(C,T) const GrB_Matrix A, // first input: matrix A - const GrB_Index *Ilist, // row indices + const GrB_Index *Ilist, // row indices GrB_Index ni, // number of row indices const GrB_Index *J, // column indices GrB_Index nj, // number of column indices @@ -5047,7 +4997,7 @@ GrB_Info GrB_Col_extract // w = accum (w, A(I,j)) const GrB_Vector mask, // optional mask for w, unused if NULL const GrB_BinaryOp accum, // optional accum for z=accum(w,t) const GrB_Matrix A, // first input: matrix A - const GrB_Index *Ilist, // row indices + const GrB_Index *Ilist, // row indices GrB_Index ni, // number of row indices GrB_Index j, // column index const GrB_Descriptor desc // descriptor for w, mask, and A @@ -9237,6 +9187,11 @@ GrB_Info GxB_Context_fprint // print and check a GxB_Context FILE *f // file for output ) ; +// user code should not directly use GB_STR or GB_XSTR +// GB_STR: convert the content of x into a string "x" +#define GB_XSTR(x) GB_STR(x) +#define GB_STR(x) #x + #if GxB_STDC_VERSION >= 201112L #define GxB_fprint(object,pr,f) \ _Generic \ @@ -10791,7 +10746,7 @@ GrB_Info GrB_Matrix_exportHint // suggest the best export format fread (blob, sizeof (uint8_t), blob_size, f) ; fclose (f) ; char type_name [GxB_MAX_NAME_LEN] ; - GxB_deserialize_type_name (type_name, blob, blob_size) ; + GrB_get (blob, type_name, GxB_JIT_C_NAME, blob_size) ; printf ("blob type is: %s\n", type_name) ; GrB_Type user_type = NULL ; if (strncmp (type_name, "myquaternion", GxB_MAX_NAME_LEN) == 0) @@ -10946,23 +10901,8 @@ GrB_Info GxB_Vector_deserialize // deserialize blob into a GrB_Vector const GrB_Descriptor desc // to control # of threads used ) ; -// GxB_deserialize_type_name extracts the type_name of the GrB_Type of the -// GrB_Matrix or GrB_Vector held in a serialized blob. On input, type_name -// must point to a user-owned char array of size at least GxB_MAX_NAME_LEN (it -// must not point into the blob itself). On output, type_name will contain a -// null-terminated string with the corresponding C type name. If the blob -// holds a matrix of a built-in type, the name is returned as "bool" for -// GrB_BOOL, "uint8_t" for GrB_UINT8, "float complex" for GxB_FC32, etc. -// See GxB_Type_name to convert this name into a GrB_Type. -GrB_Info GxB_deserialize_type_name // return the type name of a blob -( - // output: - char *type_name, // name of the type (char array of size at least - // GxB_MAX_NAME_LEN, owned by the user application). - // input, not modified: - const void *blob, // the blob - GrB_Index blob_size // size of the blob -) ; +// historical; use GrB_get with GxB_JIT_C_NAME instead. +GrB_Info GxB_deserialize_type_name (char *, const void *, GrB_Index) ; //============================================================================== // GxB_Vector_sort and GxB_Matrix_sort: sort a matrix or vector diff --git a/GraphBLAS/LICENSE b/GraphBLAS/LICENSE index ad991bd0e3..205d59d279 100644 --- a/GraphBLAS/LICENSE +++ b/GraphBLAS/LICENSE @@ -1,4 +1,4 @@ -SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. The following Apache-2.0 applies to all of SuiteSparse:GraphBLAS, except for 3rd-party software: diff --git a/GraphBLAS/README.md b/GraphBLAS/README.md index f6ad2f6011..7837de87ff 100644 --- a/GraphBLAS/README.md +++ b/GraphBLAS/README.md @@ -1,10 +1,10 @@ # SuiteSparse:GraphBLAS -SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. SPDX-License-Identifier: Apache-2.0 -VERSION 8.3.1, Dec 30, 2023 +VERSION 9.0.0, Jan 1, 2024 SuiteSparse:GraphBLAS is a complete implementation of the GraphBLAS standard, which defines a set of sparse matrix operations on an extended algebra of @@ -63,7 +63,7 @@ README.md file with further details. CMakeLists.txt: cmake instructions to compile GraphBLAS -cmake_modules: additional cmake files +`cmake_modules`: additional cmake files Config: version-dependent files used by CMake @@ -100,7 +100,7 @@ CUDA: GPU interface, a work in progress. This is being developed in CONTRIBUTOR-LICENSE.txt: how to contribute to SuiteSparse:GraphBLAS -cpu_features: (c) Google.com, Apache 2.0 license. +`cpu_features`: (c) Google.com, Apache 2.0 license. logo: the (awesome!) GraphBLAS logo by Jakab Rokob, CC BY 4.0 license @@ -108,7 +108,7 @@ lz4: LZ4 compression, (c) 2011-2016, Yann Collet, BSD2 license zstd: ZSTD compression, (c) Meta, by Yann Collet, BSD3 license xxHash: xxHash code, (c) 2012-2021, Yann Collet -rmm_wrap: Rapids Memory Manager, (c) NVIDIA, to use with CUDA. +`rmm_wrap`: Rapids Memory Manager, (c) NVIDIA, to use with CUDA. (draft; not yet in use) @@ -128,9 +128,9 @@ PreJIT: a folder for JIT kernels that are to be integrated into the Versions v5.2.0 and earlier conform to the version 1.3.0 (Sept 25, 2019) of the GraphBLAS C API Specification. Versions v6.0.0 and later conform to the -version 2.0.0 (Nov, 2021) of the GraphBLAS C API Specification. This library -also includes several additional functions and features as extensions to the -spec. +version 2.0.0 (Nov, 2021) of the GraphBLAS C API Specification. Versions +9.0.0 and later conform to the v2.1.0 C API. This library also includes +several additional functions and features as extensions to the spec. All functions, objects, and macros with the prefix GxB are extensions to the spec. Functions, objects, and macros with prefix GB must not be accessed @@ -196,7 +196,7 @@ To support the development of GraphBLAS, contact the author (davis@tamu.edu) or the Texas A&M Foundation (True Brown, tbrown@txamfoundation.com; or Kevin McGinnis, kmcginnis@txamfoundation.com) for details. -SuiteSparse:GraphBLAS, is copyrighted by Timothy A. Davis, (c) 2017-2023, All +SuiteSparse:GraphBLAS, is copyrighted by Timothy A. Davis, (c) 2017-2024, All Rights Reserved. davis@tamu.edu. ----------------------------------------------------------------------------- @@ -244,7 +244,7 @@ file, and in the GraphBLAS User Guide): (1) LZ4, xxHash, and ZSTD by Yann Collet, appearing here under the BSD2 or BSD3 licenses. -(2) cpu_features (c) Google, Apache 2.0 license with components (c) IBM and -Intel (also Apache 2.0), and the cpu_featurer/ndk_compat component (c) +(2) `cpu_features` (c) Google, Apache 2.0 license with components (c) IBM and +Intel (also Apache 2.0), and the `cpu_featurer/ndk_compat` component (c) The Android Open Source Project (BSD-2-clause) diff --git a/GraphBLAS/Source/Factories/GB_AxB_saxpy3_symbolic_template.c b/GraphBLAS/Source/Factories/GB_AxB_saxpy3_symbolic_template.c index ad0ce2f532..111d76e254 100644 --- a/GraphBLAS/Source/Factories/GB_AxB_saxpy3_symbolic_template.c +++ b/GraphBLAS/Source/Factories/GB_AxB_saxpy3_symbolic_template.c @@ -76,10 +76,10 @@ void GB_EVAL2 (GB (AxB_saxpy3_sym), GB_MASK_A_B_SUFFIX) ASSERT (GB_A_IS_FULL == GB_IS_FULL (A)) ; #if GB_A_IS_HYPER - const int64_t *restrict A_Yp = A->Y->p ; - const int64_t *restrict A_Yi = A->Y->i ; - const int64_t *restrict A_Yx = A->Y->x ; - int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #endif #if ( !GB_NO_MASK ) @@ -95,18 +95,10 @@ void GB_EVAL2 (GB (AxB_saxpy3_sym), GB_MASK_A_B_SUFFIX) const bool M_is_bitmap = GB_IS_BITMAP (M) ; const bool M_jumbled = GB_JUMBLED (M) ; // get the M hyper_hash - const int64_t *restrict M_Yp = NULL ; - const int64_t *restrict M_Yi = NULL ; - const int64_t *restrict M_Yx = NULL ; - int64_t M_hash_bits = 0 ; - if (M_is_hyper) - { - // mask is present, and hypersparse - M_Yp = M->Y->p ; - M_Yi = M->Y->i ; - M_Yx = M->Y->x ; - M_hash_bits = M->Y->vdim - 1 ; - } + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->i ; + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->x ; + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; #endif //========================================================================== diff --git a/GraphBLAS/Source/Factories/GB_Matrix_extractElement.c b/GraphBLAS/Source/Factories/GB_Matrix_extractElement.c index c6f29d2e18..ec6f71f1e7 100644 --- a/GraphBLAS/Source/Factories/GB_Matrix_extractElement.c +++ b/GraphBLAS/Source/Factories/GB_Matrix_extractElement.c @@ -103,27 +103,20 @@ GrB_Info GB_EXTRACT_ELEMENT // extract a single entry, x = A(row,col) // A is hypersparse: look for j in hyperlist A->h [0 ... A->nvec-1] //------------------------------------------------------------------ - int64_t k ; - if (A->Y == NULL) - { - // A is hypersparse but does not yet have a hyper_hash - k = 0 ; - found = GB_lookup (true, Ah, Ap, A->vlen, &k, - A->nvec-1, j, &pA_start, &pA_end) ; - } - else - { - // A is hypersparse, with a hyper_hash that is already built - k = GB_hyper_hash_lookup (Ap, A->Y->p, A->Y->i, A->Y->x, - A->Y->vdim-1, j, &pA_start, &pA_end) ; - found = (k >= 0) ; - } + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; + int64_t k = GB_hyper_hash_lookup (Ah, A->nvec, Ap, A_Yp, A_Yi, A_Yx, + A_hash_bits, j, &pA_start, &pA_end) ; + found = (k >= 0) ; if (!found) { // vector j is empty return (GrB_NO_VALUE) ; } ASSERT (j == Ah [k]) ; + } else { diff --git a/GraphBLAS/Source/Factories/GB_unop_factory.c b/GraphBLAS/Source/Factories/GB_unop_factory.c index 76aaf675c8..2fa00b037b 100644 --- a/GraphBLAS/Source/Factories/GB_unop_factory.c +++ b/GraphBLAS/Source/Factories/GB_unop_factory.c @@ -610,7 +610,7 @@ } break ; - case GB_FREXPX_unop_code : // z = frexpx (x), mantissa from ANSI C11 frexp + case GB_FREXPX_unop_code : // z = frexpx (x), mantissa from C11 frexp switch (code1) { @@ -620,7 +620,7 @@ } break ; - case GB_FREXPE_unop_code : // z = frexpe (x), exponent from ANSI C11 frexp + case GB_FREXPE_unop_code : // z = frexpe (x), exponent from C11 frexp switch (code1) { diff --git a/GraphBLAS/Source/GB_AxB_dot.c b/GraphBLAS/Source/GB_AxB_dot.c index 6d821a1c56..f43a4dc80e 100644 --- a/GraphBLAS/Source/GB_AxB_dot.c +++ b/GraphBLAS/Source/GB_AxB_dot.c @@ -188,9 +188,9 @@ GrB_Info GB_AxB_dot // dot product (multiple methods) #if defined ( GRAPHBLAS_HAS_CUDA ) if (!C_iso && // fixme for CUDA, remove and create C iso on output - GB_AxB_dot3_cuda_branch (M, Mask_struct, A, B, semiring, flipxy)) + GB_cuda_AxB_dot3_branch (M, Mask_struct, A, B, semiring, flipxy)) { - info = (GB_AxB_dot3_cuda (C, M, Mask_struct, A, B, semiring, + info = (GB_cuda_AxB_dot3_jit (C, M, Mask_struct, A, B, semiring, flipxy)) ; } else diff --git a/GraphBLAS/Source/GB_AxB_dot3.c b/GraphBLAS/Source/GB_AxB_dot3.c index 2ede234fa5..daf0cf0b68 100644 --- a/GraphBLAS/Source/GB_AxB_dot3.c +++ b/GraphBLAS/Source/GB_AxB_dot3.c @@ -146,17 +146,15 @@ GrB_Info GB_AxB_dot3 // C = A'*B using dot product method ASSERT (A->vlen == B->vlen) ; ASSERT (vlen > 0) ; - const GrB_Matrix A_Y = A->Y ; - const int64_t *restrict A_Yp = (A_is_hyper) ? A_Y->p : NULL ; - const int64_t *restrict A_Yi = (A_is_hyper) ? A_Y->i : NULL ; - const int64_t *restrict A_Yx = (A_is_hyper) ? A_Y->x : NULL ; - const int64_t A_hash_bits = (A_is_hyper) ? (A_Y->vdim - 1) : 0 ; - - const GrB_Matrix B_Y = B->Y ; - const int64_t *restrict B_Yp = (B_is_hyper) ? B_Y->p : NULL ; - const int64_t *restrict B_Yi = (B_is_hyper) ? B_Y->i : NULL ; - const int64_t *restrict B_Yx = (B_is_hyper) ? B_Y->x : NULL ; - const int64_t B_hash_bits = (B_is_hyper) ? (B_Y->vdim - 1) : 0 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; + + const int64_t *restrict B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *restrict B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *restrict B_Yx = (B->Y == NULL) ? NULL : B->Y->x ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; //-------------------------------------------------------------------------- // allocate C, the same size and # of entries as M diff --git a/GraphBLAS/Source/GB_AxB_saxpy3_flopcount.c b/GraphBLAS/Source/GB_AxB_saxpy3_flopcount.c index a720ec64be..a514c72df7 100644 --- a/GraphBLAS/Source/GB_AxB_saxpy3_flopcount.c +++ b/GraphBLAS/Source/GB_AxB_saxpy3_flopcount.c @@ -147,7 +147,7 @@ GrB_Info GB_AxB_saxpy3_flopcount mnvec = M->nvec ; mvlen = M->vlen ; M_is_dense = GB_IS_BITMAP (M) || GB_as_if_full (M) ; - if (M_is_hyper) + if (M->Y != NULL) { // mask is present, and hypersparse ASSERT_MATRIX_OK (M->Y, "M->Y hyper_hash", GB0) ; @@ -167,19 +167,10 @@ GrB_Info GB_AxB_saxpy3_flopcount const int64_t anvec = A->nvec ; const int64_t avlen = A->vlen ; const bool A_is_hyper = GB_IS_HYPERSPARSE (A) ; - - const int64_t *restrict A_Yp = NULL ; - const int64_t *restrict A_Yi = NULL ; - const int64_t *restrict A_Yx = NULL ; - int64_t A_hash_bits = 0 ; - if (A_is_hyper) - { - ASSERT_MATRIX_OK (A->Y, "A->Y hyper_hash", GB0) ; - A_Yp = A->Y->p ; - A_Yi = A->Y->i ; - A_Yx = A->Y->x ; - A_hash_bits = A->Y->vdim - 1 ; - } + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; const int64_t *restrict Bp = B->p ; const int64_t *restrict Bh = B->h ; @@ -279,8 +270,8 @@ GrB_Info GB_AxB_saxpy3_flopcount if (M_is_hyper) { // M is hypersparse: find M(:,j) in the M->Y hyper_hash - GB_hyper_hash_lookup (Mp, M_Yp, M_Yi, M_Yx, M_hash_bits, - j, &pM, &pM_end) ; + GB_hyper_hash_lookup (Mh, mnvec, Mp, M_Yp, M_Yi, M_Yx, + M_hash_bits, j, &pM, &pM_end) ; } else { @@ -329,8 +320,8 @@ GrB_Info GB_AxB_saxpy3_flopcount if (A_is_hyper) { // A is hypersparse: find A(:,k) in the A->Y hyper_hash - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, - k, &pA, &pA_end) ; + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, + A_hash_bits, k, &pA, &pA_end) ; } else { diff --git a/GraphBLAS/Source/GB_AxB_saxpy3_slice_balanced.c b/GraphBLAS/Source/GB_AxB_saxpy3_slice_balanced.c index f6746a7c7d..61109d5d86 100644 --- a/GraphBLAS/Source/GB_AxB_saxpy3_slice_balanced.c +++ b/GraphBLAS/Source/GB_AxB_saxpy3_slice_balanced.c @@ -270,20 +270,12 @@ GrB_Info GB_AxB_saxpy3_slice_balanced const int64_t *restrict Ap = A->p ; const int64_t *restrict Ah = A->h ; const int64_t avlen = A->vlen ; + const int64_t anvec = A->nvec ; const bool A_is_hyper = GB_IS_HYPERSPARSE (A) ; - - const int64_t *restrict A_Yp = NULL ; - const int64_t *restrict A_Yi = NULL ; - const int64_t *restrict A_Yx = NULL ; - int64_t A_hash_bits = 0 ; - if (A_is_hyper) - { - ASSERT_MATRIX_OK (A->Y, "A->Y hyper_hash", GB0) ; - A_Yp = A->Y->p ; - A_Yi = A->Y->i ; - A_Yx = A->Y->x ; - A_hash_bits = A->Y->vdim - 1 ; - } + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; const int64_t *restrict Bp = B->p ; const int64_t *restrict Bh = B->h ; @@ -304,8 +296,7 @@ GrB_Info GB_AxB_saxpy3_slice_balanced int64_t Mwork = 0 ; int64_t *restrict Bflops = C->p ; // use C->p as workspace for Bflops - GB_OK (GB_AxB_saxpy3_flopcount (&Mwork, Bflops, M, Mask_comp, A, B, - Werk)) ; + GB_OK (GB_AxB_saxpy3_flopcount (&Mwork, Bflops, M, Mask_comp, A, B, Werk)) ; double total_flops = (double) Bflops [bnvec] ; double axbflops = total_flops - Mwork ; GBURBLE ("axbwork %g ", axbflops) ; @@ -687,8 +678,8 @@ GrB_Info GB_AxB_saxpy3_slice_balanced if (A_is_hyper) { // A is hypersparse: find A(:,k) in hyper_hash - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, - A_hash_bits, k, &pA, &pA_end) ; + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, + A_Yi, A_Yx, A_hash_bits, k, &pA, &pA_end) ; } else { diff --git a/GraphBLAS/Source/GB_BinaryOp_check.c b/GraphBLAS/Source/GB_BinaryOp_check.c index 609d9d0ad0..2e70527802 100644 --- a/GraphBLAS/Source/GB_BinaryOp_check.c +++ b/GraphBLAS/Source/GB_BinaryOp_check.c @@ -60,26 +60,29 @@ GrB_Info GB_BinaryOp_check // check a GraphBLAS binary operator bool op_is_first = (opcode == GB_FIRST_binop_code) ; bool op_is_second = (opcode == GB_SECOND_binop_code) ; bool op_is_pair = (opcode == GB_PAIR_binop_code) ; + int32_t actual_len = (int32_t) strlen (op->name) ; + int32_t name_len = op->name_len ; + char *op_name = (actual_len > 0) ? op->name : "f" ; if (opcode == GB_USER_binop_code) { // user-defined binary operator - GBPR0 ("(user-defined): z=%s(x,y)\n", op->name) ; + GBPR0 ("(user-defined): z=%s(x,y)\n", op_name) ; } else if (opcode == GB_FIRST_binop_code && op->ztype->code == GB_UDT_code) { // FIRST_UDT binary operator created by GB_reduce_to_vector - GBPR0 ("(generated): z=%s(x,y)\n", op->name) ; + GBPR0 ("(generated): z=%s(x,y)\n", op_name) ; } else if (op_is_positional) { // built-in positional binary operator - GBPR0 ("(built-in positional): z=%s(x,y,i,k,j)\n", op->name) ; + GBPR0 ("(built-in positional): z=%s(x,y,i,k,j)\n", op_name) ; } else { // built-in - GBPR0 ("(built-in): z=%s(x,y)\n", op->name) ; + GBPR0 ("(built-in): z=%s(x,y)\n", op_name) ; } if (!(op_is_positional || op_is_first || op_is_second) @@ -89,8 +92,6 @@ GrB_Info GB_BinaryOp_check // check a GraphBLAS binary operator return (GrB_INVALID_OBJECT) ; } - int32_t name_len = op->name_len ; - int32_t actual_len = (int32_t) strlen (op->name) ; if (opcode == GB_USER_binop_code && name_len != actual_len) { GBPR0 (" BinaryOp has an invalid name_len\n") ; diff --git a/GraphBLAS/Source/GB_Context.c b/GraphBLAS/Source/GB_Context.c index 61258a41d5..2a94fe7574 100644 --- a/GraphBLAS/Source/GB_Context.c +++ b/GraphBLAS/Source/GB_Context.c @@ -43,7 +43,7 @@ #elif defined ( HAVE_KEYWORD__THREAD_LOCAL ) - // ANSI C11 threads + // C11 threads #include _Thread_local GxB_Context GB_CONTEXT_THREAD = NULL ; diff --git a/GraphBLAS/Source/GB_Global.c b/GraphBLAS/Source/GB_Global.c index c6a34e47ce..1eb2750a78 100644 --- a/GraphBLAS/Source/GB_Global.c +++ b/GraphBLAS/Source/GB_Global.c @@ -38,6 +38,7 @@ typedef struct float bitmap_switch [GxB_NBITMAP_SWITCH] ; // default bitmap_switch float hyper_switch ; // default hyper_switch for new matrices bool is_csc ; // default CSR/CSC format for new matrices + int64_t hyper_hash ; // controls when A->Y hyper_hash is created //-------------------------------------------------------------------------- // abort function: only used for debugging @@ -50,7 +51,7 @@ typedef struct //-------------------------------------------------------------------------- // All threads must use the same malloc/realloc/free functions. - // They default to the ANSI C11 functions, but can be defined by GxB_init. + // They default to the C11 functions, but can be defined by GxB_init. void * (* malloc_function ) (size_t) ; // required void * (* calloc_function ) (size_t, size_t) ; // may be NULL @@ -175,10 +176,12 @@ static GB_Global_struct GB_Global = .is_csc = false, // default is GxB_BY_ROW + .hyper_hash = GB_HYPER_HASH_DEFAULT, + // abort function for debugging only .abort_function = abort, - // malloc/realloc/free functions: default to ANSI C11 functions + // malloc/realloc/free functions: default to C11 functions .malloc_function = malloc, .realloc_function = realloc, .free_function = free, @@ -342,6 +345,20 @@ float GB_Global_hyper_switch_get (void) return (GB_Global.hyper_switch) ; } +//------------------------------------------------------------------------------ +// hyper_hash +//------------------------------------------------------------------------------ + +void GB_Global_hyper_hash_set (int64_t hyper_hash) +{ + GB_Global.hyper_hash = hyper_hash ; +} + +int64_t GB_Global_hyper_hash_get (void) +{ + return (GB_Global.hyper_hash) ; +} + //------------------------------------------------------------------------------ // bitmap_switch //------------------------------------------------------------------------------ diff --git a/GraphBLAS/Source/GB_Global.h b/GraphBLAS/Source/GB_Global.h index dc483cfc96..0f42b8767c 100644 --- a/GraphBLAS/Source/GB_Global.h +++ b/GraphBLAS/Source/GB_Global.h @@ -30,6 +30,9 @@ bool GB_Global_GrB_init_called_get (void) ; void GB_Global_hyper_switch_set (float hyper_switch) ; float GB_Global_hyper_switch_get (void) ; +void GB_Global_hyper_hash_set (int64_t hyper_hash) ; +int64_t GB_Global_hyper_hash_get (void) ; + void GB_Global_bitmap_switch_set (int k, float b) ; float GB_Global_bitmap_switch_get (int k) ; float GB_Global_bitmap_switch_matrix_get diff --git a/GraphBLAS/Source/GB_IndexUnaryOp_check.c b/GraphBLAS/Source/GB_IndexUnaryOp_check.c index cec6c13446..99a07b49dc 100644 --- a/GraphBLAS/Source/GB_IndexUnaryOp_check.c +++ b/GraphBLAS/Source/GB_IndexUnaryOp_check.c @@ -49,7 +49,11 @@ GrB_Info GB_IndexUnaryOp_check // check a GraphBLAS index_unary operator { GBPR0 ("(built-in): ") ; } - GBPR0 ("z=%s(x,i,j,y)\n", op->name) ; + + int32_t name_len = op->name_len ; + int32_t actual_len = (int32_t) strlen (op->name) ; + char *op_name = (actual_len > 0) ? op->name : "f" ; + GBPR0 ("z=%s(x,i,j,y)\n", op_name) ; if (op->idxunop_function == NULL) { @@ -57,8 +61,6 @@ GrB_Info GB_IndexUnaryOp_check // check a GraphBLAS index_unary operator return (GrB_INVALID_OBJECT) ; } - int32_t name_len = op->name_len ; - int32_t actual_len = (int32_t) strlen (op->name) ; if (opcode == GB_USER_idxunop_code && name_len != actual_len) { GBPR0 (" IndexUnaryOp has an invalid name_len\n") ; diff --git a/GraphBLAS/Source/GB_Matrix_free.c b/GraphBLAS/Source/GB_Matrix_free.c index 1f47b822df..c1ffd917cf 100644 --- a/GraphBLAS/Source/GB_Matrix_free.c +++ b/GraphBLAS/Source/GB_Matrix_free.c @@ -24,6 +24,7 @@ void GB_Matrix_free // free a matrix if (A != NULL && (A->magic == GB_MAGIC || A->magic == GB_MAGIC2)) { // free all content of A + GB_FREE (&(A->user_name), A->user_name_size) ; size_t header_size = A->header_size ; GB_phybix_free (A) ; if (!(A->static_header)) diff --git a/GraphBLAS/Source/GB_Monoid_new.c b/GraphBLAS/Source/GB_Monoid_new.c index b33780f972..5aec6e0c91 100644 --- a/GraphBLAS/Source/GB_Monoid_new.c +++ b/GraphBLAS/Source/GB_Monoid_new.c @@ -100,6 +100,8 @@ GrB_Info GB_Monoid_new // create a monoid GrB_Monoid mon = *monoid ; mon->magic = GB_MAGIC ; mon->header_size = header_size ; + mon->user_name = NULL ; // user_name for GrB_get/GrB_set + mon->user_name_size = 0 ; mon->op = op ; size_t zsize = op->ztype->size ; mon->identity = NULL ; // defined below (if present) diff --git a/GraphBLAS/Source/GB_Op_free.c b/GraphBLAS/Source/GB_Op_free.c index 3733996400..ce62904639 100644 --- a/GraphBLAS/Source/GB_Op_free.c +++ b/GraphBLAS/Source/GB_Op_free.c @@ -21,14 +21,15 @@ GrB_Info GB_Op_free // free a user-created op GB_Operator op = *op_handle ; if (op != NULL) { + GB_FREE (&(op->user_name), op->user_name_size) ; + size_t defn_size = op->defn_size ; + if (defn_size > 0) + { + GB_FREE (&(op->defn), defn_size) ; + } size_t header_size = op->header_size ; if (header_size > 0) { - size_t defn_size = op->defn_size ; - if (defn_size > 0) - { - GB_FREE (&(op->defn), defn_size) ; - } op->magic = GB_FREED ; // to help detect dangling pointers op->header_size = 0 ; GB_FREE (op_handle, header_size) ; diff --git a/GraphBLAS/Source/GB_Pending.h b/GraphBLAS/Source/GB_Pending.h index f2da17aac3..3a8f6b354e 100644 --- a/GraphBLAS/Source/GB_Pending.h +++ b/GraphBLAS/Source/GB_Pending.h @@ -11,6 +11,10 @@ #define GB_PENDING_H #include "GB.h" +// FUTURE: remove this once GxB_Matrix_pending is revised (see PR #172) +// true if a matrix is hypersparse and needs its hyper_hash built +#define GB_NEED_HYPER_HASH(A) GB_hyper_hash_need (A) + //------------------------------------------------------------------------------ // GB_Pending functions //------------------------------------------------------------------------------ diff --git a/GraphBLAS/Source/GB_Scalar_wrap.c b/GraphBLAS/Source/GB_Scalar_wrap.c index cf44365d66..6da7e5e52b 100644 --- a/GraphBLAS/Source/GB_Scalar_wrap.c +++ b/GraphBLAS/Source/GB_Scalar_wrap.c @@ -36,6 +36,8 @@ GrB_Scalar GB_Scalar_wrap // create a new GrB_Scalar with one entry s->magic = GB_MAGIC ; s->header_size = 0 ; + s->user_name = NULL ; + s->user_name_size = 0 ; s->type = (type == NULL) ? GrB_BOOL : type ; s->logger = NULL ; s->logger_size = 0 ; diff --git a/GraphBLAS/Source/GB_Semiring_new.c b/GraphBLAS/Source/GB_Semiring_new.c index 71b440a9f5..62b17e637e 100644 --- a/GraphBLAS/Source/GB_Semiring_new.c +++ b/GraphBLAS/Source/GB_Semiring_new.c @@ -43,6 +43,8 @@ GrB_Info GB_Semiring_new // create a semiring // initialize the semiring semiring->magic = GB_MAGIC ; + semiring->user_name = NULL ; // user_name for GrB_get/GrB_set + semiring->user_name_size = 0 ; semiring->add = add ; semiring->multiply = multiply ; semiring->name = NULL ; diff --git a/GraphBLAS/Source/GB_UnaryOp_check.c b/GraphBLAS/Source/GB_UnaryOp_check.c index 7348d42bbb..f5e1daaa29 100644 --- a/GraphBLAS/Source/GB_UnaryOp_check.c +++ b/GraphBLAS/Source/GB_UnaryOp_check.c @@ -49,7 +49,10 @@ GrB_Info GB_UnaryOp_check // check a GraphBLAS unary operator { GBPR0 ("(built-in): ") ; } - GBPR0 ("z=%s(x)\n", op->name) ; + int32_t name_len = op->name_len ; + int32_t actual_len = (int32_t) strlen (op->name) ; + char *op_name = (actual_len > 0) ? op->name : "f" ; + GBPR0 ("z=%s(x)\n", op_name) ; bool op_is_positional = GB_OPCODE_IS_POSITIONAL (opcode) ; bool op_is_one = (opcode == GB_ONE_unop_code) ; @@ -61,8 +64,6 @@ GrB_Info GB_UnaryOp_check // check a GraphBLAS unary operator return (GrB_INVALID_OBJECT) ; } - int32_t name_len = op->name_len ; - int32_t actual_len = (int32_t) strlen (op->name) ; if (opcode == GB_USER_unop_code && name_len != actual_len) { GBPR0 (" UnaryOp has an invalid name_len\n") ; diff --git a/GraphBLAS/Source/GB_add_phase0.c b/GraphBLAS/Source/GB_add_phase0.c index ee5b654b3b..067eded6b7 100644 --- a/GraphBLAS/Source/GB_add_phase0.c +++ b/GraphBLAS/Source/GB_add_phase0.c @@ -278,15 +278,15 @@ GrB_Info GB_add_phase0 // find vectors in C for C=A+B or C=A+B GB_OK (GB_hyper_hash_build (A, Werk)) ; GB_OK (GB_hyper_hash_build (B, Werk)) ; - const int64_t *restrict A_Yp = (A_is_hyper) ? A->Y->p : NULL ; - const int64_t *restrict A_Yi = (A_is_hyper) ? A->Y->i : NULL ; - const int64_t *restrict A_Yx = (A_is_hyper) ? A->Y->x : NULL ; - const int64_t A_hash_bits = (A_is_hyper) ? (A->Y->vdim - 1) : 0 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; - const int64_t *restrict B_Yp = (B_is_hyper) ? B->Y->p : NULL ; - const int64_t *restrict B_Yi = (B_is_hyper) ? B->Y->i : NULL ; - const int64_t *restrict B_Yx = (B_is_hyper) ? B->Y->x : NULL ; - const int64_t B_hash_bits = (B_is_hyper) ? (B->Y->vdim - 1) : 0 ; + const int64_t *restrict B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *restrict B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *restrict B_Yx = (B->Y == NULL) ? NULL : B->Y->x ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; int64_t k ; #pragma omp parallel for num_threads(nthreads) schedule(static) @@ -297,16 +297,16 @@ GrB_Info GB_add_phase0 // find vectors in C for C=A+B or C=A+B { // C_to_A [k] = kA if Ah [kA] == j and A(:,j) is non-empty int64_t pA, pA_end ; - int64_t kA = GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, - A_hash_bits, j, &pA, &pA_end) ; + int64_t kA = GB_hyper_hash_lookup (Ah, Anvec, Ap, A_Yp, + A_Yi, A_Yx, A_hash_bits, j, &pA, &pA_end) ; C_to_A [k] = (pA < pA_end) ? kA : -1 ; } if (B_is_hyper) { // C_to_B [k] = kB if Bh [kB] == j and B(:,j) is non-empty int64_t pB, pB_end ; - int64_t kB = GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, - B_hash_bits, j, &pB, &pB_end) ; + int64_t kB = GB_hyper_hash_lookup (Bh, Bnvec, Bp, B_Yp, + B_Yi, B_Yx, B_hash_bits, j, &pB, &pB_end) ; C_to_B [k] = (pB < pB_end) ? kB : -1 ; } } @@ -676,10 +676,10 @@ GrB_Info GB_add_phase0 // find vectors in C for C=A+B or C=A+B // create the M->Y hyper_hash GB_OK (GB_hyper_hash_build (M, Werk)) ; - const int64_t *restrict M_Yp = M->Y->p ; - const int64_t *restrict M_Yi = M->Y->i ; - const int64_t *restrict M_Yx = M->Y->x ; - const int64_t M_hash_bits = M->Y->vdim - 1 ; + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; int64_t k ; #pragma omp parallel for num_threads(nthreads) schedule(static) @@ -688,8 +688,8 @@ GrB_Info GB_add_phase0 // find vectors in C for C=A+B or C=A+B int64_t j = Ch [k] ; // C_to_M [k] = kM if Mh [kM] == j and M(:,j) is non-empty int64_t pM, pM_end ; - int64_t kM = GB_hyper_hash_lookup (Mp, M_Yp, M_Yi, M_Yx, - M_hash_bits, j, &pM, &pM_end) ; + int64_t kM = GB_hyper_hash_lookup (Mh, Mnvec, Mp, M_Yp, M_Yi, + M_Yx, M_hash_bits, j, &pM, &pM_end) ; C_to_M [k] = (pM < pM_end) ? kM : -1 ; } } diff --git a/GraphBLAS/Source/GB_assign_zombie1.c b/GraphBLAS/Source/GB_assign_zombie1.c index 5f7ab6a056..095371b6a7 100644 --- a/GraphBLAS/Source/GB_assign_zombie1.c +++ b/GraphBLAS/Source/GB_assign_zombie1.c @@ -40,13 +40,19 @@ GrB_Info GB_assign_zombie1 //-------------------------------------------------------------------------- int64_t *restrict Ci = C->i ; + const int64_t *restrict Ch = C->h ; const int64_t *restrict Cp = C->p ; int64_t pC_start, pC_end ; + const int64_t cnvec = C->nvec ; - if (C->h != NULL) + if (Ch != NULL) { // C is hypersparse - GB_hyper_hash_lookup (Cp, C->Y->p, C->Y->i, C->Y->x, C->Y->vdim-1, + const int64_t *restrict C_Yp = (C->Y == NULL) ? NULL : C->Y->p ; + const int64_t *restrict C_Yi = (C->Y == NULL) ? NULL : C->Y->i ; + const int64_t *restrict C_Yx = (C->Y == NULL) ? NULL : C->Y->x ; + const int64_t C_hash_bits = (C->Y == NULL) ? 0 : (C->Y->vdim - 1) ; + GB_hyper_hash_lookup (Ch, cnvec, Cp, C_Yp, C_Yi, C_Yx, C_hash_bits, j, &pC_start, &pC_end) ; } else diff --git a/GraphBLAS/Source/GB_assign_zombie3.c b/GraphBLAS/Source/GB_assign_zombie3.c index 7f46f0a9be..b6e792a48d 100644 --- a/GraphBLAS/Source/GB_assign_zombie3.c +++ b/GraphBLAS/Source/GB_assign_zombie3.c @@ -60,14 +60,20 @@ GrB_Info GB_assign_zombie3 // get C (:,j) //-------------------------------------------------------------------------- - const int64_t *restrict Cp = C->p ; int64_t *restrict Ci = C->i ; + const int64_t *restrict Ch = C->h ; + const int64_t *restrict Cp = C->p ; int64_t pC_start, pC_end ; + const int64_t cnvec = C->nvec ; - if (C->h != NULL) + if (Ch != NULL) { // C is hypersparse - GB_hyper_hash_lookup (Cp, C->Y->p, C->Y->i, C->Y->x, C->Y->vdim-1, + const int64_t *restrict C_Yp = (C->Y == NULL) ? NULL : C->Y->p ; + const int64_t *restrict C_Yi = (C->Y == NULL) ? NULL : C->Y->i ; + const int64_t *restrict C_Yx = (C->Y == NULL) ? NULL : C->Y->x ; + const int64_t C_hash_bits = (C->Y == NULL) ? 0 : (C->Y->vdim - 1) ; + GB_hyper_hash_lookup (Ch, cnvec, Cp, C_Yp, C_Yi, C_Yx, C_hash_bits, j, &pC_start, &pC_end) ; } else diff --git a/GraphBLAS/Source/GB_assign_zombie4.c b/GraphBLAS/Source/GB_assign_zombie4.c index 6c9c429a50..b0bd60341e 100644 --- a/GraphBLAS/Source/GB_assign_zombie4.c +++ b/GraphBLAS/Source/GB_assign_zombie4.c @@ -70,19 +70,19 @@ GrB_Info GB_assign_zombie4 //-------------------------------------------------------------------------- const int64_t *restrict Mp = M->p ; -// const int64_t *restrict Mh = M->h ; + const int64_t *restrict Mh = M->h ; const int8_t *restrict Mb = M->b ; const GB_M_TYPE *restrict Mx = (GB_M_TYPE *) (Mask_struct ? NULL : (M->x)) ; const size_t msize = M->type->size ; -// const int64_t Mnvec = M->nvec ; + const int64_t Mnvec = M->nvec ; ASSERT (M->vlen == 1) ; const bool M_is_hyper = GB_IS_HYPERSPARSE (M) ; const bool M_is_bitmap = GB_IS_BITMAP (M) ; const bool M_is_full = GB_IS_FULL (M) ; - const int64_t *restrict M_Yp = (M_is_hyper) ? M->Y->p : NULL ; - const int64_t *restrict M_Yi = (M_is_hyper) ? M->Y->i : NULL ; - const int64_t *restrict M_Yx = (M_is_hyper) ? M->Y->x : NULL ; - const int64_t M_hash_bits = (M_is_hyper) ? (M->Y->vdim - 1) : 0 ; + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->i ; + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->x ; + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; //-------------------------------------------------------------------------- // determine the number of threads to use @@ -158,8 +158,8 @@ GrB_Info GB_assign_zombie4 if (M_is_hyper) { // M is hypersparse - GB_hyper_hash_lookup (Mp, M_Yp, M_Yi, M_Yx, - M_hash_bits, j, &pM, &pM_end) ; + GB_hyper_hash_lookup (Mh, Mnvec, Mp, M_Yp, M_Yi, + M_Yx, M_hash_bits, j, &pM, &pM_end) ; } else { diff --git a/GraphBLAS/Source/GB_assign_zombie5.c b/GraphBLAS/Source/GB_assign_zombie5.c index 69fe425a1f..9a55d50fd4 100644 --- a/GraphBLAS/Source/GB_assign_zombie5.c +++ b/GraphBLAS/Source/GB_assign_zombie5.c @@ -92,10 +92,10 @@ GrB_Info GB_assign_zombie5 const bool M_is_hyper = GB_IS_HYPERSPARSE (M) ; const bool M_is_bitmap = GB_IS_BITMAP (M) ; const bool M_is_full = GB_IS_FULL (M) ; - const int64_t *restrict M_Yp = (M_is_hyper) ? M->Y->p : NULL ; - const int64_t *restrict M_Yi = (M_is_hyper) ? M->Y->i : NULL ; - const int64_t *restrict M_Yx = (M_is_hyper) ? M->Y->x : NULL ; - const int64_t M_hash_bits = (M_is_hyper) ? (M->Y->vdim - 1) : 0 ; + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->i ; + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->x ; + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; //-------------------------------------------------------------------------- // determine the number of threads to use @@ -157,8 +157,8 @@ GrB_Info GB_assign_zombie5 if (M_is_hyper) { // M is hypersparse - GB_hyper_hash_lookup (Mp, M_Yp, M_Yi, M_Yx, M_hash_bits, - j, &pM_start, &pM_end) ; + GB_hyper_hash_lookup (Mh, Mnvec, Mp, M_Yp, M_Yi, M_Yx, + M_hash_bits, j, &pM_start, &pM_end) ; } else { diff --git a/GraphBLAS/Source/GB_binop_new.c b/GraphBLAS/Source/GB_binop_new.c index 4abcf4750e..3860ebb6b4 100644 --- a/GraphBLAS/Source/GB_binop_new.c +++ b/GraphBLAS/Source/GB_binop_new.c @@ -45,6 +45,8 @@ GrB_Info GB_binop_new //-------------------------------------------------------------------------- op->magic = GB_MAGIC ; + op->user_name = NULL ; + op->user_name_size = 0 ; op->ztype = ztype ; op->xtype = xtype ; op->ytype = ytype ; @@ -67,7 +69,6 @@ GrB_Info GB_binop_new // output: op->name, &(op->name_len), &(op->hash), &(op->defn), &(op->defn_size), // input: - binop_name, binop_defn, "GxB_binary_function", 19, - opcode == GB_USER_binop_code, jitable)) ; + binop_name, binop_defn, opcode == GB_USER_binop_code, jitable)) ; } diff --git a/GraphBLAS/Source/GB_bitwise.h b/GraphBLAS/Source/GB_bitwise.h index 859eeecde0..c404be0d98 100644 --- a/GraphBLAS/Source/GB_bitwise.h +++ b/GraphBLAS/Source/GB_bitwise.h @@ -364,7 +364,7 @@ inline uint8_t GB_bitshift_uint8 (uint8_t x, int8_t k) } else if (k >= 8 || k <= -8) { - // ANSI C11 states that the result of x << k is undefined if k is + // C11 states that the result of x << k is undefined if k is // negative or if k is greater than the # of bits in x. Here, the // result is defined to be zero (the same as if shifting left // or right by 8). @@ -372,13 +372,13 @@ inline uint8_t GB_bitshift_uint8 (uint8_t x, int8_t k) } else if (k > 0) { - // left shift x by k bits. z is defined by ANSI C11 as + // left shift x by k bits. z is defined by C11 as // (x * (2^k)) mod (uintmax + 1). return (x << k) ; } else { - // right shift x by k bits. z is defined by ANSI C11 as the + // right shift x by k bits. z is defined by C11 as the // integral part of the quotient of x / (2^k). return (x >> (-k)) ; } @@ -541,13 +541,13 @@ inline int8_t GB_bitshift_int8 (int8_t x, int8_t k) } else if (k >= 8) { - // ANSI C11 states that z = x << k is undefined if k is greater + // C11 states that z = x << k is undefined if k is greater // than the # of bits in x. Here, the result is defined to be zero. return (0) ; } else if (k <= -8) { - // ANSI C11 states that z = x >> (-k) is undefined if (-k) is + // C11 states that z = x >> (-k) is undefined if (-k) is // greater than the # of bits in x. Here, the result is defined to // be the sign of x (z = 0 if x >= 0 and z = -1 if x is negative). return ((x >= 0) ? 0 : -1) ; @@ -555,7 +555,7 @@ inline int8_t GB_bitshift_int8 (int8_t x, int8_t k) else if (k > 0) { // left shift x by k bits (where k is in range 1 to #bits - 1). - // ANSI C11 states that z is defined only if x is non-negative and + // C11 states that z is defined only if x is non-negative and // x * (2^k) is representable. This computation assumes x and z // are represented in 2's complement. The result depends on the // underlying machine architecture and the compiler. @@ -567,13 +567,13 @@ inline int8_t GB_bitshift_int8 (int8_t x, int8_t k) // right shift x by k bits (where k is in range 1 to 8) if (x >= 0) { - // ANSI C11 defines z as the integral part of the quotient + // C11 defines z as the integral part of the quotient // of x / (2^k). return (x >> k) ; } else { - // ANSI C11 states that the result is implementation-defined if + // C11 states that the result is implementation-defined if // x is negative. This computation assumes x and z are in 2's // complement, so 1-bits are shifted in on the left, and thus // the sign bit is always preserved. The result depends on the diff --git a/GraphBLAS/Source/GB_block.c b/GraphBLAS/Source/GB_block.c index 9a5577cff4..53e38c4cb3 100644 --- a/GraphBLAS/Source/GB_block.c +++ b/GraphBLAS/Source/GB_block.c @@ -29,7 +29,7 @@ GrB_Info GB_block // apply all pending computations if blocking mode enabled // wait if mode is blocking, or if too many pending tuples //-------------------------------------------------------------------------- - if (!(GB_ANY_PENDING_WORK (A) || GB_NEED_HYPER_HASH (A))) + if (!(GB_ANY_PENDING_WORK (A) || GB_hyper_hash_need (A))) { // no pending work, so no need to block return (GrB_SUCCESS) ; diff --git a/GraphBLAS/Source/GB_boolean_rename.c b/GraphBLAS/Source/GB_boolean_rename.c index d91d853865..9d7548a886 100644 --- a/GraphBLAS/Source/GB_boolean_rename.c +++ b/GraphBLAS/Source/GB_boolean_rename.c @@ -23,7 +23,7 @@ // Those 6 names are in GraphBLAS but the pairs of names are equivalent. // GraphBLAS includes a built-in GrB_DIV_BOOL operator, so boolean division -// must be defined. ANSI C11 does not provide a definition either, and +// must be defined. C11 does not provide a definition either, and // dividing by zero (boolean false) will typically terminate an application. // In this GraphBLAS implementation, boolean division is treated as if it were // int1, where 1/1 = 1, 0/1 = 0, 0/0 = integer NaN = 0, 1/0 = +infinity = 1. diff --git a/GraphBLAS/Source/GB_code_name_get.c b/GraphBLAS/Source/GB_code_name_get.c new file mode 100644 index 0000000000..1d5c3af53c --- /dev/null +++ b/GraphBLAS/Source/GB_code_name_get.c @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// GB_code_name_get: get the user_name of a type, from a code +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +const char *GB_code_name_get (GB_Type_code code, char *user_name) +{ + switch (code) + { + case GB_BOOL_code : return ("GrB_BOOL") ; + case GB_INT8_code : return ("GrB_INT8") ; + case GB_INT16_code : return ("GrB_INT16") ; + case GB_INT32_code : return ("GrB_INT32") ; + case GB_INT64_code : return ("GrB_INT64") ; + case GB_UINT8_code : return ("GrB_UINT8") ; + case GB_UINT16_code : return ("GrB_UINT16") ; + case GB_UINT32_code : return ("GrB_UINT32") ; + case GB_UINT64_code : return ("GrB_UINT64") ; + case GB_FP32_code : return ("GrB_FP32") ; + case GB_FP64_code : return ("GrB_FP64") ; + case GB_FC32_code : return ("GxB_FC32") ; + case GB_FC64_code : return ("GxB_FC64") ; + default: + case GB_UDT_code : return (user_name) ; + } +} + diff --git a/GraphBLAS/Source/GB_cuda_gateway.h b/GraphBLAS/Source/GB_cuda_gateway.h index 80ceaca4cf..cfb00a72ed 100644 --- a/GraphBLAS/Source/GB_cuda_gateway.h +++ b/GraphBLAS/Source/GB_cuda_gateway.h @@ -14,11 +14,11 @@ // #include'd in GraphBLAS/CUDA/GB_cuda.h, for use by the CUDA/GB_cuda_*.cu // gateway functions. -// If GRAPHBLAS_HAS_CUDA is defined in GraphBLAS/CMakeLists.txt, then GraphBLAS can call -// the C-callable gateway functions defined in GraphBLAS/CUDA/*.cu source -// files. If GRAPHBLAS_HAS_CUDA is not defined, then these functions are not called. The -// typedef always appears, since it is part of the GB_Global struct, whether -// or not CUDA is used. +// If GRAPHBLAS_HAS_CUDA is defined in GraphBLAS/CMakeLists.txt, then GraphBLAS +// can call the C-callable gateway functions defined in GraphBLAS/CUDA/*.cu +// source files. If GRAPHBLAS_HAS_CUDA is not defined, then these functions +// are not called. The typedef always appears, since it is part of the +// GB_Global struct, whether or not CUDA is used. #ifndef GB_CUDA_GATEWAY_H #define GB_CUDA_GATEWAY_H @@ -116,13 +116,13 @@ bool GB_cuda_get_device_properties GB_cuda_device *prop ) ; -bool GB_reduce_to_scalar_cuda_branch // return true to use the GPU +bool GB_cuda_reduce_to_scalar_branch // return true to use the GPU ( const GrB_Monoid monoid, // monoid to do the reduction const GrB_Matrix A // input matrix ) ; -GrB_Info GB_reduce_to_scalar_cuda +GrB_Info GB_cuda_reduce_to_scalar_jit ( // output: GB_void *s, // note: statically allocated on CPU stack; if @@ -139,7 +139,7 @@ bool GB_cuda_type_branch // return true if the type is OK on GPU const GrB_Type type // type to query ) ; -GrB_Info GB_AxB_dot3_cuda // C = A'*B using dot product method +GrB_Info GB_cuda_AxB_dot3_jit // C = A'*B using dot product method ( GrB_Matrix C, // output matrix, static header const GrB_Matrix M, // mask matrix @@ -150,7 +150,7 @@ GrB_Info GB_AxB_dot3_cuda // C = A'*B using dot product method const bool flipxy // if true, do z=fmult(b,a) vs fmult(a,b) ) ; -bool GB_AxB_dot3_cuda_branch +bool GB_cuda_AxB_dot3_branch ( const GrB_Matrix M, // mask matrix const bool Mask_struct, // if true, use the only structure of M diff --git a/GraphBLAS/Source/GB_deserialize.c b/GraphBLAS/Source/GB_deserialize.c index e6dcd15a50..48254488a9 100644 --- a/GraphBLAS/Source/GB_deserialize.c +++ b/GraphBLAS/Source/GB_deserialize.c @@ -10,6 +10,7 @@ // A parallel decompression of a serialized blob into a GrB_Matrix. #include "GB.h" +#include "GB_get_set.h" #include "GB_serialize.h" #define GB_FREE_ALL \ @@ -218,6 +219,41 @@ GrB_Info GB_deserialize // deserialize a matrix from a blob } C->magic = GB_MAGIC ; + //-------------------------------------------------------------------------- + // get the GrB_NAME and GrB_EL_TYPE_STRING + //-------------------------------------------------------------------------- + + // v8.1.0 adds two nul-terminated uncompressed strings to the end of the + // blob. If the strings are empty, the nul terminators still appear. + + if (version >= GxB_VERSION (8,1,0)) + { + + //---------------------------------------------------------------------- + // look for the two nul bytes in blob [s : blob_size-1] + //---------------------------------------------------------------------- + + int nfound = 0 ; + size_t ss [2] ; + for (size_t p = s ; p < blob_size && nfound < 2 ; p++) + { + if (blob [p] == 0) + { + ss [nfound++] = p ; + } + } + + if (nfound == 2) + { + // extract the GrB_NAME and GrB_EL_TYPE_STRING from the blob + char *user_name = (char *) (blob + s) ; +// char *eltype_string = (char *) (blob + ss [0] + 1) ; +// printf ("deserialize user_name [%s] eltype [%s]\n", user_name, +// eltype_string) ; + GB_OK (GB_matvec_name_set (C, user_name, GrB_NAME)) ; + } + } + //-------------------------------------------------------------------------- // return result //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Source/GB_dup_worker.c b/GraphBLAS/Source/GB_dup_worker.c index 63e97336a9..be0adf2c23 100644 --- a/GraphBLAS/Source/GB_dup_worker.c +++ b/GraphBLAS/Source/GB_dup_worker.c @@ -11,11 +11,13 @@ // if numeric is false, C->x is allocated but not initialized. -// If *Chandle is not NULL, the header is reused. It may be a static or -// dynamic header, depending on C->static_header. +// If *Chandle is not NULL on input, the header is reused. It may be a static +// or dynamic header, depending on C->static_header. #include "GB.h" -#define GB_FREE_ALL ; +#include "GB_get_set.h" +#define GB_FREE_ALL \ + GB_FREE (&C_user_name, C_user_name_size) ; GrB_Info GB_dup_worker // make an exact copy of a matrix ( @@ -64,6 +66,23 @@ GrB_Info GB_dup_worker // make an exact copy of a matrix int sparsity_control = A->sparsity_control ; GrB_Type atype = A->type ; + //-------------------------------------------------------------------------- + // copy the user_name of A, if present + //-------------------------------------------------------------------------- + + char *C_user_name = NULL ; + size_t C_user_name_size = 0 ; + if (A->user_name != NULL) + { + info = GB_user_name_set (&C_user_name, &C_user_name_size, + A->user_name, false) ; + if (info != GrB_SUCCESS) + { + // out of memory + return (info) ; + } + } + //-------------------------------------------------------------------------- // create C //-------------------------------------------------------------------------- @@ -115,14 +134,21 @@ GrB_Info GB_dup_worker // make an exact copy of a matrix } C->magic = GB_MAGIC ; // C->p and C->h are now initialized - #ifdef GB_DEBUG - if (numeric) ASSERT_MATRIX_OK (C, "C duplicate of A", GB0) ; - #endif + + //-------------------------------------------------------------------------- + // copy the user_name of A into C, if present + //-------------------------------------------------------------------------- + + C->user_name = C_user_name ; + C->user_name_size = C_user_name_size ; //-------------------------------------------------------------------------- // return the result //-------------------------------------------------------------------------- + #ifdef GB_DEBUG + if (numeric) ASSERT_MATRIX_OK (C, "C duplicate of A", GB0) ; + #endif return (GrB_SUCCESS) ; } diff --git a/GraphBLAS/Source/GB_emult_08_phase0.c b/GraphBLAS/Source/GB_emult_08_phase0.c index 13e54c0267..8ab085d4a1 100644 --- a/GraphBLAS/Source/GB_emult_08_phase0.c +++ b/GraphBLAS/Source/GB_emult_08_phase0.c @@ -426,10 +426,10 @@ GrB_Info GB_emult_08_phase0 // find vectors in C for C=A.*B or C=A.*B GB_OK (GB_hyper_hash_build (M, Werk)) ; const int64_t *restrict Mp = M->p ; - const int64_t *restrict M_Yp = M->Y->p ; - const int64_t *restrict M_Yi = M->Y->i ; - const int64_t *restrict M_Yx = M->Y->x ; - const int64_t M_hash_bits = M->Y->vdim - 1 ; + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->i ; + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->x ; + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; // compute C_to_M int64_t k ; @@ -438,7 +438,7 @@ GrB_Info GB_emult_08_phase0 // find vectors in C for C=A.*B or C=A.*B { int64_t pM, pM_end ; int64_t j = Ch [k] ; - int64_t kM = GB_hyper_hash_lookup (Mp, M_Yp, M_Yi, M_Yx, + int64_t kM = GB_hyper_hash_lookup (Mh, Mnvec, Mp, M_Yp, M_Yi, M_Yx, M_hash_bits, j, &pM, &pM_end) ; C_to_M [k] = (pM < pM_end) ? kM : -1 ; } @@ -464,10 +464,10 @@ GrB_Info GB_emult_08_phase0 // find vectors in C for C=A.*B or C=A.*B GB_OK (GB_hyper_hash_build (A, Werk)) ; const int64_t *restrict Ap = A->p ; - const int64_t *restrict A_Yp = A->Y->p ; - const int64_t *restrict A_Yi = A->Y->i ; - const int64_t *restrict A_Yx = A->Y->x ; - const int64_t A_hash_bits = A->Y->vdim - 1 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; // compute C_to_A int64_t k ; @@ -476,7 +476,7 @@ GrB_Info GB_emult_08_phase0 // find vectors in C for C=A.*B or C=A.*B { int64_t pA, pA_end ; int64_t j = Ch [k] ; - int64_t kA = GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, + int64_t kA = GB_hyper_hash_lookup (Ah, Anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, j, &pA, &pA_end) ; C_to_A [k] = (pA < pA_end) ? kA : -1 ; } @@ -502,10 +502,10 @@ GrB_Info GB_emult_08_phase0 // find vectors in C for C=A.*B or C=A.*B GB_OK (GB_hyper_hash_build (B, Werk)) ; const int64_t *restrict Bp = B->p ; - const int64_t *restrict B_Yp = B->Y->p ; - const int64_t *restrict B_Yi = B->Y->i ; - const int64_t *restrict B_Yx = B->Y->x ; - const int64_t B_hash_bits = B->Y->vdim - 1 ; + const int64_t *restrict B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *restrict B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *restrict B_Yx = (B->Y == NULL) ? NULL : B->Y->x ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; // compute C_to_B int64_t k ; @@ -514,7 +514,7 @@ GrB_Info GB_emult_08_phase0 // find vectors in C for C=A.*B or C=A.*B { int64_t pB, pB_end ; int64_t j = Ch [k] ; - int64_t kB = GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, + int64_t kB = GB_hyper_hash_lookup (Bh, Bnvec, Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, j, &pB, &pB_end) ; C_to_B [k] = (pB < pB_end) ? kB : -1 ; } diff --git a/GraphBLAS/Source/GB_get_set.h b/GraphBLAS/Source/GB_get_set.h new file mode 100644 index 0000000000..8e91c6dcc8 --- /dev/null +++ b/GraphBLAS/Source/GB_get_set.h @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// GB_get_set.h: definitions for GrB_get/set methods +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#ifndef GB_GET_SET_H +#define GB_GET_SET_H +#include "GB.h" + +struct GB_Global_opaque +{ + int64_t magic ; + size_t header_size ; +} ; + +GrB_Type_Code GB_type_code_get // return the GrB_Type_Code for the code +( + const GB_Type_code code // type code to convert +) ; + +const char *GB_type_name_get (GrB_Type type) ; +const char *GB_code_name_get (GB_Type_code code, char *user_name) ; + +GrB_Info GB_matvec_name_size_get (GrB_Matrix A, size_t *value, int field) ; +GrB_Info GB_matvec_name_get (GrB_Matrix A, char *name, int field) ; +GrB_Info GB_matvec_enum_get (GrB_Matrix A, int32_t *value, int field) ; +GrB_Info GB_matvec_name_set (GrB_Matrix A, char *value, int field) ; + +GrB_Info GB_matvec_set +( + GrB_Matrix A, + bool is_vector, // true if A is a GrB_Vector + int32_t ivalue, + double dvalue, + int field, + GB_Werk Werk +) ; + +GrB_Info GB_op_enum_get (GB_Operator op, int32_t * value, GrB_Field field) ; +GrB_Info GB_op_scalar_get (GB_Operator op, GrB_Scalar value, GrB_Field field, + GB_Werk Werk) ; +GrB_Info GB_op_string_get (GB_Operator op, char * value, GrB_Field field) ; +GrB_Info GB_op_size_get (GB_Operator op, size_t * value, GrB_Field field) ; + +const char *GB_op_name_get (GB_Operator op) ; +GrB_Info GB_op_string_set (GB_Operator op, char * value, GrB_Field field) ; + +const char *GB_monoid_name_get (GrB_Monoid monoid) ; +const char *GB_semiring_name_get (GrB_Semiring semiring) ; + +GrB_Info GB_op_or_type_string_set +( + // input: + bool user_defined, + bool jitable, + char *value, + int field, + // output: + char **user_name, + size_t *user_name_size, + char *name, + int32_t *name_len, + char **defn, + size_t *defn_size, + uint64_t *hash +) ; + +GrB_Info GB_monoid_get +( + GrB_Monoid monoid, + GrB_Scalar value, + GrB_Field field, + GB_Werk Werk +) ; + +GrB_Info GB_user_name_set +( + // input/output + char **object_user_name, // user_name of the object + size_t *object_user_name_size, // user_name_size of the object + // input + const char *new_name, // new name for the object + const bool only_once // if true, the name of the object can + // only be set once +) ; + + +#endif + diff --git a/GraphBLAS/Source/GB_hyper.h b/GraphBLAS/Source/GB_hyper.h index 116575f15b..884c33e09b 100644 --- a/GraphBLAS/Source/GB_hyper.h +++ b/GraphBLAS/Source/GB_hyper.h @@ -54,10 +54,17 @@ GrB_Info GB_hyper_hash_build // construct A->Y if not already constructed GB_Werk Werk ) ; +bool GB_hyper_hash_need // return true if A needs a hyper hash +( + GrB_Matrix A +) ; + //------------------------------------------------------------------------------ // GB_lookup: find k so that j == Ah [k], without using the A->Y hyper_hash //------------------------------------------------------------------------------ +#ifdef GB_DEBUG + // For a sparse, bitmap, or full matrix j == k. // For a hypersparse matrix, find k so that j == Ah [k], if it // appears in the list. @@ -68,8 +75,7 @@ GrB_Info GB_hyper_hash_build // construct A->Y if not already constructed // pstart and pend are defined for all sparsity structures: hypersparse, // sparse, bitmap, or full. -// With the introduction of the hyper_hash, this is used only when the -// hyper_hash is too costly to build. +// With the introduction of the hyper_hash, this is used only for debugging. static inline bool GB_lookup // find j = Ah [k] ( @@ -95,14 +101,14 @@ static inline bool GB_lookup // find j = Ah [k] bool found ; GB_BINARY_SEARCH (j, Ah, (*pleft), pright, found) ; // ok (historical) if (found) - { + { // j appears in the hyperlist at Ah [pleft] // k = (*pleft) (*pstart) = Ap [(*pleft)] ; (*pend) = Ap [(*pleft)+1] ; } else - { + { // j does not appear in the hyperlist Ah // k = -1 (*pstart) = -1 ; @@ -119,6 +125,6 @@ static inline bool GB_lookup // find j = Ah [k] return (true) ; } } - +#endif #endif diff --git a/GraphBLAS/Source/GB_hyper_hash_build.c b/GraphBLAS/Source/GB_hyper_hash_build.c index 374d3a210c..78e9946ccc 100644 --- a/GraphBLAS/Source/GB_hyper_hash_build.c +++ b/GraphBLAS/Source/GB_hyper_hash_build.c @@ -35,9 +35,11 @@ GrB_Info GB_hyper_hash_build // construct A->Y if not already constructed // check inputs //-------------------------------------------------------------------------- - if (A == NULL || !GB_NEED_HYPER_HASH (A)) + if (!GB_hyper_hash_need (A)) { - // quick return: A is NULL, not hypersparse, or A->Y already computed + // quick return: A is NULL, not hypersparse, A->Y already computed, + // or A does not have enough non-empty vectors to warrant the creation + // of the A->Y hyper_hash return (GrB_SUCCESS) ; } diff --git a/GraphBLAS/Source/GB_hyper_hash_need.c b/GraphBLAS/Source/GB_hyper_hash_need.c new file mode 100644 index 0000000000..aefdcd33e8 --- /dev/null +++ b/GraphBLAS/Source/GB_hyper_hash_need.c @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// GB_hyper_hash_need: determine if a matrix needs its hyper_hash built +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +// A hypersparse matrix A can use a hyper_hash matrix A->Y to speed up access +// to its hyper list, A->h. For extremely sparse matrices, building the +// hyper_hash can be costly, however. + +// If A has pending work, this test is not useful, since the format of A can +// change, and A->nvec could change if zombies are removed and pending tuples +// assembled. This test should only be used if a matrix has no other pending +// work. + +#include "GB.h" + +bool GB_hyper_hash_need +( + GrB_Matrix A +) +{ + + if (A == NULL || !GB_IS_HYPERSPARSE (A)) + { + // only hypersparse matrices require a hyper_hash + return (false) ; + } + + if (A->Y != NULL) + { + // A already has a hyper_hash + return (false) ; + } + + // A is hypersparse, and has no hyper_hash. Check how many non-empty + // vectors it has. A->Y should be built if A has a significant number of + // non-empty vectors. + + // FUTURE: make this also a per-matrix parameter for GrB_get/set + + int64_t hyper_hash = GB_Global_hyper_hash_get ( ) ; + + return (A->nvec > hyper_hash) ; +} + diff --git a/GraphBLAS/Source/GB_hyper_shallow.c b/GraphBLAS/Source/GB_hyper_shallow.c index d3eb2e1fe1..f12a51736f 100644 --- a/GraphBLAS/Source/GB_hyper_shallow.c +++ b/GraphBLAS/Source/GB_hyper_shallow.c @@ -45,6 +45,10 @@ GrB_Matrix GB_hyper_shallow // return C C->static_header = C_static_header ; C->header_size = C_header_size ; + // remove the user_name + C->user_name = NULL ; + C->user_name_size = 0 ; + // remove the hyperlist and the hyper_hash C->h = NULL ; C->h_shallow = false ; diff --git a/GraphBLAS/Source/GB_init.c b/GraphBLAS/Source/GB_init.c index 275a7be1a0..7b55498369 100644 --- a/GraphBLAS/Source/GB_init.c +++ b/GraphBLAS/Source/GB_init.c @@ -97,7 +97,7 @@ GrB_Info GB_init // start up GraphBLAS GB_Global_GrB_init_called_set (true) ; - // GrB_init passes in the ANSI C11 malloc/calloc/realloc/free. + // GrB_init passes in the C11 malloc/calloc/realloc/free. GB_Global_malloc_function_set (malloc_function ) ; // cannot be NULL GB_Global_calloc_function_set (calloc_function ) ; // ok if NULL diff --git a/GraphBLAS/Source/GB_jitifyer.c b/GraphBLAS/Source/GB_jitifyer.c index e2364a1a28..7e96b03f04 100644 --- a/GraphBLAS/Source/GB_jitifyer.c +++ b/GraphBLAS/Source/GB_jitifyer.c @@ -548,6 +548,8 @@ GrB_Info GB_jitifyer_establish_paths (GrB_Info error_condition) // construct the c, lib, and lock paths and their 256 subfolders ok = ok && GB_jitifyer_path_256 ("c") ; + ok = ok && GB_jitifyer_path_256 ("cu") ; + ok = ok && GB_jitifyer_path_256 ("libcu") ; ok = ok && GB_jitifyer_path_256 ("lib") ; ok = ok && GB_jitifyer_path_256 ("lock") ; diff --git a/GraphBLAS/Source/GB_macrofy_cast_expression.c b/GraphBLAS/Source/GB_macrofy_cast_expression.c index 4cf5ffb64f..566ec1b071 100644 --- a/GraphBLAS/Source/GB_macrofy_cast_expression.c +++ b/GraphBLAS/Source/GB_macrofy_cast_expression.c @@ -268,7 +268,7 @@ const char *GB_macrofy_cast_expression // return cast expression { //---------------------------------------------------------------------- - // all other cases: use ANSI C11 typecasting rules + // all other cases: use C11 typecasting rules //---------------------------------------------------------------------- f = NULL ; diff --git a/GraphBLAS/Source/GB_macrofy_cast_input.c b/GraphBLAS/Source/GB_macrofy_cast_input.c index 21d105be8f..a7c8f9981d 100644 --- a/GraphBLAS/Source/GB_macrofy_cast_input.c +++ b/GraphBLAS/Source/GB_macrofy_cast_input.c @@ -66,7 +66,7 @@ void GB_macrofy_cast_input if (f == NULL) { - // ANSI C11 typecasting + // C11 typecasting ASSERT (ztype != xtype) ; fprintf (fp, "#define %s(%s,%s) %s = (%s) (%s)\n", macro_name, zarg, xargs, zarg, ztype->name, xexpr) ; diff --git a/GraphBLAS/Source/GB_macrofy_cast_output.c b/GraphBLAS/Source/GB_macrofy_cast_output.c index 31f1e55763..68990080c7 100644 --- a/GraphBLAS/Source/GB_macrofy_cast_output.c +++ b/GraphBLAS/Source/GB_macrofy_cast_output.c @@ -47,7 +47,7 @@ void GB_macrofy_cast_output if (f == NULL) { - // ANSI C11 typecasting + // C11 typecasting ASSERT (ztype != xtype) ; fprintf (fp, "#define %s(%s,%s) %s = (%s) (%s)\n", macro_name, zarg, xargs, xexpr, xtype->name, zarg) ; diff --git a/GraphBLAS/Source/GB_math.h b/GraphBLAS/Source/GB_math.h index 8bcf24b6b5..559cdf16e2 100644 --- a/GraphBLAS/Source/GB_math.h +++ b/GraphBLAS/Source/GB_math.h @@ -296,6 +296,9 @@ inline uint64_t GB_idiv_uint64 (uint64_t x, uint64_t y) // Three cases below are from ACM Algo 116, R. L. Smith, 1962. +#if !defined ( GBCUDA_CPLUSPLUS ) +// TODO: does not yet work in CUDA + inline GxB_FC64_t GB_FC64_div (GxB_FC64_t x, GxB_FC64_t y) { double xr = GB_creal (x) ; @@ -398,6 +401,8 @@ inline GxB_FC32_t GB_FC32_div (GxB_FC32_t x, GxB_FC32_t y) " return (GJ_CMPLX32 ((float) GB_creal(zz), (float) GB_cimag(zz))) ; \n" \ "}" +#endif + //------------------------------------------------------------------------------ // z = x^y: wrappers for pow, powf, cpow, and cpowf //------------------------------------------------------------------------------ @@ -479,6 +484,9 @@ inline double GB_pow (double x, double y) " return (pow (x, y)) ; \n" \ "}" +#if !defined ( GBCUDA_CPLUSPLUS ) +// TODO: does not yet work in CUDA + inline GxB_FC32_t GB_FC32_pow (GxB_FC32_t x, GxB_FC32_t y) { float xr = GB_crealf (x) ; @@ -600,6 +608,7 @@ inline GxB_FC64_t GB_FC64_pow (GxB_FC64_t x, GxB_FC64_t y) " } \n" \ " return (GB_cpow (x, y)) ; \n" \ "}" +#endif inline int8_t GB_pow_int8 (int8_t x, int8_t y) { @@ -783,6 +792,9 @@ inline double GB_signum (double x) " return ((double) ((x < 0) ? (-1) : ((x > 0) ? 1 : 0))) ; \n" \ "}" +#if !defined ( GBCUDA_CPLUSPLUS ) +// TODO: does not yet work in CUDA + inline GxB_FC32_t GB_csignumf (GxB_FC32_t x) { if (GB_crealf (x) == 0 && GB_cimagf (x) == 0) @@ -829,9 +841,9 @@ inline GxB_FC64_t GB_csignum (GxB_FC64_t x) // complex functions //------------------------------------------------------------------------------ -// The ANSI C11 math.h header defines the ceil, floor, round, trunc, +// The C11 math.h header defines the ceil, floor, round, trunc, // exp2, expm1, log10, log1pm, or log2 functions for float and double, -// but the corresponding functions do not appear in the ANSI C11 complex.h. +// but the corresponding functions do not appear in the C11 complex.h. // These functions are used instead, for float complex and double complex. //------------------------------------------------------------------------------ @@ -1246,3 +1258,5 @@ inline bool GB_cisfinite (GxB_FC64_t x) #endif +#endif + diff --git a/GraphBLAS/Source/GB_matvec_enum_get.c b/GraphBLAS/Source/GB_matvec_enum_get.c new file mode 100644 index 0000000000..69156f2ca3 --- /dev/null +++ b/GraphBLAS/Source/GB_matvec_enum_get.c @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// GB_matvec_enum_get: get an enum field from a matrix +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_matvec_enum_get (GrB_Matrix A, int32_t *value, int field) +{ + switch (field) + { + case GrB_STORAGE_ORIENTATION_HINT : + + (*value) = (A->is_csc) ? GrB_COLMAJOR : GrB_ROWMAJOR ; + break ; + + case GrB_EL_TYPE_CODE : + + (*value) = GB_type_code_get (A->type->code) ; + break ; + + case GxB_SPARSITY_CONTROL : + + (*value) = A->sparsity_control ; + break ; + + case GxB_SPARSITY_STATUS : + + (*value) = GB_sparsity (A) ; + break ; + + case GxB_FORMAT : + + (*value) = (A->is_csc) ? GxB_BY_COL : GxB_BY_ROW ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_matvec_name_get.c b/GraphBLAS/Source/GB_matvec_name_get.c new file mode 100644 index 0000000000..43aaae300e --- /dev/null +++ b/GraphBLAS/Source/GB_matvec_name_get.c @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// GB_matvec_name_get: get a name of a matrix or its type +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_matvec_name_get (GrB_Matrix A, char *name, int field) +{ + const char *typename ; + (*name) = '\0' ; + + switch (field) + { + + case GrB_NAME : + if (A->user_name != NULL) + { + strcpy (name, A->user_name) ; + } + break ; + + case GxB_JIT_C_NAME : + strcpy (name, A->type->name) ; + break ; + + case GrB_EL_TYPE_STRING : + typename = GB_type_name_get (A->type) ; + if (typename != NULL) + { + strcpy (name, typename) ; + } + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_matvec_name_set.c b/GraphBLAS/Source/GB_matvec_name_set.c new file mode 100644 index 0000000000..f0747f4075 --- /dev/null +++ b/GraphBLAS/Source/GB_matvec_name_set.c @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// GB_matvec_name_set: set the user_name of a matrix/vector/scalar +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_matvec_name_set +( + GrB_Matrix A, + char *value, + int field +) +{ + + if (field != GrB_NAME) + { + return (GrB_INVALID_VALUE) ; + } + + return (GB_user_name_set (&(A->user_name), &(A->user_name_size), value, + false)) ; +} + diff --git a/GraphBLAS/Source/GB_matvec_name_size_get.c b/GraphBLAS/Source/GB_matvec_name_size_get.c new file mode 100644 index 0000000000..85fcd12ff7 --- /dev/null +++ b/GraphBLAS/Source/GB_matvec_name_size_get.c @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// GB_matvec_name_size_get: get max size of a matrix/vector/scalar name or type +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_matvec_name_size_get (GrB_Matrix A, size_t *value, int field) +{ + const char *name = NULL ; + + switch (field) + { + + case GrB_NAME : + name = A->user_name ; + break ; + + case GxB_JIT_C_NAME : + name = A->type->name ; + break ; + + case GrB_EL_TYPE_STRING : + name = GB_type_name_get (A->type) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + (*value) = (name == NULL) ? 1 : (strlen (name) + 1) ; + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_matvec_set.c b/GraphBLAS/Source/GB_matvec_set.c new file mode 100644 index 0000000000..2d6139d82b --- /dev/null +++ b/GraphBLAS/Source/GB_matvec_set.c @@ -0,0 +1,94 @@ +//------------------------------------------------------------------------------ +// GB_matvec_set: set a field in a matrix or vector +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" +#include "GB_transpose.h" +#define GB_FREE_ALL ; + +GrB_Info GB_matvec_set +( + GrB_Matrix A, + bool is_vector, // true if A is a GrB_Vector + int ivalue, + double dvalue, + int field, + GB_Werk Werk +) +{ + + GrB_Info info ; + GB_BURBLE_START ("GrB_set") ; + + int format = ivalue ; + + switch (field) + { + + case GxB_HYPER_SWITCH : + + if (is_vector) + { + return (GrB_INVALID_VALUE) ; + } + A->hyper_switch = (float) dvalue ; + break ; + + case GxB_BITMAP_SWITCH : + + A->bitmap_switch = (float) dvalue ; + break ; + + case GxB_SPARSITY_CONTROL : + + A->sparsity_control = GB_sparsity_control (ivalue, (int64_t) (-1)) ; + break ; + + case GrB_STORAGE_ORIENTATION_HINT : + + format = (ivalue == GrB_COLMAJOR) ? GxB_BY_COL : GxB_BY_ROW ; + // fall through to the GxB_FORMAT case + + case GxB_FORMAT : + + if (is_vector) + { + // the hint is ignored + return (GrB_SUCCESS) ; + } + if (! (format == GxB_BY_ROW || format == GxB_BY_COL)) + { + return (GrB_INVALID_VALUE) ; + } + bool new_csc = (format != 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, Werk)) ; + 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, Werk)) ; + GB_BURBLE_END ; + ASSERT_MATRIX_OK (A, "A set after conform", GB0) ; + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_monoid_get.c b/GraphBLAS/Source/GB_monoid_get.c new file mode 100644 index 0000000000..00fbe8e15f --- /dev/null +++ b/GraphBLAS/Source/GB_monoid_get.c @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// GB_monoid_get: get a field in a monoid +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_monoid_get +( + GrB_Monoid monoid, + GrB_Scalar value, + GrB_Field field, + GB_Werk Werk +) +{ + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + case GrB_INP0_TYPE_CODE : + case GrB_INP1_TYPE_CODE : + case GrB_OUTP_TYPE_CODE : + + return (GB_op_scalar_get ((GB_Operator) monoid->op, value, field, + Werk)) ; + + case GxB_MONOID_IDENTITY : + + if (value->type != monoid->op->ztype) + { + // scalar type must match the monoid type + return (GrB_DOMAIN_MISMATCH) ; + } + return (GB_setElement ((GrB_Matrix) value, NULL, + monoid->identity, 0, 0, monoid->op->ztype->code, Werk)) ; + + case GxB_MONOID_TERMINAL : + + if (value->type != monoid->op->ztype) + { + // scalar type must match the monoid type + return (GrB_DOMAIN_MISMATCH) ; + } + if (monoid->terminal == NULL) + { + // monoid is not terminal: clear the output scalar. + // This is not an error + return (GB_clear ((GrB_Matrix) value, Werk)) ; + } + else + { + // monoid is terminal: return the terminal value. + return (GB_setElement ((GrB_Matrix) value, NULL, + monoid->terminal, 0, 0, monoid->op->ztype->code, + Werk)) ; + } + + default : + return (GrB_INVALID_VALUE) ; + } +} + diff --git a/GraphBLAS/Source/GB_monoid_name_get.c b/GraphBLAS/Source/GB_monoid_name_get.c new file mode 100644 index 0000000000..222bab4c6c --- /dev/null +++ b/GraphBLAS/Source/GB_monoid_name_get.c @@ -0,0 +1,213 @@ +//------------------------------------------------------------------------------ +// GB_monoid_name_get: get the name of a built-in monoid +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +const char *GB_monoid_name_get (GrB_Monoid monoid) +{ + + if (monoid->user_name_size > 0) + { + // user-defined monoid, with name defined by GrB_set + return (monoid->user_name) ; + } + + GB_Opcode opcode = monoid->op->opcode ; + GB_Type_code zcode = monoid->op->ztype->code ; + + switch (opcode) + { + + case GB_ANY_binop_code : // z = x or y + + switch (zcode) + { + case GB_BOOL_code : return ("GxB_ANY_BOOL_MONOID" ) ; + case GB_INT8_code : return ("GxB_ANY_INT8_MONOID" ) ; + case GB_INT16_code : return ("GxB_ANY_INT16_MONOID" ) ; + case GB_INT32_code : return ("GxB_ANY_INT32_MONOID" ) ; + case GB_INT64_code : return ("GxB_ANY_INT64_MONOID" ) ; + case GB_UINT8_code : return ("GxB_ANY_UINT8_MONOID" ) ; + case GB_UINT16_code : return ("GxB_ANY_UINT16_MONOID") ; + case GB_UINT32_code : return ("GxB_ANY_UINT32_MONOID") ; + case GB_UINT64_code : return ("GxB_ANY_UINT64_MONOID") ; + case GB_FP32_code : return ("GxB_ANY_FP32_MONOID" ) ; + case GB_FP64_code : return ("GxB_ANY_FP64_MONOID" ) ; + case GB_FC32_code : return ("GxB_ANY_FC32_MONOID" ) ; + case GB_FC64_code : return ("GxB_ANY_FC64_MONOID" ) ; + default :; + } + break ; + + case GB_MIN_binop_code : // z = min(x,y) + + switch (zcode) + { + case GB_INT8_code : return ("GrB_MIN_MONOID_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_MONOID_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_MONOID_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_MONOID_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_MONOID_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_MONOID_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_MONOID_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_MONOID_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_MONOID_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_MONOID_FP64" ) ; + default :; + } + break ; + + case GB_MAX_binop_code : // z = max(x,y) + + switch (zcode) + { + case GB_INT8_code : return ("GrB_MAX_MONOID_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_MONOID_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_MONOID_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_MONOID_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_MONOID_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_MONOID_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_MONOID_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_MONOID_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_MONOID_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_MONOID_FP64" ) ; + default :; + } + break ; + + case GB_PLUS_binop_code : // z = x + y + + switch (zcode) + { + case GB_INT8_code : return ("GrB_PLUS_MONOID_INT8" ) ; + case GB_INT16_code : return ("GrB_PLUS_MONOID_INT16" ) ; + case GB_INT32_code : return ("GrB_PLUS_MONOID_INT32" ) ; + case GB_INT64_code : return ("GrB_PLUS_MONOID_INT64" ) ; + case GB_UINT8_code : return ("GrB_PLUS_MONOID_UINT8" ) ; + case GB_UINT16_code : return ("GrB_PLUS_MONOID_UINT16") ; + case GB_UINT32_code : return ("GrB_PLUS_MONOID_UINT32") ; + case GB_UINT64_code : return ("GrB_PLUS_MONOID_UINT64") ; + case GB_FP32_code : return ("GrB_PLUS_MONOID_FP32" ) ; + case GB_FP64_code : return ("GrB_PLUS_MONOID_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_FC32_MONOID" ) ; + case GB_FC64_code : return ("GxB_PLUS_FC64_MONOID" ) ; + default :; + } + break ; + + case GB_TIMES_binop_code : // z = x * y + + switch (zcode) + { + case GB_INT8_code : return ("GrB_TIMES_MONOID_INT8" ) ; + case GB_INT16_code : return ("GrB_TIMES_MONOID_INT16" ) ; + case GB_INT32_code : return ("GrB_TIMES_MONOID_INT32" ) ; + case GB_INT64_code : return ("GrB_TIMES_MONOID_INT64" ) ; + case GB_UINT8_code : return ("GrB_TIMES_MONOID_UINT8" ) ; + case GB_UINT16_code : return ("GrB_TIMES_MONOID_UINT16") ; + case GB_UINT32_code : return ("GrB_TIMES_MONOID_UINT32") ; + case GB_UINT64_code : return ("GrB_TIMES_MONOID_UINT64") ; + case GB_FP32_code : return ("GrB_TIMES_MONOID_FP32" ) ; + case GB_FP64_code : return ("GrB_TIMES_MONOID_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_FC32_MONOID" ) ; + case GB_FC64_code : return ("GxB_TIMES_FC64_MONOID" ) ; + default :; + } + break ; + + case GB_LOR_binop_code : // z = (x != 0) || (y != 0) + + switch (zcode) + { + case GB_BOOL_code : return ("GrB_LOR_MONOID_BOOL") ; + default :; + } + break ; + + case GB_LAND_binop_code : // z = (x != 0) && (y != 0) + + switch (zcode) + { + case GB_BOOL_code : return ("GrB_LAND_MONOID_BOOL") ; + default :; + } + break ; + + case GB_LXOR_binop_code : // z = (x != 0) != (y != 0) + + switch (zcode) + { + case GB_BOOL_code : return ("GrB_LXOR_MONOID_BOOL") ; + default :; + } + break ; + + case GB_EQ_binop_code : // z = (x == y), is LXNOR for bool + + switch (zcode) + { + case GB_BOOL_code : return ("GrB_LXNOR_MONOID_BOOL") ; + default :; + } + break ; + + case GB_BOR_binop_code : // z = (x | y), bitwise or + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BOR_UINT8_MONOID" ) ; + case GB_UINT16_code : return ("GxB_BOR_UINT16_MONOID") ; + case GB_UINT32_code : return ("GxB_BOR_UINT32_MONOID") ; + case GB_UINT64_code : return ("GxB_BOR_UINT64_MONOID") ; + default :; + } + break ; + + case GB_BAND_binop_code : // z = (x & y), bitwise and + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BAND_UINT8_MONOID" ) ; + case GB_UINT16_code : return ("GxB_BAND_UINT16_MONOID") ; + case GB_UINT32_code : return ("GxB_BAND_UINT32_MONOID") ; + case GB_UINT64_code : return ("GxB_BAND_UINT64_MONOID") ; + default :; + } + break ; + + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXOR_UINT8_MONOID" ) ; + case GB_UINT16_code : return ("GxB_BXOR_UINT16_MONOID") ; + case GB_UINT32_code : return ("GxB_BXOR_UINT32_MONOID") ; + case GB_UINT64_code : return ("GxB_BXOR_UINT64_MONOID") ; + default :; + } + break ; + + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXNOR_UINT8_MONOID" ) ; + case GB_UINT16_code : return ("GxB_BXNOR_UINT16_MONOID") ; + case GB_UINT32_code : return ("GxB_BXNOR_UINT32_MONOID") ; + case GB_UINT64_code : return ("GxB_BXNOR_UINT64_MONOID") ; + default :; + } + break ; + + default: ; + } + + return (NULL) ; +} + diff --git a/GraphBLAS/Source/GB_new.c b/GraphBLAS/Source/GB_new.c index b92a4a20ac..7731d4b053 100644 --- a/GraphBLAS/Source/GB_new.c +++ b/GraphBLAS/Source/GB_new.c @@ -91,6 +91,8 @@ GrB_Info GB_new // create matrix, except for indices & values // basic information A->magic = GB_MAGIC2 ; // object is not yet valid A->type = type ; + A->user_name = NULL ; + A->user_name_size = 0 ; // no user_name yet A->logger = NULL ; // no error logged yet A->logger_size = 0 ; diff --git a/GraphBLAS/Source/GB_op.h b/GraphBLAS/Source/GB_op.h index 1cc2e0e1e0..6b41cc4250 100644 --- a/GraphBLAS/Source/GB_op.h +++ b/GraphBLAS/Source/GB_op.h @@ -32,8 +32,6 @@ GrB_Info GB_op_name_and_defn // input const char *input_name, // user-provided name, may be NULL const char *input_defn, // user-provided name, may be NULL - const char *typecast_name, // typecast name for function pointer - size_t typecast_len, // length of typecast_name bool user_op, // if true, a user-defined op bool jitable // if true, the op can be JIT'd ) ; diff --git a/GraphBLAS/Source/GB_op_enum_get.c b/GraphBLAS/Source/GB_op_enum_get.c new file mode 100644 index 0000000000..f2557fec26 --- /dev/null +++ b/GraphBLAS/Source/GB_op_enum_get.c @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// GB_op_enum_get: get a field in an op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_op_enum_get +( + GB_Operator op, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + GrB_Type type = NULL ; + (*value) = -1 ; + + switch ((int) field) + { + case GrB_INP0_TYPE_CODE : type = op->xtype ; break ; + case GrB_INP1_TYPE_CODE : type = op->ytype ; break ; + case GrB_OUTP_TYPE_CODE : type = op->ztype ; break ; + default : ; + return (GrB_INVALID_VALUE) ; + } + + if (type == NULL) + { + // operator does not depend on this input + return (GrB_NO_VALUE) ; + } + + (*value) = (int32_t) GB_type_code_get (type->code) ; + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_op_name_and_defn.c b/GraphBLAS/Source/GB_op_name_and_defn.c index bf89b71ffd..f3b2bb73b7 100644 --- a/GraphBLAS/Source/GB_op_name_and_defn.c +++ b/GraphBLAS/Source/GB_op_name_and_defn.c @@ -26,10 +26,8 @@ GrB_Info GB_op_name_and_defn // input const char *input_name, // user-provided name, may be NULL const char *input_defn, // user-provided name, may be NULL - const char *typecast_name, // typecast name for function pointer - size_t typecast_len, // length of typecast_name bool user_op, // if true, a user-defined op - bool jitable // if false, the op cannot be JIT'd + bool jitable // if true, the op can be JIT'd ) { @@ -39,7 +37,6 @@ GrB_Info GB_op_name_and_defn ASSERT (op_name != NULL) ; ASSERT (op_defn != NULL) ; - ASSERT (typecast_name != NULL) ; ASSERT (op_defn_size != NULL) ; (*op_defn) = NULL ; (*op_defn_size) = 0 ; @@ -51,54 +48,22 @@ GrB_Info GB_op_name_and_defn // note: this can get a mangled name; see the BF methods in LAGraph memset (op_name, 0, GxB_MAX_NAME_LEN) ; - if (!user_op) - { - // FIRST_UDT operator created by GB_reduce_to_vector or - // SECOND_UDT operator created by GB_wait - ASSERT (input_name != NULL) ; - strncpy (op_name, input_name, GxB_MAX_NAME_LEN-1) ; - } - else if (input_name != NULL) + if (input_name != NULL) { - // copy the input_name into the working name - char working [GxB_MAX_NAME_LEN] ; - memset (working, 0, GxB_MAX_NAME_LEN) ; - strncpy (working, input_name, GxB_MAX_NAME_LEN-1) ; - // see if the typecast appears in the input_name - char *p = NULL ; - p = strstr (working, typecast_name) ; - if (p != NULL) - { - // skip past the typecast, the left parenthesis, and any whitespace - p += typecast_len ; - while (isspace (*p)) p++ ; - if (*p == ')') p++ ; - while (isspace (*p)) p++ ; - // p now contains the final name, copy it to the output name - strncpy (op_name, p, GxB_MAX_NAME_LEN-1) ; - } - else - { - // no typcast appears; copy the entire op_name as-is - memcpy (op_name, working, GxB_MAX_NAME_LEN) ; - } - } - else - { - // the user-defined op has no name, so give it a generic name - strncpy (op_name, "user_op", GxB_MAX_NAME_LEN-1) ; + // copy the input_name + strncpy (op_name, input_name, GxB_MAX_NAME_LEN-1) ; } // ensure op_name is null-terminated op_name [GxB_MAX_NAME_LEN-1] = '\0' ; - // get the operator name length and hash the name + // get the operator name length (zero if no name given) (*op_name_len) = (int32_t) strlen (op_name) ; // a user-defined op can only be JIT'd if it has a name and defn. // a new builtin op (created by GB_reduce_to_vector) can always be JIT'd. (*op_hash) = GB_jitifyer_hash (op_name, (*op_name_len), - jitable && (!user_op || (input_name != NULL && input_defn != NULL))) ; + jitable && (!user_op || (*op_name_len) > 0)) ; //-------------------------------------------------------------------------- // get the definition of the operator, if present diff --git a/GraphBLAS/Source/GB_op_name_get.c b/GraphBLAS/Source/GB_op_name_get.c new file mode 100644 index 0000000000..e7a5af1132 --- /dev/null +++ b/GraphBLAS/Source/GB_op_name_get.c @@ -0,0 +1,1702 @@ +//------------------------------------------------------------------------------ +// GB_op_name_get: get the user_name of any operator +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +// Three operators are left unnamed: identity_udt, 1st_udt, and 2nd_udt. +// These are created by GB_unop_identity, GB_reduce_to_vector, and +// GB_binop_second, and do not exist outside GraphBLAS. The user application +// cannot pass them to GrB_get. + +#include "GB_get_set.h" + +const char *GB_op_name_get (GB_Operator op) +{ + + GB_Opcode opcode = op->opcode ; + GB_Type_code xcode = (op->xtype == NULL) ? 0 : op->xtype->code ; + GB_Type_code zcode = (op->ztype == NULL) ? 0 : op->ztype->code ; + + switch (opcode) + { + + case GB_NOP_code : return ("GxB_IGNORE_DUP") ; + + //---------------------------------------------------------------------- + // unary operators + //---------------------------------------------------------------------- + + case GB_ONE_unop_code : // z = 1 + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ONE_BOOL" ) ; + case GB_INT8_code : return ("GxB_ONE_INT8" ) ; + case GB_INT16_code : return ("GxB_ONE_INT16" ) ; + case GB_INT32_code : return ("GxB_ONE_INT32" ) ; + case GB_INT64_code : return ("GxB_ONE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ONE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ONE_UINT16") ; + case GB_UINT32_code : return ("GxB_ONE_UINT32") ; + case GB_UINT64_code : return ("GxB_ONE_UINT64") ; + case GB_FP32_code : return ("GxB_ONE_FP32" ) ; + case GB_FP64_code : return ("GxB_ONE_FP64" ) ; + case GB_FC32_code : return ("GxB_ONE_FC32" ) ; + case GB_FC64_code : return ("GxB_ONE_FC64" ) ; + default :; + } + break ; + + case GB_IDENTITY_unop_code : // z = x + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_IDENTITY_BOOL" ) ; + case GB_INT8_code : return ("GrB_IDENTITY_INT8" ) ; + case GB_INT16_code : return ("GrB_IDENTITY_INT16" ) ; + case GB_INT32_code : return ("GrB_IDENTITY_INT32" ) ; + case GB_INT64_code : return ("GrB_IDENTITY_INT64" ) ; + case GB_UINT8_code : return ("GrB_IDENTITY_UINT8" ) ; + case GB_UINT16_code : return ("GrB_IDENTITY_UINT16") ; + case GB_UINT32_code : return ("GrB_IDENTITY_UINT32") ; + case GB_UINT64_code : return ("GrB_IDENTITY_UINT64") ; + case GB_FP32_code : return ("GrB_IDENTITY_FP32" ) ; + case GB_FP64_code : return ("GrB_IDENTITY_FP64" ) ; + case GB_FC32_code : return ("GxB_IDENTITY_FC32" ) ; + case GB_FC64_code : return ("GxB_IDENTITY_FC64" ) ; + // see GB_unop_identity: +// case GB_UDT_code : +// return ("identity_udt") ; + default :; + } + break ; + + case GB_AINV_unop_code : // z = -x + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_AINV_BOOL" ) ; + case GB_INT8_code : return ("GrB_AINV_INT8" ) ; + case GB_INT16_code : return ("GrB_AINV_INT16" ) ; + case GB_INT32_code : return ("GrB_AINV_INT32" ) ; + case GB_INT64_code : return ("GrB_AINV_INT64" ) ; + case GB_UINT8_code : return ("GrB_AINV_UINT8" ) ; + case GB_UINT16_code : return ("GrB_AINV_UINT16") ; + case GB_UINT32_code : return ("GrB_AINV_UINT32") ; + case GB_UINT64_code : return ("GrB_AINV_UINT64") ; + case GB_FP32_code : return ("GrB_AINV_FP32" ) ; + case GB_FP64_code : return ("GrB_AINV_FP64" ) ; + case GB_FC32_code : return ("GxB_AINV_FC32" ) ; + case GB_FC64_code : return ("GxB_AINV_FC64" ) ; + default :; + } + break ; + + case GB_ABS_unop_code : // z = abs(x) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_ABS_BOOL" ) ; + case GB_INT8_code : return ("GrB_ABS_INT8" ) ; + case GB_INT16_code : return ("GrB_ABS_INT16" ) ; + case GB_INT32_code : return ("GrB_ABS_INT32" ) ; + case GB_INT64_code : return ("GrB_ABS_INT64" ) ; + case GB_UINT8_code : return ("GrB_ABS_UINT8" ) ; + case GB_UINT16_code : return ("GrB_ABS_UINT16") ; + case GB_UINT32_code : return ("GrB_ABS_UINT32") ; + case GB_UINT64_code : return ("GrB_ABS_UINT64") ; + case GB_FP32_code : return ("GrB_ABS_FP32" ) ; + case GB_FP64_code : return ("GrB_ABS_FP64" ) ; + case GB_FC32_code : return ("GxB_ABS_FC32" ) ; + case GB_FC64_code : return ("GxB_ABS_FC64" ) ; + default :; + } + break ; + + case GB_MINV_unop_code : // z = 1/x + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_MINV_BOOL" ) ; + case GB_INT8_code : return ("GrB_MINV_INT8" ) ; + case GB_INT16_code : return ("GrB_MINV_INT16" ) ; + case GB_INT32_code : return ("GrB_MINV_INT32" ) ; + case GB_INT64_code : return ("GrB_MINV_INT64" ) ; + case GB_UINT8_code : return ("GrB_MINV_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MINV_UINT16") ; + case GB_UINT32_code : return ("GrB_MINV_UINT32") ; + case GB_UINT64_code : return ("GrB_MINV_UINT64") ; + case GB_FP32_code : return ("GrB_MINV_FP32" ) ; + case GB_FP64_code : return ("GrB_MINV_FP64" ) ; + case GB_FC32_code : return ("GxB_MINV_FC32" ) ; + case GB_FC64_code : return ("GxB_MINV_FC64" ) ; + default :; + } + break ; + + case GB_LNOT_unop_code : // z = !x + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LNOT" ) ; + case GB_INT8_code : return ("GxB_LNOT_INT8" ) ; + case GB_INT16_code : return ("GxB_LNOT_INT16" ) ; + case GB_INT32_code : return ("GxB_LNOT_INT32" ) ; + case GB_INT64_code : return ("GxB_LNOT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LNOT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LNOT_UINT16") ; + case GB_UINT32_code : return ("GxB_LNOT_UINT32") ; + case GB_UINT64_code : return ("GxB_LNOT_UINT64") ; + case GB_FP32_code : return ("GxB_LNOT_FP32" ) ; + case GB_FP64_code : return ("GxB_LNOT_FP64" ) ; + default :; + } + break ; + + case GB_BNOT_unop_code : // z = ~x + + switch (xcode) + { + case GB_INT8_code : return ("GrB_BNOT_INT8" ) ; + case GB_INT16_code : return ("GrB_BNOT_INT16" ) ; + case GB_INT32_code : return ("GrB_BNOT_INT32" ) ; + case GB_INT64_code : return ("GrB_BNOT_INT64" ) ; + case GB_UINT8_code : return ("GrB_BNOT_UINT8" ) ; + case GB_UINT16_code : return ("GrB_BNOT_UINT16") ; + case GB_UINT32_code : return ("GrB_BNOT_UINT32") ; + case GB_UINT64_code : return ("GrB_BNOT_UINT64") ; + default :; + } + break ; + + case GB_SQRT_unop_code : // z = sqrt (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_SQRT_FP32") ; + case GB_FP64_code : return ("GxB_SQRT_FP64") ; + case GB_FC32_code : return ("GxB_SQRT_FC32") ; + case GB_FC64_code : return ("GxB_SQRT_FC64") ; + default :; + } + break ; + + case GB_LOG_unop_code : // z = log (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_LOG_FP32") ; + case GB_FP64_code : return ("GxB_LOG_FP64") ; + case GB_FC32_code : return ("GxB_LOG_FC32") ; + case GB_FC64_code : return ("GxB_LOG_FC64") ; + default :; + } + break ; + + case GB_EXP_unop_code : // z = exp (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_EXP_FP32") ; + case GB_FP64_code : return ("GxB_EXP_FP64") ; + case GB_FC32_code : return ("GxB_EXP_FC32") ; + case GB_FC64_code : return ("GxB_EXP_FC64") ; + default :; + } + break ; + + case GB_SIN_unop_code : // z = sin (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_SIN_FP32") ; + case GB_FP64_code : return ("GxB_SIN_FP64") ; + case GB_FC32_code : return ("GxB_SIN_FC32") ; + case GB_FC64_code : return ("GxB_SIN_FC64") ; + default :; + } + break ; + + case GB_COS_unop_code : // z = cos (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_COS_FP32") ; + case GB_FP64_code : return ("GxB_COS_FP64") ; + case GB_FC32_code : return ("GxB_COS_FC32") ; + case GB_FC64_code : return ("GxB_COS_FC64") ; + default :; + } + break ; + + case GB_TAN_unop_code : // z = tan (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_TAN_FP32") ; + case GB_FP64_code : return ("GxB_TAN_FP64") ; + case GB_FC32_code : return ("GxB_TAN_FC32") ; + case GB_FC64_code : return ("GxB_TAN_FC64") ; + default :; + } + break ; + + case GB_ASIN_unop_code : // z = asin (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ASIN_FP32") ; + case GB_FP64_code : return ("GxB_ASIN_FP64") ; + case GB_FC32_code : return ("GxB_ASIN_FC32") ; + case GB_FC64_code : return ("GxB_ASIN_FC64") ; + default :; + } + break ; + + case GB_ACOS_unop_code : // z = acos (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ACOS_FP32") ; + case GB_FP64_code : return ("GxB_ACOS_FP64") ; + case GB_FC32_code : return ("GxB_ACOS_FC32") ; + case GB_FC64_code : return ("GxB_ACOS_FC64") ; + default :; + } + break ; + + case GB_ATAN_unop_code : // z = atan (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ATAN_FP32") ; + case GB_FP64_code : return ("GxB_ATAN_FP64") ; + case GB_FC32_code : return ("GxB_ATAN_FC32") ; + case GB_FC64_code : return ("GxB_ATAN_FC64") ; + default :; + } + break ; + + case GB_SINH_unop_code : // z = sinh (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_SINH_FP32") ; + case GB_FP64_code : return ("GxB_SINH_FP64") ; + case GB_FC32_code : return ("GxB_SINH_FC32") ; + case GB_FC64_code : return ("GxB_SINH_FC64") ; + default :; + } + break ; + + case GB_COSH_unop_code : // z = cosh (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_COSH_FP32") ; + case GB_FP64_code : return ("GxB_COSH_FP64") ; + case GB_FC32_code : return ("GxB_COSH_FC32") ; + case GB_FC64_code : return ("GxB_COSH_FC64") ; + default :; + } + break ; + + case GB_TANH_unop_code : // z = tanh (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_TANH_FP32") ; + case GB_FP64_code : return ("GxB_TANH_FP64") ; + case GB_FC32_code : return ("GxB_TANH_FC32") ; + case GB_FC64_code : return ("GxB_TANH_FC64") ; + default :; + } + break ; + + case GB_ASINH_unop_code : // z = asinh (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ASINH_FP32") ; + case GB_FP64_code : return ("GxB_ASINH_FP64") ; + case GB_FC32_code : return ("GxB_ASINH_FC32") ; + case GB_FC64_code : return ("GxB_ASINH_FC64") ; + default :; + } + break ; + + case GB_ACOSH_unop_code : // z = acosh (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ACOSH_FP32") ; + case GB_FP64_code : return ("GxB_ACOSH_FP64") ; + case GB_FC32_code : return ("GxB_ACOSH_FC32") ; + case GB_FC64_code : return ("GxB_ACOSH_FC64") ; + default :; + } + break ; + + case GB_ATANH_unop_code : // z = atanh (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ATANH_FP32") ; + case GB_FP64_code : return ("GxB_ATANH_FP64") ; + case GB_FC32_code : return ("GxB_ATANH_FC32") ; + case GB_FC64_code : return ("GxB_ATANH_FC64") ; + default :; + } + break ; + + case GB_SIGNUM_unop_code : // z = signum (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_SIGNUM_FP32") ; + case GB_FP64_code : return ("GxB_SIGNUM_FP64") ; + case GB_FC32_code : return ("GxB_SIGNUM_FC32") ; + case GB_FC64_code : return ("GxB_SIGNUM_FC64") ; + default :; + } + break ; + + case GB_CEIL_unop_code : // z = ceil (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_CEIL_FP32") ; + case GB_FP64_code : return ("GxB_CEIL_FP64") ; + case GB_FC32_code : return ("GxB_CEIL_FC32") ; + case GB_FC64_code : return ("GxB_CEIL_FC64") ; + default :; + } + break ; + + case GB_FLOOR_unop_code : // z = floor (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_FLOOR_FP32") ; + case GB_FP64_code : return ("GxB_FLOOR_FP64") ; + case GB_FC32_code : return ("GxB_FLOOR_FC32") ; + case GB_FC64_code : return ("GxB_FLOOR_FC64") ; + default :; + } + break ; + + case GB_ROUND_unop_code : // z = round (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ROUND_FP32") ; + case GB_FP64_code : return ("GxB_ROUND_FP64") ; + case GB_FC32_code : return ("GxB_ROUND_FC32") ; + case GB_FC64_code : return ("GxB_ROUND_FC64") ; + default :; + } + break ; + + case GB_TRUNC_unop_code : // z = trunc (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_TRUNC_FP32") ; + case GB_FP64_code : return ("GxB_TRUNC_FP64") ; + case GB_FC32_code : return ("GxB_TRUNC_FC32") ; + case GB_FC64_code : return ("GxB_TRUNC_FC64") ; + default :; + } + break ; + + case GB_EXP2_unop_code : // z = exp2 (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_EXP2_FP32") ; + case GB_FP64_code : return ("GxB_EXP2_FP64") ; + case GB_FC32_code : return ("GxB_EXP2_FC32") ; + case GB_FC64_code : return ("GxB_EXP2_FC64") ; + default :; + } + break ; + + case GB_EXPM1_unop_code : // z = expm1 (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_EXPM1_FP32") ; + case GB_FP64_code : return ("GxB_EXPM1_FP64") ; + case GB_FC32_code : return ("GxB_EXPM1_FC32") ; + case GB_FC64_code : return ("GxB_EXPM1_FC64") ; + default :; + } + break ; + + case GB_LOG10_unop_code : // z = log10 (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_LOG10_FP32") ; + case GB_FP64_code : return ("GxB_LOG10_FP64") ; + case GB_FC32_code : return ("GxB_LOG10_FC32") ; + case GB_FC64_code : return ("GxB_LOG10_FC64") ; + default :; + } + break ; + + case GB_LOG1P_unop_code : // z = log1P (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_LOG1P_FP32") ; + case GB_FP64_code : return ("GxB_LOG1P_FP64") ; + case GB_FC32_code : return ("GxB_LOG1P_FC32") ; + case GB_FC64_code : return ("GxB_LOG1P_FC64") ; + default :; + } + break ; + + case GB_LOG2_unop_code : // z = log2 (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_LOG2_FP32") ; + case GB_FP64_code : return ("GxB_LOG2_FP64") ; + case GB_FC32_code : return ("GxB_LOG2_FC32") ; + case GB_FC64_code : return ("GxB_LOG2_FC64") ; + default :; + } + break ; + + case GB_LGAMMA_unop_code : // z = lgamma (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_LGAMMA_FP32") ; + case GB_FP64_code : return ("GxB_LGAMMA_FP64") ; + default :; + } + break ; + + case GB_TGAMMA_unop_code : // z = tgamma (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_TGAMMA_FP32") ; + case GB_FP64_code : return ("GxB_TGAMMA_FP64") ; + default :; + } + break ; + + case GB_ERF_unop_code : // z = erf (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ERF_FP32") ; + case GB_FP64_code : return ("GxB_ERF_FP64") ; + default :; + } + break ; + + case GB_ERFC_unop_code : // z = erfc (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ERFC_FP32") ; + case GB_FP64_code : return ("GxB_ERFC_FP64") ; + default :; + } + break ; + + case GB_CBRT_unop_code : // z = cbrt (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_CBRT_FP32") ; + case GB_FP64_code : return ("GxB_CBRT_FP64") ; + default :; + } + break ; + + case GB_FREXPX_unop_code : // z = frexpx (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_FREXPX_FP32") ; + case GB_FP64_code : return ("GxB_FREXPX_FP64") ; + default :; + } + break ; + + case GB_FREXPE_unop_code : // z = frexpe (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_FREXPE_FP32") ; + case GB_FP64_code : return ("GxB_FREXPE_FP64") ; + default :; + } + break ; + + case GB_CONJ_unop_code : // z = conj (x) + + switch (xcode) + { + case GB_FC32_code : return ("GxB_CONJ_FC32") ; + case GB_FC64_code : return ("GxB_CONJ_FC64") ; + default :; + } + break ; + + case GB_CREAL_unop_code : // z = creal (x) + + switch (xcode) + { + case GB_FC32_code : return ("GxB_CREAL_FC32") ; + case GB_FC64_code : return ("GxB_CREAL_FC64") ; + default :; + } + break ; + + case GB_CIMAG_unop_code : // z = cimag (x) + + switch (xcode) + { + case GB_FC32_code : return ("GxB_CIMAG_FC32") ; + case GB_FC64_code : return ("GxB_CIMAG_FC64") ; + default :; + } + break ; + + case GB_CARG_unop_code : // z = carg (x) + + switch (xcode) + { + case GB_FC32_code : return ("GxB_CARG_FC32") ; + case GB_FC64_code : return ("GxB_CARG_FC64") ; + default :; + } + break ; + + case GB_ISINF_unop_code : // z = isinf (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ISINF_FP32") ; + case GB_FP64_code : return ("GxB_ISINF_FP64") ; + case GB_FC32_code : return ("GxB_ISINF_FC32") ; + case GB_FC64_code : return ("GxB_ISINF_FC64") ; + default :; + } + break ; + + case GB_ISNAN_unop_code : // z = isnan (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ISNAN_FP32") ; + case GB_FP64_code : return ("GxB_ISNAN_FP64") ; + case GB_FC32_code : return ("GxB_ISNAN_FC32") ; + case GB_FC64_code : return ("GxB_ISNAN_FC64") ; + default :; + } + break ; + + case GB_ISFINITE_unop_code : // z = isfinite (x) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ISFINITE_FP32") ; + case GB_FP64_code : return ("GxB_ISFINITE_FP64") ; + case GB_FC32_code : return ("GxB_ISFINITE_FC32") ; + case GB_FC64_code : return ("GxB_ISFINITE_FC64") ; + default :; + } + break ; + + case GB_POSITIONI_unop_code : // z = position_i(A(i,j)) == i + + switch (zcode) + { + case GB_INT32_code : return ("GxB_POSITIONI_INT32") ; + case GB_INT64_code : return ("GxB_POSITIONI_INT64") ; + default :; + } + break ; + + case GB_POSITIONI1_unop_code : // z = position_i1(A(i,j)) == i+1 + + switch (zcode) + { + case GB_INT32_code : return ("GxB_POSITIONI1_INT32") ; + case GB_INT64_code : return ("GxB_POSITIONI1_INT64") ; + default :; + } + break ; + + case GB_POSITIONJ_unop_code : // z = position_j(A(i,j)) == j + + switch (zcode) + { + case GB_INT32_code : return ("GxB_POSITIONJ_INT32") ; + case GB_INT64_code : return ("GxB_POSITIONJ_INT64") ; + default :; + } + break ; + + case GB_POSITIONJ1_unop_code : // z = position_j1(A(i,j)) == j+1 + + switch (zcode) + { + case GB_INT32_code : return ("GxB_POSITIONJ1_INT32") ; + case GB_INT64_code : return ("GxB_POSITIONJ1_INT64") ; + default :; + } + break ; + + //---------------------------------------------------------------------- + // index_unary operators + //---------------------------------------------------------------------- + + case GB_ROWINDEX_idxunop_code : // (i+thunk): row index - thunk + + switch (zcode) + { + case GB_INT32_code : return ("GrB_ROWINDEX_INT32") ; + case GB_INT64_code : return ("GrB_ROWINDEX_INT64") ; + default :; + } + break ; + + case GB_COLINDEX_idxunop_code : // (j+thunk): col index - thunk + + switch (zcode) + { + case GB_INT32_code : return ("GrB_COLINDEX_INT32") ; + case GB_INT64_code : return ("GrB_COLINDEX_INT64") ; + default :; + } + break ; + + case GB_DIAGINDEX_idxunop_code : // (j-(i+thunk)): diag index+thunk + + switch (zcode) + { + case GB_INT32_code : return ("GrB_DIAGINDEX_INT32") ; + case GB_INT64_code : return ("GrB_DIAGINDEX_INT64") ; + default :; + } + break ; + + case GB_FLIPDIAGINDEX_idxunop_code : // (i-(j+thunk)), internal use only + + switch (zcode) + { + case GB_INT32_code : return ("GxB_FLIPDIAGINDEX_INT32") ; + case GB_INT64_code : return ("GxB_FLIPDIAGINDEX_INT64") ; + default :; + } + break ; + + case GB_TRIL_idxunop_code : return ("GrB_TRIL" ) ; + case GB_TRIU_idxunop_code : return ("GrB_TRIU" ) ; + case GB_DIAG_idxunop_code : return ("GrB_DIAG" ) ; + case GB_OFFDIAG_idxunop_code : return ("GrB_OFFDIAG") ; + case GB_COLLE_idxunop_code : return ("GrB_COLLE" ) ; + case GB_COLGT_idxunop_code : return ("GrB_COLGT" ) ; + case GB_ROWLE_idxunop_code : return ("GrB_ROWLE" ) ; + case GB_ROWGT_idxunop_code : return ("GrB_ROWGT" ) ; + + case GB_NONZOMBIE_idxunop_code : return ("GxB_NONZOMBIE") ; + + case GB_VALUENE_idxunop_code : // (aij != thunk) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_VALUENE_BOOL" ) ; + case GB_INT8_code : return ("GrB_VALUENE_INT8" ) ; + case GB_INT16_code : return ("GrB_VALUENE_INT16" ) ; + case GB_INT32_code : return ("GrB_VALUENE_INT32" ) ; + case GB_INT64_code : return ("GrB_VALUENE_INT64" ) ; + case GB_UINT8_code : return ("GrB_VALUENE_UINT8" ) ; + case GB_UINT16_code : return ("GrB_VALUENE_UINT16") ; + case GB_UINT32_code : return ("GrB_VALUENE_UINT32") ; + case GB_UINT64_code : return ("GrB_VALUENE_UINT64") ; + case GB_FP32_code : return ("GrB_VALUENE_FP32" ) ; + case GB_FP64_code : return ("GrB_VALUENE_FP64" ) ; + case GB_FC32_code : return ("GxB_VALUENE_FC32" ) ; + case GB_FC64_code : return ("GxB_VALUENE_FC64" ) ; + default :; + } + break ; + + case GB_VALUEEQ_idxunop_code : // (aij == thunk) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_VALUEEQ_BOOL" ) ; + case GB_INT8_code : return ("GrB_VALUEEQ_INT8" ) ; + case GB_INT16_code : return ("GrB_VALUEEQ_INT16" ) ; + case GB_INT32_code : return ("GrB_VALUEEQ_INT32" ) ; + case GB_INT64_code : return ("GrB_VALUEEQ_INT64" ) ; + case GB_UINT8_code : return ("GrB_VALUEEQ_UINT8" ) ; + case GB_UINT16_code : return ("GrB_VALUEEQ_UINT16") ; + case GB_UINT32_code : return ("GrB_VALUEEQ_UINT32") ; + case GB_UINT64_code : return ("GrB_VALUEEQ_UINT64") ; + case GB_FP32_code : return ("GrB_VALUEEQ_FP32" ) ; + case GB_FP64_code : return ("GrB_VALUEEQ_FP64" ) ; + case GB_FC32_code : return ("GxB_VALUEEQ_FC32" ) ; + case GB_FC64_code : return ("GxB_VALUEEQ_FC64" ) ; + default :; + } + break ; + + case GB_VALUEGT_idxunop_code : // (aij > thunk) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_VALUEGT_BOOL" ) ; + case GB_INT8_code : return ("GrB_VALUEGT_INT8" ) ; + case GB_INT16_code : return ("GrB_VALUEGT_INT16" ) ; + case GB_INT32_code : return ("GrB_VALUEGT_INT32" ) ; + case GB_INT64_code : return ("GrB_VALUEGT_INT64" ) ; + case GB_UINT8_code : return ("GrB_VALUEGT_UINT8" ) ; + case GB_UINT16_code : return ("GrB_VALUEGT_UINT16") ; + case GB_UINT32_code : return ("GrB_VALUEGT_UINT32") ; + case GB_UINT64_code : return ("GrB_VALUEGT_UINT64") ; + case GB_FP32_code : return ("GrB_VALUEGT_FP32" ) ; + case GB_FP64_code : return ("GrB_VALUEGT_FP64" ) ; + default :; + } + break ; + + case GB_VALUEGE_idxunop_code : // (aij >= thunk) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_VALUEGE_BOOL" ) ; + case GB_INT8_code : return ("GrB_VALUEGE_INT8" ) ; + case GB_INT16_code : return ("GrB_VALUEGE_INT16" ) ; + case GB_INT32_code : return ("GrB_VALUEGE_INT32" ) ; + case GB_INT64_code : return ("GrB_VALUEGE_INT64" ) ; + case GB_UINT8_code : return ("GrB_VALUEGE_UINT8" ) ; + case GB_UINT16_code : return ("GrB_VALUEGE_UINT16") ; + case GB_UINT32_code : return ("GrB_VALUEGE_UINT32") ; + case GB_UINT64_code : return ("GrB_VALUEGE_UINT64") ; + case GB_FP32_code : return ("GrB_VALUEGE_FP32" ) ; + case GB_FP64_code : return ("GrB_VALUEGE_FP64" ) ; + default :; + } + break ; + + case GB_VALUELT_idxunop_code : // (aij < thunk) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_VALUELT_BOOL" ) ; + case GB_INT8_code : return ("GrB_VALUELT_INT8" ) ; + case GB_INT16_code : return ("GrB_VALUELT_INT16" ) ; + case GB_INT32_code : return ("GrB_VALUELT_INT32" ) ; + case GB_INT64_code : return ("GrB_VALUELT_INT64" ) ; + case GB_UINT8_code : return ("GrB_VALUELT_UINT8" ) ; + case GB_UINT16_code : return ("GrB_VALUELT_UINT16") ; + case GB_UINT32_code : return ("GrB_VALUELT_UINT32") ; + case GB_UINT64_code : return ("GrB_VALUELT_UINT64") ; + case GB_FP32_code : return ("GrB_VALUELT_FP32" ) ; + case GB_FP64_code : return ("GrB_VALUELT_FP64" ) ; + default :; + } + break ; + + case GB_VALUELE_idxunop_code : // (aij <= thunk) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_VALUELE_BOOL" ) ; + case GB_INT8_code : return ("GrB_VALUELE_INT8" ) ; + case GB_INT16_code : return ("GrB_VALUELE_INT16" ) ; + case GB_INT32_code : return ("GrB_VALUELE_INT32" ) ; + case GB_INT64_code : return ("GrB_VALUELE_INT64" ) ; + case GB_UINT8_code : return ("GrB_VALUELE_UINT8" ) ; + case GB_UINT16_code : return ("GrB_VALUELE_UINT16") ; + case GB_UINT32_code : return ("GrB_VALUELE_UINT32") ; + case GB_UINT64_code : return ("GrB_VALUELE_UINT64") ; + case GB_FP32_code : return ("GrB_VALUELE_FP32" ) ; + case GB_FP64_code : return ("GrB_VALUELE_FP64" ) ; + default :; + } + break ; + + //---------------------------------------------------------------------- + // binary operators + //---------------------------------------------------------------------- + + case GB_FIRST_binop_code : // z = x + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_FIRST_BOOL" ) ; + case GB_INT8_code : return ("GrB_FIRST_INT8" ) ; + case GB_INT16_code : return ("GrB_FIRST_INT16" ) ; + case GB_INT32_code : return ("GrB_FIRST_INT32" ) ; + case GB_INT64_code : return ("GrB_FIRST_INT64" ) ; + case GB_UINT8_code : return ("GrB_FIRST_UINT8" ) ; + case GB_UINT16_code : return ("GrB_FIRST_UINT16") ; + case GB_UINT32_code : return ("GrB_FIRST_UINT32") ; + case GB_UINT64_code : return ("GrB_FIRST_UINT64") ; + case GB_FP32_code : return ("GrB_FIRST_FP32" ) ; + case GB_FP64_code : return ("GrB_FIRST_FP64" ) ; + case GB_FC32_code : return ("GxB_FIRST_FC32" ) ; + case GB_FC64_code : return ("GxB_FIRST_FC64" ) ; + // see GB_reduce_to_vector: +// case GB_UDT_code : +// return ("1st_udt") ; + default :; + } + break ; + + case GB_SECOND_binop_code : // z = y + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_SECOND_BOOL" ) ; + case GB_INT8_code : return ("GrB_SECOND_INT8" ) ; + case GB_INT16_code : return ("GrB_SECOND_INT16" ) ; + case GB_INT32_code : return ("GrB_SECOND_INT32" ) ; + case GB_INT64_code : return ("GrB_SECOND_INT64" ) ; + case GB_UINT8_code : return ("GrB_SECOND_UINT8" ) ; + case GB_UINT16_code : return ("GrB_SECOND_UINT16") ; + case GB_UINT32_code : return ("GrB_SECOND_UINT32") ; + case GB_UINT64_code : return ("GrB_SECOND_UINT64") ; + case GB_FP32_code : return ("GrB_SECOND_FP32" ) ; + case GB_FP64_code : return ("GrB_SECOND_FP64" ) ; + case GB_FC32_code : return ("GxB_SECOND_FC32" ) ; + case GB_FC64_code : return ("GxB_SECOND_FC64" ) ; + // see GB_binop_second: +// case GB_UDT_code : +// return ("2nd_udt") ; + default :; + } + break ; + + case GB_ANY_binop_code : // z = x or y + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ANY_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_FC64" ) ; + default :; + } + break ; + + case GB_PAIR_binop_code : // z = 1 + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_ONEB_BOOL" ) ; + case GB_INT8_code : return ("GrB_ONEB_INT8" ) ; + case GB_INT16_code : return ("GrB_ONEB_INT16" ) ; + case GB_INT32_code : return ("GrB_ONEB_INT32" ) ; + case GB_INT64_code : return ("GrB_ONEB_INT64" ) ; + case GB_UINT8_code : return ("GrB_ONEB_UINT8" ) ; + case GB_UINT16_code : return ("GrB_ONEB_UINT16") ; + case GB_UINT32_code : return ("GrB_ONEB_UINT32") ; + case GB_UINT64_code : return ("GrB_ONEB_UINT64") ; + case GB_FP32_code : return ("GrB_ONEB_FP32" ) ; + case GB_FP64_code : return ("GrB_ONEB_FP64" ) ; + case GB_FC32_code : return ("GxB_ONEB_FC32" ) ; + case GB_FC64_code : return ("GxB_ONEB_FC64" ) ; + default :; + } + break ; + + case GB_MIN_binop_code : // z = min(x,y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_MIN_BOOL" ) ; + case GB_INT8_code : return ("GrB_MIN_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_FP64" ) ; + default :; + } + break ; + + case GB_MAX_binop_code : // z = max(x,y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_MAX_BOOL" ) ; + case GB_INT8_code : return ("GrB_MAX_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_FP64" ) ; + default :; + } + break ; + + case GB_PLUS_binop_code : // z = x + y + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_PLUS_BOOL" ) ; + case GB_INT8_code : return ("GrB_PLUS_INT8" ) ; + case GB_INT16_code : return ("GrB_PLUS_INT16" ) ; + case GB_INT32_code : return ("GrB_PLUS_INT32" ) ; + case GB_INT64_code : return ("GrB_PLUS_INT64" ) ; + case GB_UINT8_code : return ("GrB_PLUS_UINT8" ) ; + case GB_UINT16_code : return ("GrB_PLUS_UINT16") ; + case GB_UINT32_code : return ("GrB_PLUS_UINT32") ; + case GB_UINT64_code : return ("GrB_PLUS_UINT64") ; + case GB_FP32_code : return ("GrB_PLUS_FP32" ) ; + case GB_FP64_code : return ("GrB_PLUS_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_FC64" ) ; + default :; + } + break ; + + case GB_MINUS_binop_code : // z = x - y + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_MINUS_BOOL" ) ; + case GB_INT8_code : return ("GrB_MINUS_INT8" ) ; + case GB_INT16_code : return ("GrB_MINUS_INT16" ) ; + case GB_INT32_code : return ("GrB_MINUS_INT32" ) ; + case GB_INT64_code : return ("GrB_MINUS_INT64" ) ; + case GB_UINT8_code : return ("GrB_MINUS_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MINUS_UINT16") ; + case GB_UINT32_code : return ("GrB_MINUS_UINT32") ; + case GB_UINT64_code : return ("GrB_MINUS_UINT64") ; + case GB_FP32_code : return ("GrB_MINUS_FP32" ) ; + case GB_FP64_code : return ("GrB_MINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_MINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_MINUS_FC64" ) ; + default :; + } + break ; + + case GB_RMINUS_binop_code : // z = y - x + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_RMINUS_BOOL" ) ; + case GB_INT8_code : return ("GxB_RMINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_RMINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_RMINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_RMINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_RMINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_RMINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_RMINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_RMINUS_UINT64") ; + case GB_FP32_code : return ("GxB_RMINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_RMINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_RMINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_RMINUS_FC64" ) ; + default :; + } + break ; + + case GB_TIMES_binop_code : // z = x * y + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_TIMES_BOOL" ) ; + case GB_INT8_code : return ("GrB_TIMES_INT8" ) ; + case GB_INT16_code : return ("GrB_TIMES_INT16" ) ; + case GB_INT32_code : return ("GrB_TIMES_INT32" ) ; + case GB_INT64_code : return ("GrB_TIMES_INT64" ) ; + case GB_UINT8_code : return ("GrB_TIMES_UINT8" ) ; + case GB_UINT16_code : return ("GrB_TIMES_UINT16") ; + case GB_UINT32_code : return ("GrB_TIMES_UINT32") ; + case GB_UINT64_code : return ("GrB_TIMES_UINT64") ; + case GB_FP32_code : return ("GrB_TIMES_FP32" ) ; + case GB_FP64_code : return ("GrB_TIMES_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_FC64" ) ; + default :; + } + break ; + + case GB_DIV_binop_code : // z = x / y + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_DIV_BOOL" ) ; + case GB_INT8_code : return ("GrB_DIV_INT8" ) ; + case GB_INT16_code : return ("GrB_DIV_INT16" ) ; + case GB_INT32_code : return ("GrB_DIV_INT32" ) ; + case GB_INT64_code : return ("GrB_DIV_INT64" ) ; + case GB_UINT8_code : return ("GrB_DIV_UINT8" ) ; + case GB_UINT16_code : return ("GrB_DIV_UINT16") ; + case GB_UINT32_code : return ("GrB_DIV_UINT32") ; + case GB_UINT64_code : return ("GrB_DIV_UINT64") ; + case GB_FP32_code : return ("GrB_DIV_FP32" ) ; + case GB_FP64_code : return ("GrB_DIV_FP64" ) ; + case GB_FC32_code : return ("GxB_DIV_FC32" ) ; + case GB_FC64_code : return ("GxB_DIV_FC64" ) ; + default :; + } + break ; + + case GB_RDIV_binop_code : // z = y / x + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_RDIV_BOOL" ) ; + case GB_INT8_code : return ("GxB_RDIV_INT8" ) ; + case GB_INT16_code : return ("GxB_RDIV_INT16" ) ; + case GB_INT32_code : return ("GxB_RDIV_INT32" ) ; + case GB_INT64_code : return ("GxB_RDIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_RDIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_RDIV_UINT16") ; + case GB_UINT32_code : return ("GxB_RDIV_UINT32") ; + case GB_UINT64_code : return ("GxB_RDIV_UINT64") ; + case GB_FP32_code : return ("GxB_RDIV_FP32" ) ; + case GB_FP64_code : return ("GxB_RDIV_FP64" ) ; + case GB_FC32_code : return ("GxB_RDIV_FC32" ) ; + case GB_FC64_code : return ("GxB_RDIV_FC64" ) ; + default :; + } + break ; + + case GB_POW_binop_code : // z = pow (x,y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_POW_BOOL" ) ; + case GB_INT8_code : return ("GxB_POW_INT8" ) ; + case GB_INT16_code : return ("GxB_POW_INT16" ) ; + case GB_INT32_code : return ("GxB_POW_INT32" ) ; + case GB_INT64_code : return ("GxB_POW_INT64" ) ; + case GB_UINT8_code : return ("GxB_POW_UINT8" ) ; + case GB_UINT16_code : return ("GxB_POW_UINT16") ; + case GB_UINT32_code : return ("GxB_POW_UINT32") ; + case GB_UINT64_code : return ("GxB_POW_UINT64") ; + case GB_FP32_code : return ("GxB_POW_FP32" ) ; + case GB_FP64_code : return ("GxB_POW_FP64" ) ; + case GB_FC32_code : return ("GxB_POW_FC32" ) ; + case GB_FC64_code : return ("GxB_POW_FC64" ) ; + default :; + } + break ; + + case GB_ISEQ_binop_code : // z = (x == y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ISEQ_BOOL" ) ; + case GB_INT8_code : return ("GxB_ISEQ_INT8" ) ; + case GB_INT16_code : return ("GxB_ISEQ_INT16" ) ; + case GB_INT32_code : return ("GxB_ISEQ_INT32" ) ; + case GB_INT64_code : return ("GxB_ISEQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_ISEQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ISEQ_UINT16") ; + case GB_UINT32_code : return ("GxB_ISEQ_UINT32") ; + case GB_UINT64_code : return ("GxB_ISEQ_UINT64") ; + case GB_FP32_code : return ("GxB_ISEQ_FP32" ) ; + case GB_FP64_code : return ("GxB_ISEQ_FP64" ) ; + case GB_FC32_code : return ("GxB_ISEQ_FC32" ) ; + case GB_FC64_code : return ("GxB_ISEQ_FC64" ) ; + default :; + } + break ; + + case GB_ISNE_binop_code : // z = (x != y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ISNE_BOOL" ) ; + case GB_INT8_code : return ("GxB_ISNE_INT8" ) ; + case GB_INT16_code : return ("GxB_ISNE_INT16" ) ; + case GB_INT32_code : return ("GxB_ISNE_INT32" ) ; + case GB_INT64_code : return ("GxB_ISNE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ISNE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ISNE_UINT16") ; + case GB_UINT32_code : return ("GxB_ISNE_UINT32") ; + case GB_UINT64_code : return ("GxB_ISNE_UINT64") ; + case GB_FP32_code : return ("GxB_ISNE_FP32" ) ; + case GB_FP64_code : return ("GxB_ISNE_FP64" ) ; + case GB_FC32_code : return ("GxB_ISNE_FC32" ) ; + case GB_FC64_code : return ("GxB_ISNE_FC64" ) ; + default :; + } + break ; + + case GB_ISGT_binop_code : // z = (x > y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ISGT_BOOL" ) ; + case GB_INT8_code : return ("GxB_ISGT_INT8" ) ; + case GB_INT16_code : return ("GxB_ISGT_INT16" ) ; + case GB_INT32_code : return ("GxB_ISGT_INT32" ) ; + case GB_INT64_code : return ("GxB_ISGT_INT64" ) ; + case GB_UINT8_code : return ("GxB_ISGT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ISGT_UINT16") ; + case GB_UINT32_code : return ("GxB_ISGT_UINT32") ; + case GB_UINT64_code : return ("GxB_ISGT_UINT64") ; + case GB_FP32_code : return ("GxB_ISGT_FP32" ) ; + case GB_FP64_code : return ("GxB_ISGT_FP64" ) ; + default :; + } + break ; + + case GB_ISLT_binop_code : // z = (x < y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ISLT_BOOL" ) ; + case GB_INT8_code : return ("GxB_ISLT_INT8" ) ; + case GB_INT16_code : return ("GxB_ISLT_INT16" ) ; + case GB_INT32_code : return ("GxB_ISLT_INT32" ) ; + case GB_INT64_code : return ("GxB_ISLT_INT64" ) ; + case GB_UINT8_code : return ("GxB_ISLT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ISLT_UINT16") ; + case GB_UINT32_code : return ("GxB_ISLT_UINT32") ; + case GB_UINT64_code : return ("GxB_ISLT_UINT64") ; + case GB_FP32_code : return ("GxB_ISLT_FP32" ) ; + case GB_FP64_code : return ("GxB_ISLT_FP64" ) ; + default :; + } + break ; + + case GB_ISGE_binop_code : // z = (x >= y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ISGE_BOOL" ) ; + case GB_INT8_code : return ("GxB_ISGE_INT8" ) ; + case GB_INT16_code : return ("GxB_ISGE_INT16" ) ; + case GB_INT32_code : return ("GxB_ISGE_INT32" ) ; + case GB_INT64_code : return ("GxB_ISGE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ISGE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ISGE_UINT16") ; + case GB_UINT32_code : return ("GxB_ISGE_UINT32") ; + case GB_UINT64_code : return ("GxB_ISGE_UINT64") ; + case GB_FP32_code : return ("GxB_ISGE_FP32" ) ; + case GB_FP64_code : return ("GxB_ISGE_FP64" ) ; + default :; + } + break ; + + case GB_ISLE_binop_code : // z = (x <= y) + + switch (xcode) + { + case GB_BOOL_code : return ("GxB_ISLE_BOOL" ) ; + case GB_INT8_code : return ("GxB_ISLE_INT8" ) ; + case GB_INT16_code : return ("GxB_ISLE_INT16" ) ; + case GB_INT32_code : return ("GxB_ISLE_INT32" ) ; + case GB_INT64_code : return ("GxB_ISLE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ISLE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ISLE_UINT16") ; + case GB_UINT32_code : return ("GxB_ISLE_UINT32") ; + case GB_UINT64_code : return ("GxB_ISLE_UINT64") ; + case GB_FP32_code : return ("GxB_ISLE_FP32" ) ; + case GB_FP64_code : return ("GxB_ISLE_FP64" ) ; + default :; + } + break ; + + case GB_LOR_binop_code : // z = (x != 0) || (y != 0) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LOR" ) ; + case GB_INT8_code : return ("GxB_LOR_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_FP64" ) ; + default :; + } + break ; + + case GB_LAND_binop_code : // z = (x != 0) && (y != 0) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LAND" ) ; + case GB_INT8_code : return ("GxB_LAND_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_FP64" ) ; + default :; + } + break ; + + case GB_LXOR_binop_code : // z = (x != 0) != (y != 0) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LXOR" ) ; + case GB_INT8_code : return ("GxB_LXOR_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_FP64" ) ; + default :; + } + break ; + + case GB_EQ_binop_code : // z = (x == y), is LXNOR for bool + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LXNOR" ) ; + case GB_INT8_code : return ("GrB_EQ_INT8" ) ; + case GB_INT16_code : return ("GrB_EQ_INT16" ) ; + case GB_INT32_code : return ("GrB_EQ_INT32" ) ; + case GB_INT64_code : return ("GrB_EQ_INT64" ) ; + case GB_UINT8_code : return ("GrB_EQ_UINT8" ) ; + case GB_UINT16_code : return ("GrB_EQ_UINT16") ; + case GB_UINT32_code : return ("GrB_EQ_UINT32") ; + case GB_UINT64_code : return ("GrB_EQ_UINT64") ; + case GB_FP32_code : return ("GrB_EQ_FP32" ) ; + case GB_FP64_code : return ("GrB_EQ_FP64" ) ; + case GB_FC32_code : return ("GxB_EQ_FC32" ) ; + case GB_FC64_code : return ("GxB_EQ_FC64" ) ; + default :; + } + break ; + + case GB_BOR_binop_code : // z = (x | y), bitwise or + + switch (xcode) + { + case GB_INT8_code : return ("GrB_BOR_INT8" ) ; + case GB_INT16_code : return ("GrB_BOR_INT16" ) ; + case GB_INT32_code : return ("GrB_BOR_INT32" ) ; + case GB_INT64_code : return ("GrB_BOR_INT64" ) ; + case GB_UINT8_code : return ("GrB_BOR_UINT8" ) ; + case GB_UINT16_code : return ("GrB_BOR_UINT16") ; + case GB_UINT32_code : return ("GrB_BOR_UINT32") ; + case GB_UINT64_code : return ("GrB_BOR_UINT64") ; + default :; + } + break ; + + case GB_BAND_binop_code : // z = (x & y), bitwise and + + switch (xcode) + { + case GB_INT8_code : return ("GrB_BAND_INT8" ) ; + case GB_INT16_code : return ("GrB_BAND_INT16" ) ; + case GB_INT32_code : return ("GrB_BAND_INT32" ) ; + case GB_INT64_code : return ("GrB_BAND_INT64" ) ; + case GB_UINT8_code : return ("GrB_BAND_UINT8" ) ; + case GB_UINT16_code : return ("GrB_BAND_UINT16") ; + case GB_UINT32_code : return ("GrB_BAND_UINT32") ; + case GB_UINT64_code : return ("GrB_BAND_UINT64") ; + default :; + } + break ; + + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + + switch (xcode) + { + case GB_INT8_code : return ("GrB_BXOR_INT8" ) ; + case GB_INT16_code : return ("GrB_BXOR_INT16" ) ; + case GB_INT32_code : return ("GrB_BXOR_INT32" ) ; + case GB_INT64_code : return ("GrB_BXOR_INT64" ) ; + case GB_UINT8_code : return ("GrB_BXOR_UINT8" ) ; + case GB_UINT16_code : return ("GrB_BXOR_UINT16") ; + case GB_UINT32_code : return ("GrB_BXOR_UINT32") ; + case GB_UINT64_code : return ("GrB_BXOR_UINT64") ; + default :; + } + break ; + + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + + switch (xcode) + { + case GB_INT8_code : return ("GrB_BXNOR_INT8" ) ; + case GB_INT16_code : return ("GrB_BXNOR_INT16" ) ; + case GB_INT32_code : return ("GrB_BXNOR_INT32" ) ; + case GB_INT64_code : return ("GrB_BXNOR_INT64" ) ; + case GB_UINT8_code : return ("GrB_BXNOR_UINT8" ) ; + case GB_UINT16_code : return ("GrB_BXNOR_UINT16") ; + case GB_UINT32_code : return ("GrB_BXNOR_UINT32") ; + case GB_UINT64_code : return ("GrB_BXNOR_UINT64") ; + default :; + } + break ; + + case GB_BGET_binop_code : // z = bitget (x,y) + + switch (xcode) + { + case GB_INT8_code : return ("GxB_BGET_INT8" ) ; + case GB_INT16_code : return ("GxB_BGET_INT16" ) ; + case GB_INT32_code : return ("GxB_BGET_INT32" ) ; + case GB_INT64_code : return ("GxB_BGET_INT64" ) ; + case GB_UINT8_code : return ("GxB_BGET_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BGET_UINT16") ; + case GB_UINT32_code : return ("GxB_BGET_UINT32") ; + case GB_UINT64_code : return ("GxB_BGET_UINT64") ; + default :; + } + break ; + + case GB_BSET_binop_code : // z = bitset (x,y) + + switch (xcode) + { + case GB_INT8_code : return ("GxB_BSET_INT8" ) ; + case GB_INT16_code : return ("GxB_BSET_INT16" ) ; + case GB_INT32_code : return ("GxB_BSET_INT32" ) ; + case GB_INT64_code : return ("GxB_BSET_INT64" ) ; + case GB_UINT8_code : return ("GxB_BSET_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BSET_UINT16") ; + case GB_UINT32_code : return ("GxB_BSET_UINT32") ; + case GB_UINT64_code : return ("GxB_BSET_UINT64") ; + default :; + } + break ; + + case GB_BCLR_binop_code : // z = bitclr (x,y) + + switch (xcode) + { + case GB_INT8_code : return ("GxB_BCLR_INT8" ) ; + case GB_INT16_code : return ("GxB_BCLR_INT16" ) ; + case GB_INT32_code : return ("GxB_BCLR_INT32" ) ; + case GB_INT64_code : return ("GxB_BCLR_INT64" ) ; + case GB_UINT8_code : return ("GxB_BCLR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BCLR_UINT16") ; + case GB_UINT32_code : return ("GxB_BCLR_UINT32") ; + case GB_UINT64_code : return ("GxB_BCLR_UINT64") ; + default :; + } + break ; + + case GB_BSHIFT_binop_code : // z = bitshift (x,y) + + switch (xcode) + { + case GB_INT8_code : return ("GxB_BSHIFT_INT8" ) ; + case GB_INT16_code : return ("GxB_BSHIFT_INT16" ) ; + case GB_INT32_code : return ("GxB_BSHIFT_INT32" ) ; + case GB_INT64_code : return ("GxB_BSHIFT_INT64" ) ; + case GB_UINT8_code : return ("GxB_BSHIFT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BSHIFT_UINT16") ; + case GB_UINT32_code : return ("GxB_BSHIFT_UINT32") ; + case GB_UINT64_code : return ("GxB_BSHIFT_UINT64") ; + default :; + } + break ; + + case GB_NE_binop_code : // z = (x != y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_NE_BOOL" ) ; + case GB_INT8_code : return ("GrB_NE_INT8" ) ; + case GB_INT16_code : return ("GrB_NE_INT16" ) ; + case GB_INT32_code : return ("GrB_NE_INT32" ) ; + case GB_INT64_code : return ("GrB_NE_INT64" ) ; + case GB_UINT8_code : return ("GrB_NE_UINT8" ) ; + case GB_UINT16_code : return ("GrB_NE_UINT16") ; + case GB_UINT32_code : return ("GrB_NE_UINT32") ; + case GB_UINT64_code : return ("GrB_NE_UINT64") ; + case GB_FP32_code : return ("GrB_NE_FP32" ) ; + case GB_FP64_code : return ("GrB_NE_FP64" ) ; + case GB_FC32_code : return ("GxB_NE_FC32" ) ; + case GB_FC64_code : return ("GxB_NE_FC64" ) ; + default :; + } + break ; + + case GB_GT_binop_code : // z = (x > y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_GT_BOOL" ) ; + case GB_INT8_code : return ("GrB_GT_INT8" ) ; + case GB_INT16_code : return ("GrB_GT_INT16" ) ; + case GB_INT32_code : return ("GrB_GT_INT32" ) ; + case GB_INT64_code : return ("GrB_GT_INT64" ) ; + case GB_UINT8_code : return ("GrB_GT_UINT8" ) ; + case GB_UINT16_code : return ("GrB_GT_UINT16") ; + case GB_UINT32_code : return ("GrB_GT_UINT32") ; + case GB_UINT64_code : return ("GrB_GT_UINT64") ; + case GB_FP32_code : return ("GrB_GT_FP32" ) ; + case GB_FP64_code : return ("GrB_GT_FP64" ) ; + default :; + } + break ; + + case GB_LT_binop_code : // z = (x < y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LT_BOOL" ) ; + case GB_INT8_code : return ("GrB_LT_INT8" ) ; + case GB_INT16_code : return ("GrB_LT_INT16" ) ; + case GB_INT32_code : return ("GrB_LT_INT32" ) ; + case GB_INT64_code : return ("GrB_LT_INT64" ) ; + case GB_UINT8_code : return ("GrB_LT_UINT8" ) ; + case GB_UINT16_code : return ("GrB_LT_UINT16") ; + case GB_UINT32_code : return ("GrB_LT_UINT32") ; + case GB_UINT64_code : return ("GrB_LT_UINT64") ; + case GB_FP32_code : return ("GrB_LT_FP32" ) ; + case GB_FP64_code : return ("GrB_LT_FP64" ) ; + default :; + } + break ; + + case GB_GE_binop_code : // z = (x >= y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_GE_BOOL" ) ; + case GB_INT8_code : return ("GrB_GE_INT8" ) ; + case GB_INT16_code : return ("GrB_GE_INT16" ) ; + case GB_INT32_code : return ("GrB_GE_INT32" ) ; + case GB_INT64_code : return ("GrB_GE_INT64" ) ; + case GB_UINT8_code : return ("GrB_GE_UINT8" ) ; + case GB_UINT16_code : return ("GrB_GE_UINT16") ; + case GB_UINT32_code : return ("GrB_GE_UINT32") ; + case GB_UINT64_code : return ("GrB_GE_UINT64") ; + case GB_FP32_code : return ("GrB_GE_FP32" ) ; + case GB_FP64_code : return ("GrB_GE_FP64" ) ; + default :; + } + break ; + + case GB_LE_binop_code : // z = (x <= y) + + switch (xcode) + { + case GB_BOOL_code : return ("GrB_LE_BOOL" ) ; + case GB_INT8_code : return ("GrB_LE_INT8" ) ; + case GB_INT16_code : return ("GrB_LE_INT16" ) ; + case GB_INT32_code : return ("GrB_LE_INT32" ) ; + case GB_INT64_code : return ("GrB_LE_INT64" ) ; + case GB_UINT8_code : return ("GrB_LE_UINT8" ) ; + case GB_UINT16_code : return ("GrB_LE_UINT16") ; + case GB_UINT32_code : return ("GrB_LE_UINT32") ; + case GB_UINT64_code : return ("GrB_LE_UINT64") ; + case GB_FP32_code : return ("GrB_LE_FP32" ) ; + case GB_FP64_code : return ("GrB_LE_FP64" ) ; + default :; + } + break ; + + case GB_ATAN2_binop_code : // z = atan2 (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_ATAN2_FP32") ; + case GB_FP64_code : return ("GxB_ATAN2_FP64") ; + default :; + } + break ; + + case GB_HYPOT_binop_code : // z = hypot (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_HYPOT_FP32") ; + case GB_FP64_code : return ("GxB_HYPOT_FP64") ; + default :; + } + break ; + + case GB_FMOD_binop_code : // z = fmod (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_FMOD_FP32") ; + case GB_FP64_code : return ("GxB_FMOD_FP64") ; + default :; + } + break ; + + case GB_REMAINDER_binop_code : // z = remainder (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_REMAINDER_FP32") ; + case GB_FP64_code : return ("GxB_REMAINDER_FP64") ; + default :; + } + break ; + + case GB_COPYSIGN_binop_code : // z = copysign (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_COPYSIGN_FP32") ; + case GB_FP64_code : return ("GxB_COPYSIGN_FP64") ; + default :; + } + break ; + + case GB_LDEXP_binop_code : // z = ldexp (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_LDEXP_FP32") ; + case GB_FP64_code : return ("GxB_LDEXP_FP64") ; + default :; + } + break ; + + case GB_CMPLX_binop_code : // z = cmplx (x,y) + + switch (xcode) + { + case GB_FP32_code : return ("GxB_CMPLX_FP32") ; + case GB_FP64_code : return ("GxB_CMPLX_FP64") ; + default :; + } + break ; + + case GB_FIRSTI_binop_code : // z = first_i(A(i,j),y) == i + + switch (zcode) + { + case GB_INT32_code : return ("GxB_FIRSTI_INT32") ; + case GB_INT64_code : return ("GxB_FIRSTI_INT64") ; + default :; + } + break ; + + case GB_FIRSTI1_binop_code : // z = first_i1(A(i,j),y) == i+1 + + switch (zcode) + { + case GB_INT32_code : return ("GxB_FIRSTI1_INT32") ; + case GB_INT64_code : return ("GxB_FIRSTI1_INT64") ; + default :; + } + break ; + + case GB_FIRSTJ_binop_code : // z = first_j(A(i,j),y) == j + + switch (zcode) + { + case GB_INT32_code : return ("GxB_FIRSTJ_INT32") ; + case GB_INT64_code : return ("GxB_FIRSTJ_INT64") ; + default :; + } + break ; + + case GB_FIRSTJ1_binop_code : // z = first_j1(A(i,j),y) == j+1 + + switch (zcode) + { + case GB_INT32_code : return ("GxB_FIRSTJ1_INT32") ; + case GB_INT64_code : return ("GxB_FIRSTJ1_INT64") ; + default :; + } + break ; + + case GB_SECONDI_binop_code : // z = second_i(x,B(i,j)) == i + + switch (zcode) + { + case GB_INT32_code : return ("GxB_SECONDI_INT32") ; + case GB_INT64_code : return ("GxB_SECONDI_INT64") ; + default :; + } + break ; + + case GB_SECONDI1_binop_code : // z = second_i1(x,B(i,j)) == i+1 + + switch (zcode) + { + case GB_INT32_code : return ("GxB_SECONDI1_INT32") ; + case GB_INT64_code : return ("GxB_SECONDI1_INT64") ; + default :; + } + break ; + + case GB_SECONDJ_binop_code : // z = second_j(x,B(i,j)) == j + + switch (zcode) + { + case GB_INT32_code : return ("GxB_SECONDJ_INT32") ; + case GB_INT64_code : return ("GxB_SECONDJ_INT64") ; + default :; + } + break ; + + case GB_SECONDJ1_binop_code : // z = second_j1(x,B(i,j)) == j+1 + + switch (zcode) + { + case GB_INT32_code : return ("GxB_SECONDJ1_INT32") ; + case GB_INT64_code : return ("GxB_SECONDJ1_INT64") ; + default :; + } + break ; + + //---------------------------------------------------------------------- + // user-defined operators + //---------------------------------------------------------------------- + + case GB_USER_unop_code : + case GB_USER_idxunop_code : + case GB_USER_binop_code : return (op->user_name) ; + + //---------------------------------------------------------------------- + // operator not recognized + //---------------------------------------------------------------------- + + default :; + } + + return ("") ; +} + diff --git a/GraphBLAS/Source/GB_op_or_type_string_set.c b/GraphBLAS/Source/GB_op_or_type_string_set.c new file mode 100644 index 0000000000..2e44f32f0a --- /dev/null +++ b/GraphBLAS/Source/GB_op_or_type_string_set.c @@ -0,0 +1,115 @@ +//------------------------------------------------------------------------------ +// GB_op_or_type_string_set: set the name or defn of a user-defined type or op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" +#include +#include "GB_jitifyer.h" + +GrB_Info GB_op_or_type_string_set +( + // input: + bool user_defined, + bool jitable, + char *value, + int field, + // output: + char **user_name, + size_t *user_name_size, + char *name, + int32_t *name_len, + char **defn, + size_t *defn_size, + uint64_t *hash +) +{ + + //-------------------------------------------------------------------------- + // quick return for built-in types and operators + //-------------------------------------------------------------------------- + + if (!user_defined) + { + // built-in type or operator + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // set the name or defn of a user-defined type or operator + //-------------------------------------------------------------------------- + + size_t len = strlen (value) ; + bool compute_hash = false ; + + switch (field) + { + + case GrB_NAME : + + return (GB_user_name_set (user_name, user_name_size, value, true)) ; + + case GxB_JIT_C_NAME : + + if (name [0] != '\0') + { + return (GrB_ALREADY_SET) ; // GxB_JIT_C_NAME already set + } + + if (len == 0 || len >= GxB_MAX_NAME_LEN) + { + // invalid name: the name cannot be empty, and the name cannot + // exceed GxB_MAX_NAME_LEN-1 characters. + return (GrB_INVALID_VALUE) ; + } + + // set the name + strncpy (name, value, GxB_MAX_NAME_LEN-1) ; + name [GxB_MAX_NAME_LEN-1] = '\0' ; + (*name_len) = (int32_t) len ; + // compute the hash if the type defn has also been set + compute_hash = ((*defn) != NULL) ; + break ; + + case GxB_JIT_C_DEFINITION : + + if ((*defn) != NULL) + { + return (GrB_ALREADY_SET) ; // GxB_JIT_C_DEFINITION already set + } + + // allocate space for the definition + (*defn) = GB_MALLOC (len+1, char, defn_size) ; + if ((*defn) == NULL) + { + // out of memory + return (GrB_OUT_OF_MEMORY) ; + } + + // copy the definition into the new operator + memcpy ((*defn), value, len+1) ; + // compute the hash if the type name has also been set + compute_hash = (name [0] != '[') ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // compute the operator hash, if type->name and type->defn are now both set + //-------------------------------------------------------------------------- + + if (compute_hash) + { + // the type name and defn have been set + (*hash) = GB_jitifyer_hash (name, (*name_len), jitable) ; + } + + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_op_scalar_get.c b/GraphBLAS/Source/GB_op_scalar_get.c new file mode 100644 index 0000000000..74b9a8c9c9 --- /dev/null +++ b/GraphBLAS/Source/GB_op_scalar_get.c @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// GB_op_scalar_get: get a field in an op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_op_scalar_get +( + GB_Operator op, + GrB_Scalar value, + GrB_Field field, + GB_Werk Werk +) +{ + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int i ; + GrB_Info info = GB_op_enum_get (op, &i, field) ; + if (info == GrB_SUCCESS) + { + info = GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk) ; + } + return (info) ; +} + diff --git a/GraphBLAS/Source/GB_op_size_get.c b/GraphBLAS/Source/GB_op_size_get.c new file mode 100644 index 0000000000..a560de918d --- /dev/null +++ b/GraphBLAS/Source/GB_op_size_get.c @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// GB_op_size_get: get the size of a string in an op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_op_size_get +( + GB_Operator op, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + const char *s ; + + switch ((int) field) + { + + case GxB_JIT_C_DEFINITION : + (*value) = (op->defn == NULL) ? 1 : (strlen (op->defn) + 1) ; + #pragma omp flush + return (GrB_SUCCESS) ; + + case GxB_JIT_C_NAME : + (*value) = strlen (op->name) + 1 ; + #pragma omp flush + return (GrB_SUCCESS) ; + + case GrB_NAME : + s = GB_op_name_get (op) ; + (*value) = (s == NULL) ? 1 : (strlen (s) + 1) ; + #pragma omp flush + return (GrB_SUCCESS) ; + + case GrB_INP0_TYPE_STRING : + s = GB_type_name_get (op->xtype) ; + break ; ; + + case GrB_INP1_TYPE_STRING : + s = GB_type_name_get (op->ytype) ; + break ; + + case GrB_OUTP_TYPE_STRING : + s = GB_type_name_get (op->ztype) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + (*value) = (s == NULL) ? 1 : (strlen (s) + 1) ; + + #pragma omp flush + return ((s == NULL) ? GrB_NO_VALUE : GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_op_string_get.c b/GraphBLAS/Source/GB_op_string_get.c new file mode 100644 index 0000000000..6353c8afed --- /dev/null +++ b/GraphBLAS/Source/GB_op_string_get.c @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// GB_op_string_get: get a field in an op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_op_string_get +( + GB_Operator op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + (*value) = '\0' ; + GrB_Type type = NULL ; + const char *name ; + + switch ((int) field) + { + + case GrB_NAME : + + name = GB_op_name_get (op) ; + if (name != NULL) + { + strcpy (value, name) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; + + case GxB_JIT_C_NAME : + + strcpy (value, op->name) ; + #pragma omp flush + return (GrB_SUCCESS) ; + + case GxB_JIT_C_DEFINITION : + + if (op->defn != NULL) + { + strcpy (value, op->defn) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; + + case GrB_INP0_TYPE_STRING : type = op->xtype ; break ; + case GrB_INP1_TYPE_STRING : type = op->ytype ; break ; + case GrB_OUTP_TYPE_STRING : type = op->ztype ; break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + if (type == NULL) + { + // operator does not depend on this input + return (GrB_NO_VALUE) ; + } + + name = GB_type_name_get (type) ; + if (name != NULL) + { + strcpy (value, name) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GB_op_string_set.c b/GraphBLAS/Source/GB_op_string_set.c new file mode 100644 index 0000000000..6f49a5fbc5 --- /dev/null +++ b/GraphBLAS/Source/GB_op_string_set.c @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// GB_op_string_set: set the name or defn of an operator +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_op_string_set +( + GB_Operator op, + char * value, + GrB_Field field +) +{ + + GB_Opcode opcode = op->opcode ; + bool user_defined = (opcode == GB_USER_unop_code) || + (opcode == GB_USER_idxunop_code) || + (opcode == GB_USER_binop_code) ; + + bool jitable = + (op->ztype->hash != UINT64_MAX) && + (op->xtype->hash != UINT64_MAX) && + (op->ytype == NULL || op->ytype->hash != UINT64_MAX) ; + + return (GB_op_or_type_string_set (user_defined, jitable, value, field, + &(op->user_name), &(op->user_name_size), + op->name, &(op->name_len), &(op->defn), &(op->defn_size), + &(op->hash))) ; +} + diff --git a/GraphBLAS/Source/GB_ops.c b/GraphBLAS/Source/GB_ops.c index 4f35cd7e87..1d82758af8 100644 --- a/GraphBLAS/Source/GB_ops.c +++ b/GraphBLAS/Source/GB_ops.c @@ -38,6 +38,7 @@ struct GB_Type_opaque GB_OPAQUE (type) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ sizeof (ctype), /* sizeof the type */ \ GB_ ## type ## _code, /* type code */ \ 0, name, /* name_len and name */ \ @@ -69,6 +70,7 @@ GB_TYPEDEF (GxB, FC64 , GxB_FC64_t, "GxB_FC64_t") ; struct GB_Descriptor_opaque GB_OPAQUE (desc_ ## name) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ "", 0, /* logger */ \ (GrB_Desc_Value) (out), \ (GrB_Desc_Value) (mask), \ @@ -140,6 +142,7 @@ GB_DESC (RSCT0T1, GrB_REPLACE, GrB_STRUCTURE + GrB_COMP, GrB_TRAN, GrB_TRAN ) struct GB_UnaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (ztype), /* ztype */ \ & GB_OPAQUE (xtype), /* xtype */ \ NULL, /* ytype */ \ @@ -173,6 +176,7 @@ GB_DESC (RSCT0T1, GrB_REPLACE, GrB_STRUCTURE + GrB_COMP, GrB_TRAN, GrB_TRAN ) struct GB_BinaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (ztype), /* ztype */ \ & GB_OPAQUE (xtype), \ & GB_OPAQUE (ytype), \ @@ -211,6 +215,7 @@ GB_DESC (RSCT0T1, GrB_REPLACE, GrB_STRUCTURE + GrB_COMP, GrB_TRAN, GrB_TRAN ) struct GB_UnaryOp_opaque GB_OPAQUE (op ## _ ## type) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (type), /* ztype */ \ & GB_OPAQUE (type), /* xtype */ \ NULL, /* ytype */ \ @@ -226,6 +231,7 @@ GB_DESC (RSCT0T1, GrB_REPLACE, GrB_STRUCTURE + GrB_COMP, GrB_TRAN, GrB_TRAN ) struct GB_BinaryOp_opaque GB_OPAQUE (op ## _ ## type) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (type), /* ztype */ \ & GB_OPAQUE (type), /* xtype */ \ & GB_OPAQUE (type), /* ytype */ \ @@ -275,6 +281,7 @@ GXB_OP2_POS (SECONDJ1 , "secondj1" , INT64) ; struct GB_IndexUnaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (GB_XTYPE), /* ztype */ \ NULL, /* xtype */ \ & GB_OPAQUE (GB_XTYPE), /* ytype */ \ @@ -293,6 +300,7 @@ GXB_OP2_POS (SECONDJ1 , "secondj1" , INT64) ; struct GB_IndexUnaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (GB_XTYPE), /* ztype */ \ NULL, /* xtype */ \ & GB_OPAQUE (GB_XTYPE), /* ytype */ \ @@ -312,6 +320,7 @@ GXB_OP2_POS (SECONDJ1 , "secondj1" , INT64) ; struct GB_IndexUnaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (BOOL), /* ztype */ \ NULL, /* xtype */ \ & GB_OPAQUE (GB_XTYPE), /* ytype */ \ @@ -329,6 +338,7 @@ GXB_OP2_POS (SECONDJ1 , "secondj1" , INT64) ; struct GB_IndexUnaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (BOOL), /* ztype */ \ & GB_OPAQUE (GB_XTYPE), /* xtype */ \ & GB_OPAQUE (GB_XTYPE), /* ytype */ \ @@ -346,6 +356,7 @@ GXB_OP2_POS (SECONDJ1 , "secondj1" , INT64) ; struct GB_IndexUnaryOp_opaque GB_OPAQUE (GB_OP (op)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (BOOL), /* ztype */ \ & GB_OPAQUE (GB_XTYPE), /* xtype */ \ & GB_OPAQUE (GB_XTYPE), /* ytype */ \ @@ -364,6 +375,7 @@ GXB_OP2_POS (SECONDJ1 , "secondj1" , INT64) ; struct GB_SelectOp_opaque GB_OPAQUE (op) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (BOOL), /* ztype */ \ NULL, /* xtype */ \ NULL, /* thunk type */ \ @@ -488,6 +500,7 @@ GrB_BinaryOp GrB_LXNOR = & GB_OPAQUE (EQ_BOOL) ; struct GB_BinaryOp_opaque GB_OPAQUE (IGNORE_DUP) = { GB_MAGIC2, 0, // magic and header_size + NULL, 0, // no user_name for GrB_get/GrB_set NULL, // ztype NULL, // xtype NULL, // ytype @@ -521,6 +534,7 @@ extern void GB_nonzombie_func (bool *z, const void *x, struct GB_IndexUnaryOp_opaque GB_OPAQUE (NONZOMBIE) = { GB_MAGIC, 0, // magic and header_size + NULL, 0, // no user_name for GrB_get/GrB_set & GB_OPAQUE (BOOL), // ztype NULL, // xtype & GB_OPAQUE (INT64), // ytype @@ -572,6 +586,7 @@ const GxB_Format_Value GxB_FORMAT_DEFAULT = GxB_BY_ROW ; struct GB_Monoid_opaque GB_OPAQUE (GB_EVAL2 (op, _MONOID)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (op), /* additive operator */ \ & GB_OPAQUE (GB_EVAL2 (identity_, op)), /* identity */ \ NULL, /* terminal */ \ @@ -587,6 +602,7 @@ const GxB_Format_Value GxB_FORMAT_DEFAULT = GxB_BY_ROW ; struct GB_Monoid_opaque GB_OPAQUE (GB_EVAL2 (op, _MONOID)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (op), /* additive operator */ \ & GB_OPAQUE (GB_EVAL2 (identity_, op)), /* identity */ \ & GB_OPAQUE (GB_EVAL2 (terminal_, op)), /* terminal */ \ @@ -760,6 +776,7 @@ GB_MONOID_DEF ( BXNOR_UINT64 , uint64_t , 0xFFFFFFFFFFFFFFFF ) struct GB_Semiring_opaque GB_OPAQUE (GB_SEMIRING_NAME(add, mult)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (GB_EVAL4 (add, _, GB_XTYPE, _MONOID)), \ & GB_OPAQUE (GB_EVAL3 (mult, _, GB_XTYPE)), \ NULL, 0, 0, 0 /* name, name_len, name_size, hash */ \ @@ -772,6 +789,7 @@ GB_MONOID_DEF ( BXNOR_UINT64 , uint64_t , 0xFFFFFFFFFFFFFFFF ) struct GB_Semiring_opaque GB_OPAQUE (GB_SEMIRING_NAME(add, mult)) = \ { \ GB_MAGIC, 0, /* magic and header_size */ \ + NULL, 0, /* no user_name for GrB_get/GrB_set */ \ & GB_OPAQUE (GB_EVAL2 (add, _BOOL_MONOID)), \ & GB_OPAQUE (GB_EVAL3 (mult, _, GB_XTYPE)), \ NULL, 0, 0, 0 /* name, name_len, name_size, hash */ \ @@ -1003,7 +1021,8 @@ struct GB_Context_opaque GB_OPAQUE (CONTEXT_WORLD) = { GB_MAGIC, // magic: initialized 0, // header_size: statically allocated - // revised by GrB_init: + NULL, 0, // no user_name for GrB_get/GrB_set + // revised by GxB_Context_get/set: (double) GB_CHUNK_DEFAULT, // chunk 1, // nthreads_max -1, // gpu_id diff --git a/GraphBLAS/Source/GB_reduce_to_scalar.c b/GraphBLAS/Source/GB_reduce_to_scalar.c index 2a008d1510..838c5c5259 100644 --- a/GraphBLAS/Source/GB_reduce_to_scalar.c +++ b/GraphBLAS/Source/GB_reduce_to_scalar.c @@ -106,7 +106,7 @@ GrB_Info GB_reduce_to_scalar // z = reduce_to_scalar (A) info = GrB_NO_VALUE ; #if defined ( GRAPHBLAS_HAS_CUDA ) - if (GB_reduce_to_scalar_cuda_branch (monoid, A)) + if (GB_cuda_reduce_to_scalar_branch (monoid, A)) { //---------------------------------------------------------------------- @@ -114,7 +114,7 @@ GrB_Info GB_reduce_to_scalar // z = reduce_to_scalar (A) //---------------------------------------------------------------------- GrB_Matrix V = NULL ; - info = GB_reduce_to_scalar_cuda (z, &V, monoid, A) ; + info = GB_cuda_reduce_to_scalar_jit (z, &V, monoid, A) ; if (V != NULL) { @@ -137,11 +137,12 @@ GrB_Info GB_reduce_to_scalar // z = reduce_to_scalar (A) } } - // GB_reduce_to_scalar_cuda may refuse to do the reduction and indicate - // this by returning GrB_NO_VALUE. If so, the CPU will do it below. + // GB_cuda_reduce_to_scalar_jit may refuse to do the reduction and + // indicate this by returning GrB_NO_VALUE. If so, the CPU will do it + // below. if (!(info == GrB_SUCCESS || info == GrB_NO_VALUE)) { - // GB_reduce_to_scalar_cuda has returned an error + // GB_cuda_reduce_to_scalar_jit has returned an error // (out of memory, or other error) return (info) ; } diff --git a/GraphBLAS/Source/GB_semiring_name_get.c b/GraphBLAS/Source/GB_semiring_name_get.c new file mode 100644 index 0000000000..54a6d24843 --- /dev/null +++ b/GraphBLAS/Source/GB_semiring_name_get.c @@ -0,0 +1,3341 @@ +//------------------------------------------------------------------------------ +// GB_semiring_name_get: get the name of a built-in semiring +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +const char *GB_semiring_name_get (GrB_Semiring semiring) +{ + + if (semiring->user_name_size > 0) + { + // user-defined semiring, with name defined by GrB_set + return (semiring->user_name) ; + } + + GB_Opcode add_opcode = semiring->add->op->opcode ; + GB_Opcode mult_opcode = semiring->multiply->opcode ; + GB_Type_code zcode = semiring->add->op->ztype->code ; + GB_Type_code xcode = semiring->multiply->xtype->code ; + bool xbool = (xcode == GB_BOOL_code) ; + + switch (mult_opcode) + { + + //---------------------------------------------------------------------- + case GB_FIRST_binop_code : // z = x + //---------------------------------------------------------------------- + + // 61 semirings with FIRST: + // 50: (min,max,plus,times,any) for 10 non-boolean real + // 5: (or,and,xor,eq,any) for boolean + // 6: (plus,times,any) for 2 complex + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MIN_FIRST_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_FIRST_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_FIRST_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_FIRST_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_FIRST_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_FIRST_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_FIRST_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_FIRST_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_FIRST_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_FIRST_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MAX_FIRST_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_FIRST_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_FIRST_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_FIRST_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_FIRST_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_FIRST_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_FIRST_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_FIRST_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_FIRST_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_FIRST_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_FIRST_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_FIRST_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_FIRST_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_FIRST_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_FIRST_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_FIRST_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_FIRST_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_FIRST_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_FIRST_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_FIRST_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_FIRST_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_FIRST_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_FIRST_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_FIRST_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_FIRST_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_FIRST_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_FIRST_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_FIRST_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_FIRST_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_FIRST_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_FIRST_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_FIRST_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_FIRST_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_FIRST_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 11 real and boolean types, plus 2 complex + case GB_BOOL_code : return ("GxB_ANY_FIRST_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_FIRST_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_FIRST_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_FIRST_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_FIRST_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_FIRST_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_FIRST_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_FIRST_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_FIRST_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_FIRST_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_FIRST_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_FIRST_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_FIRST_FC64" ) ; + default: ; + } + break ; + + case GB_LOR_binop_code : if (xbool) return ("GxB_LOR_FIRST_BOOL" ) ; + case GB_LAND_binop_code : if (xbool) return ("GxB_LAND_FIRST_BOOL" ) ; + case GB_EQ_binop_code : if (xbool) return ("GxB_EQ_FIRST_BOOL" ) ; + case GB_LXOR_binop_code : if (xbool) return ("GxB_LXOR_FIRST_BOOL") ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_SECOND_binop_code : // z = y + //---------------------------------------------------------------------- + + // 61 semirings with SECOND: + // 50: (min,max,plus,times,any) for 10 real non-boolean + // 5: (or,and,xor,eq,any) for boolean + // 6: (plus,times,any) for 2 complex + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MIN_SECOND_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_SECOND_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_SECOND_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_SECOND_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_SECOND_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_SECOND_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_SECOND_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_SECOND_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_SECOND_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_SECOND_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MAX_SECOND_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_SECOND_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_SECOND_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_SECOND_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_SECOND_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_SECOND_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_SECOND_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_SECOND_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_SECOND_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_SECOND_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_SECOND_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_SECOND_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_SECOND_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_SECOND_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_SECOND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_SECOND_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_SECOND_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_SECOND_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_SECOND_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_SECOND_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_SECOND_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_SECOND_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_SECOND_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_SECOND_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_SECOND_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_SECOND_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_SECOND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_SECOND_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_SECOND_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_SECOND_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_SECOND_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_SECOND_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_SECOND_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_SECOND_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 11 real and boolean types, plus 2 complex + case GB_BOOL_code : return ("GxB_ANY_SECOND_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_SECOND_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_SECOND_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_SECOND_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_SECOND_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_SECOND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_SECOND_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_SECOND_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_SECOND_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_SECOND_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_SECOND_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_SECOND_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_SECOND_FC64" ) ; + default: ; + } + break ; + + case GB_LOR_binop_code : if (xbool) return ("GxB_LOR_SECOND_BOOL" ) ; + case GB_LAND_binop_code : if (xbool) return ("GxB_LAND_SECOND_BOOL" ) ; + case GB_EQ_binop_code : if (xbool) return ("GxB_EQ_SECOND_BOOL" ) ; + case GB_LXOR_binop_code : if (xbool) return ("GxB_LXOR_SECOND_BOOL") ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_MIN_binop_code : // z = min(x,y) + //---------------------------------------------------------------------- + + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_MIN_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_MIN_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_MIN_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_MIN_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_MIN_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_MIN_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_MIN_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_MIN_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_MIN_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_MIN_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MAX_MIN_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_MIN_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_MIN_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_MIN_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_MIN_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_MIN_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_MIN_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_MIN_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_MIN_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_MIN_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_PLUS_MIN_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_PLUS_MIN_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_PLUS_MIN_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_PLUS_MIN_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_PLUS_MIN_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_PLUS_MIN_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_PLUS_MIN_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_PLUS_MIN_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_PLUS_MIN_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_PLUS_MIN_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_MIN_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_MIN_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_MIN_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_MIN_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_MIN_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_MIN_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_MIN_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_MIN_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_MIN_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_MIN_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_MIN_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_MIN_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_MIN_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_MIN_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_MIN_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_MIN_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_MIN_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_MIN_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_MIN_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_MIN_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_MAX_binop_code : // z = max(x,y) + //---------------------------------------------------------------------- + + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MIN_MAX_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_MAX_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_MAX_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_MAX_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_MAX_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_MAX_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_MAX_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_MAX_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_MAX_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_MAX_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_MAX_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_MAX_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_MAX_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_MAX_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_MAX_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_MAX_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_MAX_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_MAX_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_MAX_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_MAX_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_MAX_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_MAX_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_MAX_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_MAX_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_MAX_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_MAX_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_MAX_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_MAX_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_MAX_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_MAX_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_MAX_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_MAX_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_MAX_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_MAX_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_MAX_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_MAX_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_MAX_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_MAX_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_MAX_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_MAX_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_MAX_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_MAX_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_MAX_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_MAX_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_MAX_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_MAX_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_MAX_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_MAX_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_MAX_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_MAX_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_PLUS_binop_code : // z = x + y + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MIN_PLUS_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_PLUS_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_PLUS_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_PLUS_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_PLUS_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_PLUS_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_PLUS_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_PLUS_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_PLUS_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_PLUS_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MAX_PLUS_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_PLUS_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_PLUS_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_PLUS_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_PLUS_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_PLUS_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_PLUS_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_PLUS_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_PLUS_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_PLUS_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_PLUS_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_PLUS_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_PLUS_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_PLUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_PLUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_PLUS_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_PLUS_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_PLUS_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_PLUS_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_PLUS_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_PLUS_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_PLUS_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_PLUS_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_PLUS_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_PLUS_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_PLUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_PLUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_PLUS_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_PLUS_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_PLUS_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_PLUS_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_PLUS_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_PLUS_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_PLUS_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_ANY_PLUS_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_PLUS_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_PLUS_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_PLUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_PLUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_PLUS_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_PLUS_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_PLUS_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_PLUS_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_PLUS_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_PLUS_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_PLUS_FC64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_MINUS_binop_code : // z = x - y + //---------------------------------------------------------------------- + + // 56 semirings: + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + // 6: (plus,times,any) for 2 complex types + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_MINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_MINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_MINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_MINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_MINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_MINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_MINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_MINUS_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_MINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_MINUS_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_MINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_MINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_MINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_MINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_MINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_MINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_MINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_MINUS_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_MINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_MINUS_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_MINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_MINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_MINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_MINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_MINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_MINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_MINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_MINUS_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_MINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_MINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_MINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_MINUS_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_MINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_MINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_MINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_MINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_MINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_MINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_MINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_MINUS_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_MINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_MINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_MINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_MINUS_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_ANY_MINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_MINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_MINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_MINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_MINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_MINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_MINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_MINUS_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_MINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_MINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_MINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_MINUS_FC64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_ISEQ_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_ISEQ_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_ISEQ_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_ISEQ_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_ISEQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_ISEQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_ISEQ_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_ISEQ_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_ISEQ_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_ISEQ_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_ISEQ_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_ISEQ_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_ISEQ_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_ISEQ_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_ISEQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_ISEQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_ISEQ_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_ISEQ_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_ISEQ_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_ISEQ_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_ISEQ_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_ISEQ_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_ISEQ_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_ISEQ_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_ISEQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_ISEQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_ISEQ_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_ISEQ_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_ISEQ_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_ISEQ_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_ISEQ_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_ISEQ_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_ISEQ_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_ISEQ_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_ISEQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_ISEQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_ISEQ_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_ISEQ_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_ISEQ_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_ISEQ_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_ISEQ_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_ISEQ_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_ISEQ_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_ISEQ_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_ISEQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_ISEQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_ISEQ_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_ISEQ_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_ISEQ_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_ISEQ_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_ISEQ_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_ISNE_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_ISNE_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_ISNE_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_ISNE_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_ISNE_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_ISNE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_ISNE_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_ISNE_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_ISNE_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_ISNE_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_ISNE_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_ISNE_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_ISNE_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_ISNE_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_ISNE_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_ISNE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_ISNE_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_ISNE_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_ISNE_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_ISNE_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_ISNE_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_ISNE_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_ISNE_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_ISNE_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_ISNE_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_ISNE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_ISNE_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_ISNE_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_ISNE_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_ISNE_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_ISNE_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_ISNE_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_ISNE_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_ISNE_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_ISNE_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_ISNE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_ISNE_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_ISNE_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_ISNE_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_ISNE_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_ISNE_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_ISNE_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_ISNE_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_ISNE_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_ISNE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_ISNE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_ISNE_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_ISNE_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_ISNE_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_ISNE_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_ISNE_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_ISGT_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_ISGT_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_ISGT_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_ISGT_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_ISGT_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_ISGT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_ISGT_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_ISGT_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_ISGT_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_ISGT_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_ISGT_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_ISGT_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_ISGT_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_ISGT_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_ISGT_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_ISGT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_ISGT_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_ISGT_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_ISGT_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_ISGT_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_ISGT_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_ISGT_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_ISGT_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_ISGT_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_ISGT_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_ISGT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_ISGT_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_ISGT_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_ISGT_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_ISGT_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_ISGT_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_ISGT_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_ISGT_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_ISGT_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_ISGT_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_ISGT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_ISGT_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_ISGT_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_ISGT_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_ISGT_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_ISGT_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_ISGT_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_ISGT_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_ISGT_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_ISGT_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_ISGT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_ISGT_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_ISGT_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_ISGT_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_ISGT_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_ISGT_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_ISLT_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_ISLT_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_ISLT_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_ISLT_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_ISLT_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_ISLT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_ISLT_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_ISLT_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_ISLT_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_ISLT_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_ISLT_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_ISLT_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_ISLT_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_ISLT_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_ISLT_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_ISLT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_ISLT_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_ISLT_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_ISLT_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_ISLT_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_ISLT_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_ISLT_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_ISLT_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_ISLT_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_ISLT_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_ISLT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_ISLT_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_ISLT_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_ISLT_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_ISLT_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_ISLT_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_ISLT_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_ISLT_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_ISLT_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_ISLT_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_ISLT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_ISLT_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_ISLT_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_ISLT_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_ISLT_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_ISLT_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_ISLT_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_ISLT_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_ISLT_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_ISLT_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_ISLT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_ISLT_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_ISLT_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_ISLT_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_ISLT_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_ISLT_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_ISGE_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_ISGE_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_ISGE_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_ISGE_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_ISGE_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_ISGE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_ISGE_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_ISGE_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_ISGE_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_ISGE_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_ISGE_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_ISGE_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_ISGE_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_ISGE_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_ISGE_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_ISGE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_ISGE_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_ISGE_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_ISGE_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_ISGE_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_ISGE_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_ISGE_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_ISGE_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_ISGE_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_ISGE_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_ISGE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_ISGE_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_ISGE_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_ISGE_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_ISGE_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_ISGE_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_ISGE_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_ISGE_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_ISGE_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_ISGE_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_ISGE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_ISGE_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_ISGE_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_ISGE_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_ISGE_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_ISGE_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_ISGE_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_ISGE_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_ISGE_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_ISGE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_ISGE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_ISGE_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_ISGE_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_ISGE_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_ISGE_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_ISGE_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_ISLE_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_ISLE_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_ISLE_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_ISLE_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_ISLE_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_ISLE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_ISLE_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_ISLE_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_ISLE_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_ISLE_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_ISLE_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_ISLE_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_ISLE_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_ISLE_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_ISLE_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_ISLE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_ISLE_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_ISLE_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_ISLE_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_ISLE_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_ISLE_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_ISLE_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_ISLE_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_ISLE_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_ISLE_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_ISLE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_ISLE_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_ISLE_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_ISLE_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_ISLE_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_ISLE_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_ISLE_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_ISLE_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_ISLE_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_ISLE_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_ISLE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_ISLE_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_ISLE_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_ISLE_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_ISLE_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_ISLE_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_ISLE_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_ISLE_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_ISLE_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_ISLE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_ISLE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_ISLE_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_ISLE_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_ISLE_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_ISLE_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_ISLE_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_RMINUS_binop_code : // z = y - x (reverse minus) + //---------------------------------------------------------------------- + + // 56 semirings: + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + // 6: (plus,times,any) for 2 complex types + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_RMINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_RMINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_RMINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_RMINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_RMINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_RMINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_RMINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_RMINUS_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_RMINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_RMINUS_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_RMINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_RMINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_RMINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_RMINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_RMINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_RMINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_RMINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_RMINUS_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_RMINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_RMINUS_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_RMINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_RMINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_RMINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_RMINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_RMINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_RMINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_RMINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_RMINUS_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_RMINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_RMINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_RMINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_RMINUS_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_RMINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_RMINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_RMINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_RMINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_RMINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_RMINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_RMINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_RMINUS_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_RMINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_RMINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_RMINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_RMINUS_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_ANY_RMINUS_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_RMINUS_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_RMINUS_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_RMINUS_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_RMINUS_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_RMINUS_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_RMINUS_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_RMINUS_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_RMINUS_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_RMINUS_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_RMINUS_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_RMINUS_FC64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_TIMES_binop_code : // z = x * y + //---------------------------------------------------------------------- + + // 56 semirings: + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + // 6: (plus,times,any) for 2 complex types + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MIN_TIMES_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MIN_TIMES_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MIN_TIMES_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MIN_TIMES_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MIN_TIMES_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MIN_TIMES_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MIN_TIMES_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MIN_TIMES_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MIN_TIMES_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MIN_TIMES_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GrB_MAX_TIMES_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_MAX_TIMES_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_MAX_TIMES_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_MAX_TIMES_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_MAX_TIMES_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_MAX_TIMES_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_MAX_TIMES_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_MAX_TIMES_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_MAX_TIMES_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_MAX_TIMES_SEMIRING_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GrB_PLUS_TIMES_SEMIRING_INT8" ) ; + case GB_INT16_code : return ("GrB_PLUS_TIMES_SEMIRING_INT16" ) ; + case GB_INT32_code : return ("GrB_PLUS_TIMES_SEMIRING_INT32" ) ; + case GB_INT64_code : return ("GrB_PLUS_TIMES_SEMIRING_INT64" ) ; + case GB_UINT8_code : return ("GrB_PLUS_TIMES_SEMIRING_UINT8" ) ; + case GB_UINT16_code : return ("GrB_PLUS_TIMES_SEMIRING_UINT16") ; + case GB_UINT32_code : return ("GrB_PLUS_TIMES_SEMIRING_UINT32") ; + case GB_UINT64_code : return ("GrB_PLUS_TIMES_SEMIRING_UINT64") ; + case GB_FP32_code : return ("GrB_PLUS_TIMES_SEMIRING_FP32" ) ; + case GB_FP64_code : return ("GrB_PLUS_TIMES_SEMIRING_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_TIMES_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_TIMES_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_TIMES_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_TIMES_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_TIMES_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_TIMES_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_TIMES_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_TIMES_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_TIMES_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_TIMES_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_TIMES_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_TIMES_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_TIMES_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_TIMES_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_ANY_TIMES_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_TIMES_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_TIMES_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_TIMES_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_TIMES_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_TIMES_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_TIMES_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_TIMES_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_TIMES_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_TIMES_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_TIMES_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_TIMES_FC64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_DIV_binop_code : // z = x / y + //---------------------------------------------------------------------- + + // 56 semirings: + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + // 6: (plus,times,any) for 2 complex types + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_DIV_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_DIV_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_DIV_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_DIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_DIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_DIV_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_DIV_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_DIV_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_DIV_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_DIV_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_DIV_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_DIV_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_DIV_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_DIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_DIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_DIV_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_DIV_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_DIV_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_DIV_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_DIV_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_DIV_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_DIV_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_DIV_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_DIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_DIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_DIV_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_DIV_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_DIV_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_DIV_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_DIV_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_DIV_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_DIV_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_DIV_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_DIV_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_DIV_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_DIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_DIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_DIV_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_DIV_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_DIV_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_DIV_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_DIV_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_DIV_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_DIV_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_ANY_DIV_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_DIV_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_DIV_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_DIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_DIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_DIV_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_DIV_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_DIV_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_DIV_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_DIV_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_DIV_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_DIV_FC64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_RDIV_binop_code : // z = y / x (reverse division) + //---------------------------------------------------------------------- + + // 56 semirings: + // 50 semirings: (min,max,plus,times,any) for 10 real non-boolean + // 6: (plus,times,any) for 2 complex types + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_RDIV_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_RDIV_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_RDIV_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_RDIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_RDIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_RDIV_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_RDIV_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_RDIV_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_RDIV_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_RDIV_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_RDIV_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_RDIV_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_RDIV_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_RDIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_RDIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_RDIV_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_RDIV_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_RDIV_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_RDIV_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_RDIV_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_RDIV_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_RDIV_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_RDIV_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_RDIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_RDIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_RDIV_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_RDIV_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_RDIV_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_RDIV_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_RDIV_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_RDIV_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_RDIV_FC64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_TIMES_RDIV_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_RDIV_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_RDIV_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_RDIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_RDIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_RDIV_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_RDIV_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_RDIV_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_RDIV_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_RDIV_FP64" ) ; + case GB_FC32_code : return ("GxB_TIMES_RDIV_FC32" ) ; + case GB_FC64_code : return ("GxB_TIMES_RDIV_FC64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_ANY_RDIV_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_RDIV_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_RDIV_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_RDIV_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_RDIV_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_RDIV_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_RDIV_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_RDIV_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_RDIV_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_RDIV_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_RDIV_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_RDIV_FC64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_EQ_binop_code : // z = (x == y) + //---------------------------------------------------------------------- + + // 55 semirings: (and,or,xor,eq,any) * 11 types (all but complex) + + switch (add_opcode) + { + + case GB_LOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LOR_EQ_BOOL" ) ; + case GB_INT8_code : return ("GxB_LOR_EQ_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_EQ_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_EQ_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_EQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_EQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_EQ_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_EQ_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_EQ_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_EQ_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_EQ_FP64" ) ; + default: ; + } + break ; + + case GB_LAND_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LAND_EQ_BOOL" ) ; + case GB_INT8_code : return ("GxB_LAND_EQ_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_EQ_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_EQ_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_EQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_EQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_EQ_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_EQ_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_EQ_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_EQ_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_EQ_FP64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LXOR_EQ_BOOL" ) ; + case GB_INT8_code : return ("GxB_LXOR_EQ_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_EQ_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_EQ_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_EQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_EQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_EQ_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_EQ_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_EQ_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_EQ_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_EQ_FP64" ) ; + default: ; + } + break ; + + case GB_EQ_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_EQ_EQ_BOOL" ) ; + case GB_INT8_code : return ("GxB_EQ_EQ_INT8" ) ; + case GB_INT16_code : return ("GxB_EQ_EQ_INT16" ) ; + case GB_INT32_code : return ("GxB_EQ_EQ_INT32" ) ; + case GB_INT64_code : return ("GxB_EQ_EQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_EQ_EQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_EQ_EQ_UINT16") ; + case GB_UINT32_code : return ("GxB_EQ_EQ_UINT32") ; + case GB_UINT64_code : return ("GxB_EQ_EQ_UINT64") ; + case GB_FP32_code : return ("GxB_EQ_EQ_FP32" ) ; + case GB_FP64_code : return ("GxB_EQ_EQ_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_ANY_EQ_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_EQ_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_EQ_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_EQ_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_EQ_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_EQ_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_EQ_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_EQ_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_EQ_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_EQ_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_EQ_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_NE_binop_code : // z = (x != y) + //---------------------------------------------------------------------- + + // 50 semirings: (and,or,xor,eq,any) * (10 real non-boolean types) + + switch (add_opcode) + { + + case GB_LOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_LOR_NE_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_NE_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_NE_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_NE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_NE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_NE_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_NE_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_NE_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_NE_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_NE_FP64" ) ; + default: ; + } + break ; + + case GB_LAND_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_LAND_NE_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_NE_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_NE_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_NE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_NE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_NE_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_NE_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_NE_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_NE_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_NE_FP64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_LXOR_NE_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_NE_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_NE_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_NE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_NE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_NE_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_NE_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_NE_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_NE_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_NE_FP64" ) ; + default: ; + } + break ; + + case GB_EQ_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_EQ_NE_INT8" ) ; + case GB_INT16_code : return ("GxB_EQ_NE_INT16" ) ; + case GB_INT32_code : return ("GxB_EQ_NE_INT32" ) ; + case GB_INT64_code : return ("GxB_EQ_NE_INT64" ) ; + case GB_UINT8_code : return ("GxB_EQ_NE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_EQ_NE_UINT16") ; + case GB_UINT32_code : return ("GxB_EQ_NE_UINT32") ; + case GB_UINT64_code : return ("GxB_EQ_NE_UINT64") ; + case GB_FP32_code : return ("GxB_EQ_NE_FP32" ) ; + case GB_FP64_code : return ("GxB_EQ_NE_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_ANY_NE_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_NE_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_NE_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_NE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_NE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_NE_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_NE_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_NE_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_NE_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_NE_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_GT_binop_code : // z = (x > y) + //---------------------------------------------------------------------- + + // 55 semirings: (and,or,xor,eq,any) * 11 types (all but complex) + + switch (add_opcode) + { + + case GB_LOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LOR_GT_BOOL" ) ; + case GB_INT8_code : return ("GxB_LOR_GT_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_GT_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_GT_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_GT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_GT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_GT_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_GT_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_GT_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_GT_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_GT_FP64" ) ; + default: ; + } + break ; + + case GB_LAND_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LAND_GT_BOOL" ) ; + case GB_INT8_code : return ("GxB_LAND_GT_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_GT_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_GT_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_GT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_GT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_GT_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_GT_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_GT_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_GT_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_GT_FP64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LXOR_GT_BOOL" ) ; + case GB_INT8_code : return ("GxB_LXOR_GT_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_GT_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_GT_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_GT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_GT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_GT_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_GT_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_GT_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_GT_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_GT_FP64" ) ; + default: ; + } + break ; + + case GB_EQ_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_EQ_GT_BOOL" ) ; + case GB_INT8_code : return ("GxB_EQ_GT_INT8" ) ; + case GB_INT16_code : return ("GxB_EQ_GT_INT16" ) ; + case GB_INT32_code : return ("GxB_EQ_GT_INT32" ) ; + case GB_INT64_code : return ("GxB_EQ_GT_INT64" ) ; + case GB_UINT8_code : return ("GxB_EQ_GT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_EQ_GT_UINT16") ; + case GB_UINT32_code : return ("GxB_EQ_GT_UINT32") ; + case GB_UINT64_code : return ("GxB_EQ_GT_UINT64") ; + case GB_FP32_code : return ("GxB_EQ_GT_FP32" ) ; + case GB_FP64_code : return ("GxB_EQ_GT_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_ANY_GT_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_GT_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_GT_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_GT_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_GT_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_GT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_GT_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_GT_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_GT_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_GT_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_GT_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_LT_binop_code : // z = (x < y) + //---------------------------------------------------------------------- + + // 55 semirings: (and,or,xor,eq,any) * 11 types (all but complex) + + switch (add_opcode) + { + + case GB_LOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LOR_LT_BOOL" ) ; + case GB_INT8_code : return ("GxB_LOR_LT_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_LT_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_LT_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_LT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_LT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_LT_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_LT_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_LT_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_LT_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_LT_FP64" ) ; + default: ; + } + break ; + + case GB_LAND_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LAND_LT_BOOL" ) ; + case GB_INT8_code : return ("GxB_LAND_LT_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_LT_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_LT_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_LT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_LT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_LT_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_LT_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_LT_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_LT_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_LT_FP64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LXOR_LT_BOOL" ) ; + case GB_INT8_code : return ("GxB_LXOR_LT_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_LT_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_LT_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_LT_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_LT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_LT_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_LT_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_LT_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_LT_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_LT_FP64" ) ; + default: ; + } + break ; + + case GB_EQ_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_EQ_LT_BOOL" ) ; + case GB_INT8_code : return ("GxB_EQ_LT_INT8" ) ; + case GB_INT16_code : return ("GxB_EQ_LT_INT16" ) ; + case GB_INT32_code : return ("GxB_EQ_LT_INT32" ) ; + case GB_INT64_code : return ("GxB_EQ_LT_INT64" ) ; + case GB_UINT8_code : return ("GxB_EQ_LT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_EQ_LT_UINT16") ; + case GB_UINT32_code : return ("GxB_EQ_LT_UINT32") ; + case GB_UINT64_code : return ("GxB_EQ_LT_UINT64") ; + case GB_FP32_code : return ("GxB_EQ_LT_FP32" ) ; + case GB_FP64_code : return ("GxB_EQ_LT_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_ANY_LT_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_LT_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_LT_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_LT_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_LT_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_LT_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_LT_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_LT_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_LT_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_LT_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_LT_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_GE_binop_code : // z = (x >= y) + //---------------------------------------------------------------------- + + // 55 semirings: (and,or,xor,eq,any) * 11 types (all but complex) + + switch (add_opcode) + { + + case GB_LOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LOR_GE_BOOL" ) ; + case GB_INT8_code : return ("GxB_LOR_GE_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_GE_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_GE_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_GE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_GE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_GE_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_GE_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_GE_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_GE_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_GE_FP64" ) ; + default: ; + } + break ; + + case GB_LAND_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LAND_GE_BOOL" ) ; + case GB_INT8_code : return ("GxB_LAND_GE_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_GE_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_GE_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_GE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_GE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_GE_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_GE_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_GE_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_GE_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_GE_FP64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LXOR_GE_BOOL" ) ; + case GB_INT8_code : return ("GxB_LXOR_GE_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_GE_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_GE_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_GE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_GE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_GE_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_GE_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_GE_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_GE_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_GE_FP64" ) ; + default: ; + } + break ; + + case GB_EQ_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_EQ_GE_BOOL" ) ; + case GB_INT8_code : return ("GxB_EQ_GE_INT8" ) ; + case GB_INT16_code : return ("GxB_EQ_GE_INT16" ) ; + case GB_INT32_code : return ("GxB_EQ_GE_INT32" ) ; + case GB_INT64_code : return ("GxB_EQ_GE_INT64" ) ; + case GB_UINT8_code : return ("GxB_EQ_GE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_EQ_GE_UINT16") ; + case GB_UINT32_code : return ("GxB_EQ_GE_UINT32") ; + case GB_UINT64_code : return ("GxB_EQ_GE_UINT64") ; + case GB_FP32_code : return ("GxB_EQ_GE_FP32" ) ; + case GB_FP64_code : return ("GxB_EQ_GE_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_ANY_GE_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_GE_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_GE_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_GE_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_GE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_GE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_GE_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_GE_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_GE_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_GE_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_GE_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_LE_binop_code : // z = (x <= y) + //---------------------------------------------------------------------- + + // 55 semirings: (and,or,xor,eq,any) * 11 types (all but complex) + + switch (add_opcode) + { + + case GB_LOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LOR_LE_BOOL" ) ; + case GB_INT8_code : return ("GxB_LOR_LE_INT8" ) ; + case GB_INT16_code : return ("GxB_LOR_LE_INT16" ) ; + case GB_INT32_code : return ("GxB_LOR_LE_INT32" ) ; + case GB_INT64_code : return ("GxB_LOR_LE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LOR_LE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LOR_LE_UINT16") ; + case GB_UINT32_code : return ("GxB_LOR_LE_UINT32") ; + case GB_UINT64_code : return ("GxB_LOR_LE_UINT64") ; + case GB_FP32_code : return ("GxB_LOR_LE_FP32" ) ; + case GB_FP64_code : return ("GxB_LOR_LE_FP64" ) ; + default: ; + } + break ; + + case GB_LAND_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LAND_LE_BOOL" ) ; + case GB_INT8_code : return ("GxB_LAND_LE_INT8" ) ; + case GB_INT16_code : return ("GxB_LAND_LE_INT16" ) ; + case GB_INT32_code : return ("GxB_LAND_LE_INT32" ) ; + case GB_INT64_code : return ("GxB_LAND_LE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LAND_LE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LAND_LE_UINT16") ; + case GB_UINT32_code : return ("GxB_LAND_LE_UINT32") ; + case GB_UINT64_code : return ("GxB_LAND_LE_UINT64") ; + case GB_FP32_code : return ("GxB_LAND_LE_FP32" ) ; + case GB_FP64_code : return ("GxB_LAND_LE_FP64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_LXOR_LE_BOOL" ) ; + case GB_INT8_code : return ("GxB_LXOR_LE_INT8" ) ; + case GB_INT16_code : return ("GxB_LXOR_LE_INT16" ) ; + case GB_INT32_code : return ("GxB_LXOR_LE_INT32" ) ; + case GB_INT64_code : return ("GxB_LXOR_LE_INT64" ) ; + case GB_UINT8_code : return ("GxB_LXOR_LE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_LXOR_LE_UINT16") ; + case GB_UINT32_code : return ("GxB_LXOR_LE_UINT32") ; + case GB_UINT64_code : return ("GxB_LXOR_LE_UINT64") ; + case GB_FP32_code : return ("GxB_LXOR_LE_FP32" ) ; + case GB_FP64_code : return ("GxB_LXOR_LE_FP64" ) ; + default: ; + } + break ; + + case GB_EQ_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_EQ_LE_BOOL" ) ; + case GB_INT8_code : return ("GxB_EQ_LE_INT8" ) ; + case GB_INT16_code : return ("GxB_EQ_LE_INT16" ) ; + case GB_INT32_code : return ("GxB_EQ_LE_INT32" ) ; + case GB_INT64_code : return ("GxB_EQ_LE_INT64" ) ; + case GB_UINT8_code : return ("GxB_EQ_LE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_EQ_LE_UINT16") ; + case GB_UINT32_code : return ("GxB_EQ_LE_UINT32") ; + case GB_UINT64_code : return ("GxB_EQ_LE_UINT64") ; + case GB_FP32_code : return ("GxB_EQ_LE_FP32" ) ; + case GB_FP64_code : return ("GxB_EQ_LE_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus boolean + case GB_BOOL_code : return ("GxB_ANY_LE_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_LE_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_LE_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_LE_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_LE_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_LE_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_LE_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_LE_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_LE_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_LE_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_LE_FP64" ) ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_PAIR_binop_code : // z = 1 + //---------------------------------------------------------------------- + + // 26 semirings with PAIR: + // 13: ANY_PAIR semirings + // 12: (plus) for 10 real non-boolean and 2 complex + // 1: (xor) for boolean + + switch (add_opcode) + { + + case GB_MIN_binop_code: + case GB_MAX_binop_code: + case GB_TIMES_binop_code: + case GB_LOR_binop_code: + case GB_LAND_binop_code: + case GB_EQ_binop_code: + case GB_ANY_binop_code: + + switch (xcode) + { + // 11 real and boolean types, plus 2 complex + case GB_BOOL_code : return ("GxB_ANY_PAIR_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_PAIR_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_PAIR_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_PAIR_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_PAIR_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_PAIR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_PAIR_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_PAIR_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_PAIR_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_PAIR_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_PAIR_FP64" ) ; + case GB_FC32_code : return ("GxB_ANY_PAIR_FC32" ) ; + case GB_FC64_code : return ("GxB_ANY_PAIR_FC64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types, plus 2 complex + case GB_INT8_code : return ("GxB_PLUS_PAIR_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_PAIR_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_PAIR_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_PAIR_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_PAIR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_PAIR_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_PAIR_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_PAIR_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_PAIR_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_PAIR_FP64" ) ; + case GB_FC32_code : return ("GxB_PLUS_PAIR_FC32" ) ; + case GB_FC64_code : return ("GxB_PLUS_PAIR_FC64" ) ; + default: ; + } + break ; + + case GB_LXOR_binop_code : if (xbool) return ("GxB_LXOR_PAIR_BOOL") ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_LOR_binop_code : // z = x || y + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_LOR_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_LOR_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_LOR_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_LOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_LOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_LOR_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_LOR_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_LOR_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_LOR_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_LOR_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_LOR_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_LOR_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_LOR_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_LOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_LOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_LOR_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_LOR_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_LOR_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_LOR_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_LOR_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_LOR_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_LOR_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_LOR_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_LOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_LOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_LOR_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_LOR_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_LOR_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_LOR_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_LOR_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_LOR_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_LOR_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_LOR_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_LOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_LOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_LOR_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_LOR_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_LOR_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_LOR_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_LOR_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 11 real and boolean types + case GB_BOOL_code : return ("GxB_ANY_LOR_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_LOR_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_LOR_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_LOR_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_LOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_LOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_LOR_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_LOR_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_LOR_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_LOR_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_LOR_FP64" ) ; + default: ; + } + break ; + + case GB_LOR_binop_code : if (xbool) return ("GxB_LOR_LOR_BOOL" ) ; + case GB_LAND_binop_code : if (xbool) return ("GrB_LAND_LOR_SEMIRING_BOOL" ) ; + case GB_EQ_binop_code : if (xbool) return ("GrB_LXNOR_LOR_SEMIRING_BOOL") ; + case GB_LXOR_binop_code : if (xbool) return ("GxB_LXOR_LOR_BOOL" ) ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_LAND_binop_code : // z = x && y + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_LAND_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_LAND_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_LAND_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_LAND_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_LAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_LAND_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_LAND_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_LAND_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_LAND_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_LAND_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_LAND_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_LAND_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_LAND_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_LAND_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_LAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_LAND_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_LAND_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_LAND_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_LAND_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_LAND_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_LAND_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_LAND_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_LAND_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_LAND_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_LAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_LAND_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_LAND_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_LAND_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_LAND_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_LAND_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_LAND_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_LAND_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_LAND_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_LAND_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_LAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_LAND_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_LAND_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_LAND_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_LAND_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_LAND_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 11 real and boolean types + case GB_BOOL_code : return ("GxB_ANY_LAND_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_LAND_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_LAND_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_LAND_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_LAND_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_LAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_LAND_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_LAND_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_LAND_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_LAND_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_LAND_FP64" ) ; + default: ; + } + break ; + + case GB_LOR_binop_code : if (xbool) return ("GrB_LOR_LAND_SEMIRING_BOOL" ) ; + case GB_LAND_binop_code : if (xbool) return ("GxB_LAND_LAND_BOOL" ) ; + case GB_EQ_binop_code : if (xbool) return ("GxB_EQ_LAND_BOOL" ) ; + case GB_LXOR_binop_code : if (xbool) return ("GrB_LXOR_LAND_SEMIRING_BOOL") ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_LXOR_binop_code : // z = x != y + //---------------------------------------------------------------------- + + switch (add_opcode) + { + + case GB_MIN_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MIN_LXOR_INT8" ) ; + case GB_INT16_code : return ("GxB_MIN_LXOR_INT16" ) ; + case GB_INT32_code : return ("GxB_MIN_LXOR_INT32" ) ; + case GB_INT64_code : return ("GxB_MIN_LXOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_MIN_LXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MIN_LXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_MIN_LXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_MIN_LXOR_UINT64") ; + case GB_FP32_code : return ("GxB_MIN_LXOR_FP32" ) ; + case GB_FP64_code : return ("GxB_MIN_LXOR_FP64" ) ; + default: ; + } + break ; + + case GB_MAX_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_MAX_LXOR_INT8" ) ; + case GB_INT16_code : return ("GxB_MAX_LXOR_INT16" ) ; + case GB_INT32_code : return ("GxB_MAX_LXOR_INT32" ) ; + case GB_INT64_code : return ("GxB_MAX_LXOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_MAX_LXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_MAX_LXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_MAX_LXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_MAX_LXOR_UINT64") ; + case GB_FP32_code : return ("GxB_MAX_LXOR_FP32" ) ; + case GB_FP64_code : return ("GxB_MAX_LXOR_FP64" ) ; + default: ; + } + break ; + + case GB_PLUS_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_PLUS_LXOR_INT8" ) ; + case GB_INT16_code : return ("GxB_PLUS_LXOR_INT16" ) ; + case GB_INT32_code : return ("GxB_PLUS_LXOR_INT32" ) ; + case GB_INT64_code : return ("GxB_PLUS_LXOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_PLUS_LXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_PLUS_LXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_PLUS_LXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_PLUS_LXOR_UINT64") ; + case GB_FP32_code : return ("GxB_PLUS_LXOR_FP32" ) ; + case GB_FP64_code : return ("GxB_PLUS_LXOR_FP64" ) ; + default: ; + } + break ; + + case GB_TIMES_binop_code: + + switch (xcode) + { + // 10 real, non-boolean types + case GB_INT8_code : return ("GxB_TIMES_LXOR_INT8" ) ; + case GB_INT16_code : return ("GxB_TIMES_LXOR_INT16" ) ; + case GB_INT32_code : return ("GxB_TIMES_LXOR_INT32" ) ; + case GB_INT64_code : return ("GxB_TIMES_LXOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_TIMES_LXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_TIMES_LXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_TIMES_LXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_TIMES_LXOR_UINT64") ; + case GB_FP32_code : return ("GxB_TIMES_LXOR_FP32" ) ; + case GB_FP64_code : return ("GxB_TIMES_LXOR_FP64" ) ; + default: ; + } + break ; + + case GB_ANY_binop_code: + + switch (xcode) + { + // 11 real and boolean types + case GB_BOOL_code : return ("GxB_ANY_LXOR_BOOL" ) ; + case GB_INT8_code : return ("GxB_ANY_LXOR_INT8" ) ; + case GB_INT16_code : return ("GxB_ANY_LXOR_INT16" ) ; + case GB_INT32_code : return ("GxB_ANY_LXOR_INT32" ) ; + case GB_INT64_code : return ("GxB_ANY_LXOR_INT64" ) ; + case GB_UINT8_code : return ("GxB_ANY_LXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_ANY_LXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_ANY_LXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_ANY_LXOR_UINT64") ; + case GB_FP32_code : return ("GxB_ANY_LXOR_FP32" ) ; + case GB_FP64_code : return ("GxB_ANY_LXOR_FP64" ) ; + default: ; + } + break ; + + case GB_LOR_binop_code : if (xbool) return ("GxB_LOR_LXOR_BOOL" ) ; + case GB_LAND_binop_code : if (xbool) return ("GxB_LAND_LXOR_BOOL" ) ; + case GB_EQ_binop_code : if (xbool) return ("GxB_EQ_LXOR_BOOL" ) ; + case GB_LXOR_binop_code : if (xbool) return ("GxB_LXOR_LXOR_BOOL" ) ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_BOR_binop_code : // z = (x | y), bitwise or + //---------------------------------------------------------------------- + + // 16 semirings: (bor,band,bxor,bxnor) * (uint8,16,32,64) + + switch (add_opcode) + { + + case GB_BOR_binop_code : // z = (x | y), bitwise or + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BOR_BOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BOR_BOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BOR_BOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BOR_BOR_UINT64") ; + default: ; + } + break ; + + case GB_BAND_binop_code : // z = (x & y), bitwise and + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BAND_BOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BAND_BOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BAND_BOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BAND_BOR_UINT64") ; + default: ; + } + break ; + + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXOR_BOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXOR_BOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BXOR_BOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BXOR_BOR_UINT64") ; + default: ; + } + break ; + + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXNOR_BOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXNOR_BOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BXNOR_BOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BXNOR_BOR_UINT64") ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_BAND_binop_code : // z = (x & y), bitwise and + //---------------------------------------------------------------------- + + // 16 semirings: (bor,band,bxor,bxnor) * (uint8,16,32,64) + + switch (add_opcode) + { + + case GB_BOR_binop_code : // z = (x | y), bitwise or + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BOR_BAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BOR_BAND_UINT16") ; + case GB_UINT32_code : return ("GxB_BOR_BAND_UINT32") ; + case GB_UINT64_code : return ("GxB_BOR_BAND_UINT64") ; + default: ; + } + break ; + + case GB_BAND_binop_code : // z = (x & y), bitwise and + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BAND_BAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BAND_BAND_UINT16") ; + case GB_UINT32_code : return ("GxB_BAND_BAND_UINT32") ; + case GB_UINT64_code : return ("GxB_BAND_BAND_UINT64") ; + default: ; + } + break ; + + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXOR_BAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXOR_BAND_UINT16") ; + case GB_UINT32_code : return ("GxB_BXOR_BAND_UINT32") ; + case GB_UINT64_code : return ("GxB_BXOR_BAND_UINT64") ; + default: ; + } + break ; + + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXNOR_BAND_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXNOR_BAND_UINT16") ; + case GB_UINT32_code : return ("GxB_BXNOR_BAND_UINT32") ; + case GB_UINT64_code : return ("GxB_BXNOR_BAND_UINT64") ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + //---------------------------------------------------------------------- + + // 16 semirings: (bor,band,bxor,bxnor) * (uint8,16,32,64) + + switch (add_opcode) + { + + case GB_BOR_binop_code : // z = (x | y), bitwise or + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BOR_BXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BOR_BXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BOR_BXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BOR_BXOR_UINT64") ; + default: ; + } + break ; + + case GB_BAND_binop_code : // z = (x & y), bitwise and + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BAND_BXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BAND_BXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BAND_BXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BAND_BXOR_UINT64") ; + default: ; + } + break ; + + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXOR_BXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXOR_BXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BXOR_BXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BXOR_BXOR_UINT64") ; + default: ; + } + break ; + + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXNOR_BXOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXNOR_BXOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BXNOR_BXOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BXNOR_BXOR_UINT64") ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + //---------------------------------------------------------------------- + + // 16 semirings: (bor,band,bxor,bxnor) * (uint8,16,32,64) + + switch (add_opcode) + { + + case GB_BOR_binop_code : // z = (x | y), bitwise or + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BOR_BXNOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BOR_BXNOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BOR_BXNOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BOR_BXNOR_UINT64") ; + default: ; + } + break ; + + case GB_BAND_binop_code : // z = (x & y), bitwise and + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BAND_BXNOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BAND_BXNOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BAND_BXNOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BAND_BXNOR_UINT64") ; + default: ; + } + break ; + + case GB_BXOR_binop_code : // z = (x ^ y), bitwise xor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXOR_BXNOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXOR_BXNOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BXOR_BXNOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BXOR_BXNOR_UINT64") ; + default: ; + } + break ; + + case GB_BXNOR_binop_code : // z = ~(x ^ y), bitwise xnor + + switch (zcode) + { + case GB_UINT8_code : return ("GxB_BXNOR_BXNOR_UINT8" ) ; + case GB_UINT16_code : return ("GxB_BXNOR_BXNOR_UINT16") ; + case GB_UINT32_code : return ("GxB_BXNOR_BXNOR_UINT32") ; + case GB_UINT64_code : return ("GxB_BXNOR_BXNOR_UINT64") ; + default: ; + } + break ; + + default: ; + } + break ; + + //---------------------------------------------------------------------- + case GB_FIRSTI_binop_code : // z = first_i(A(i,k),y) == i + //---------------------------------------------------------------------- + + // 10 semirings: (min,max,times,plus,any) * (int32,int64) + + if (zcode == GB_INT32_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_FIRSTI_INT32" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_FIRSTI_INT32" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_FIRSTI_INT32") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_FIRSTI_INT32" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_FIRSTI_INT32" ) ; + default: ; + } + } + else if (zcode == GB_INT64_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_FIRSTI_INT64" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_FIRSTI_INT64" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_FIRSTI_INT64") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_FIRSTI_INT64" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_FIRSTI_INT64" ) ; + default: ; + } + } + break ; + + //---------------------------------------------------------------------- + case GB_FIRSTI1_binop_code : // z = first_i1(A(i,k),y) == i+1 + //---------------------------------------------------------------------- + + // 10 semirings: (min,max,times,plus,any) * (int32,int64) + + if (zcode == GB_INT32_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_FIRSTI1_INT32" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_FIRSTI1_INT32" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_FIRSTI1_INT32") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_FIRSTI1_INT32" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_FIRSTI1_INT32" ) ; + default: ; + } + } + else if (zcode == GB_INT64_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_FIRSTI1_INT64" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_FIRSTI1_INT64" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_FIRSTI1_INT64") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_FIRSTI1_INT64" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_FIRSTI1_INT64" ) ; + default: ; + } + } + break ; + + //---------------------------------------------------------------------- + case GB_FIRSTJ_binop_code : // z = first_j(A(i,k),y) == k + case GB_SECONDI_binop_code : // z = second_i(x,B(k,j)) == k + //---------------------------------------------------------------------- + + // 10 semirings: (min,max,times,plus,any) * (int32,int64) + // FIRSTJ and SECONDI are identical when used in a semiring + + if (zcode == GB_INT32_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDI_INT32" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDI_INT32" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDI_INT32") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDI_INT32" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDI_INT32" ) ; + default: ; + } + } + else if (zcode == GB_INT64_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDI_INT64" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDI_INT64" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDI_INT64") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDI_INT64" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDI_INT64" ) ; + default: ; + } + } + break ; + + //---------------------------------------------------------------------- + case GB_FIRSTJ1_binop_code : // z = first_j1(A(i,k),y) == k+1 + case GB_SECONDI1_binop_code : // z = second_i1(x,B(k,j)) == k+1 + //---------------------------------------------------------------------- + + // 10 semirings: (min,max,times,plus,any) * (int32,int64) + // FIRSTJ1 and SECONDI1 are identical when used in a semiring + + if (zcode == GB_INT32_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDI1_INT32" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDI1_INT32" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDI1_INT32") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDI1_INT32" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDI1_INT32" ) ; + default: ; + } + } + else if (zcode == GB_INT64_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDI1_INT64" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDI1_INT64" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDI1_INT64") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDI1_INT64" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDI1_INT64" ) ; + default: ; + } + } + break ; + + //---------------------------------------------------------------------- + case GB_SECONDJ_binop_code : // z = second_j(x,B(i,j)) == j + //---------------------------------------------------------------------- + + // 10 semirings: (min,max,times,plus,any) * (int32,int64) + + if (zcode == GB_INT32_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDJ_INT32" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDJ_INT32" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDJ_INT32") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDJ_INT32" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDJ_INT32" ) ; + default: ; + } + } + else if (zcode == GB_INT64_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDJ_INT64" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDJ_INT64" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDJ_INT64") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDJ_INT64" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDJ_INT64" ) ; + default: ; + } + } + break ; + + //---------------------------------------------------------------------- + case GB_SECONDJ1_binop_code : // z = second_j1(x,B(i,j)) == j+1 + //---------------------------------------------------------------------- + + // 10 semirings: (min,max,times,plus,any) * (int32,int64) + + if (zcode == GB_INT32_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDJ1_INT32" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDJ1_INT32" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDJ1_INT32") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDJ1_INT32" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDJ1_INT32" ) ; + default: ; + } + } + else if (zcode == GB_INT64_code) + { + switch (add_opcode) + { + case GB_MIN_binop_code : return ("GxB_MIN_SECONDJ1_INT64" ) ; + case GB_MAX_binop_code : return ("GxB_MAX_SECONDJ1_INT64" ) ; + case GB_TIMES_binop_code : return ("GxB_TIMES_SECONDJ1_INT64") ; + case GB_PLUS_binop_code : return ("GxB_PLUS_SECONDJ1_INT64" ) ; + case GB_ANY_binop_code : return ("GxB_ANY_SECONDJ1_INT64" ) ; + default: ; + } + } + break ; + + default: ; + } + + return (NULL) ; +} + diff --git a/GraphBLAS/Source/GB_serialize.c b/GraphBLAS/Source/GB_serialize.c index 87d61396a0..2b9591c3cc 100644 --- a/GraphBLAS/Source/GB_serialize.c +++ b/GraphBLAS/Source/GB_serialize.c @@ -14,6 +14,7 @@ // estimate the size of the blob for GrB_Matrix_serializeSize. #include "GB.h" +#include "GB_get_set.h" #include "GB_serialize.h" #define GB_FREE_WORKSPACE \ @@ -243,6 +244,14 @@ GrB_Info GB_serialize // serialize a matrix into a blob s += Ai_compressed_size ; s += Ax_compressed_size ; + // size of the GrB_NAME and GrB_EL_TYPE_STRING, including one nul byte each + char *user_name = A->user_name ; + size_t user_name_len = (user_name == NULL) ? 0 : strlen (user_name) ; + const char *eltype_string = GB_type_name_get (A->type) ; + size_t eltype_string_len = (eltype_string == NULL) ? 0 : + strlen (eltype_string) ; + s += (user_name_len + 1) + (eltype_string_len + 1) ; + //-------------------------------------------------------------------------- // return the upper bound estimate of the blob size, for dryrun //-------------------------------------------------------------------------- @@ -362,6 +371,28 @@ GrB_Info GB_serialize // serialize a matrix into a blob GB_serialize_to_blob (blob, &s, Ax_Blocks, Ax_Sblocks+1, Ax_nblocks, nthreads_max) ; + //-------------------------------------------------------------------------- + // append the GrB_NAME and GrB_EL_TYPE_STRING to the blob + //-------------------------------------------------------------------------- + + if (user_name != NULL) + { + // write the GrB_NAME of the matrix (including the nul byte) +// printf ("serialize user_name %lu:[%s]\n", s, user_name) ; + strcpy ((char *) (blob + s), user_name) ; + s += user_name_len ; + } + blob [s++] = 0 ; // terminate the GrB_NAME with a nul byte + + if (eltype_string != NULL) + { + // write the EL_TYPE_STRING of the matrix type (including the nul byte) +// printf ("serialize eltype_string %lu:[%s]\n", s, eltype_string) ; + strcpy ((char *) (blob + s), eltype_string) ; + s += eltype_string_len ; + } + blob [s++] = 0 ; // terminate the GrB_EL_TYPE_STRING with a nul byte + ASSERT (s == blob_size_required) ; //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Source/GB_serialize.h b/GraphBLAS/Source/GB_serialize.h index 7de0facf18..95c57d88f3 100644 --- a/GraphBLAS/Source/GB_serialize.h +++ b/GraphBLAS/Source/GB_serialize.h @@ -104,35 +104,37 @@ GrB_Info GB_deserialize_from_blob ) ; #define GB_BLOB_HEADER_SIZE \ - sizeof (uint64_t) /* blob_size */ \ - + 11 * sizeof (int64_t) /* vlen, vdim, nvec, nvec_nonempty, */ \ - /* nvals, typesize, A[phbix]_len */ \ - + 14 * sizeof (int32_t) /* version, typecode, sparsity_control, */ \ - /* A[phbix]_nblocks, A[phbix]_method, */ \ - /* sparsity_iso_csc */ \ + sizeof (uint64_t) /* blob_size */ \ + + 11 * sizeof (int64_t) /* vlen, vdim, nvec, nvec_nonempty, */ \ + /* nvals, typesize, A[phbix]_len */ \ + + 14 * sizeof (int32_t) /* version, typecode, sparsity_control, */ \ + /* A[phbix]_nblocks, A[phbix]_method, */ \ + /* sparsity_iso_csc */ \ + 2 * sizeof (float) /* hyper_switch, bitmap_switch */ // write a scalar to the blob -#define GB_BLOB_WRITE(x,type) \ - memcpy (blob + s, &(x), sizeof (type)) ; s += sizeof (type) ; +#define GB_BLOB_WRITE(x,type) \ + memcpy (blob + s, &(x), sizeof (type)) ; \ + s += sizeof (type) ; // write an int64_t array to the blob #define GB_BLOB_WRITES(S,n) \ - if (n > 0) \ - { \ - memcpy (((GB_void *) blob) + s, S + 1, n * sizeof (int64_t)) ; \ - s += n * sizeof (int64_t) ; \ + if (n > 0) \ + { \ + memcpy (((GB_void *) blob) + s, S + 1, n * sizeof (int64_t)) ; \ + s += n * sizeof (int64_t) ; \ } // read a scalar from the blob -#define GB_BLOB_READ(x,type) \ - type x ; \ - memcpy (&x, ((GB_void *) blob) + s, sizeof (type)) ; \ +#define GB_BLOB_READ(x,type) \ + type x ; \ + memcpy (&x, ((GB_void *) blob) + s, sizeof (type)) ; \ s += sizeof (type) ; // get an int64_t pointer to an array in the blob -#define GB_BLOB_READS(S,n) \ - int64_t *S = (int64_t *) (blob + s) ; s += n * sizeof (int64_t) ; +#define GB_BLOB_READS(S,n) \ + int64_t *S = (int64_t *) (blob + s) ; \ + s += n * sizeof (int64_t) ; #endif diff --git a/GraphBLAS/Source/GB_setElement.c b/GraphBLAS/Source/GB_setElement.c index 4d2d322dbb..f7700461cc 100644 --- a/GraphBLAS/Source/GB_setElement.c +++ b/GraphBLAS/Source/GB_setElement.c @@ -223,6 +223,7 @@ GrB_Info GB_setElement // set a single entry, C(row,col) = scalar int64_t pC_start, pC_end ; const int64_t *restrict Ch = C->h ; + const int64_t *restrict Cp = C->p ; if (C->nvals == 0) { // C is empty @@ -231,28 +232,21 @@ GrB_Info GB_setElement // set a single entry, C(row,col) = scalar else if (Ch != NULL) { // C is hypersparse, with at least one entry - int64_t k ; - if (C->Y == NULL) - { - // C is hypersparse but does not yet have a hyper_hash - k = 0 ; - found = GB_lookup (true, Ch, C->p, C->vlen, &k, - C->nvec-1, j, &pC_start, &pC_end) ; - } - else - { - // C is hypersparse, with a hyper_hash that is already built - k = GB_hyper_hash_lookup (C->p, C->Y->p, C->Y->i, C->Y->x, - C->Y->vdim-1, j, &pC_start, &pC_end) ; - found = (k >= 0) ; - } + const int64_t *restrict C_Yp = (C->Y == NULL) ? NULL : C->Y->p ; + const int64_t *restrict C_Yi = (C->Y == NULL) ? NULL : C->Y->i ; + const int64_t *restrict C_Yx = (C->Y == NULL) ? NULL : C->Y->x ; + const int64_t C_hash_bits = (C->Y == NULL) ? 0 : (C->Y->vdim - 1) ; + const int64_t cnvec = C->nvec ; + int64_t k = GB_hyper_hash_lookup (Ch, cnvec, Cp, C_Yp, C_Yi, C_Yx, + C_hash_bits, j, &pC_start, &pC_end) ; + found = (k >= 0) ; ASSERT (GB_IMPLIES (found, j == Ch [k])) ; } else { // C is sparse - pC_start = C->p [j] ; - pC_end = C->p [j+1] ; + pC_start = Cp [j] ; + pC_end = Cp [j+1] ; found = true ; } diff --git a/GraphBLAS/Source/GB_status_code.c b/GraphBLAS/Source/GB_status_code.c index 180f5baa57..46c24c9cae 100644 --- a/GraphBLAS/Source/GB_status_code.c +++ b/GraphBLAS/Source/GB_status_code.c @@ -30,6 +30,7 @@ const char *GB_status_code (GrB_Info info) case GrB_INDEX_OUT_OF_BOUNDS : return ("GrB_INDEX_OUT_OF_BOUNDS") ; case GrB_PANIC : return ("GrB_PANIC") ; case GrB_NOT_IMPLEMENTED : return ("GrB_NOT_IMPLEMENTED") ; + case GrB_ALREADY_SET : return ("GrB_ALREADY_SET") ; case GrB_EMPTY_OBJECT : return ("GrB_EMPTY_OBJECT") ; default : return ("unknown GrB_Info value!") ; } diff --git a/GraphBLAS/Source/GB_subassign_06n.c b/GraphBLAS/Source/GB_subassign_06n.c index f327a14454..5fc3619e19 100644 --- a/GraphBLAS/Source/GB_subassign_06n.c +++ b/GraphBLAS/Source/GB_subassign_06n.c @@ -89,10 +89,10 @@ GrB_Info GB_subassign_06n GrB_BinaryOp accum = NULL ; GB_OK (GB_hyper_hash_build (A, Werk)) ; - const int64_t *restrict A_Yp = (A_is_hyper) ? A->Y->p : NULL ; - const int64_t *restrict A_Yi = (A_is_hyper) ? A->Y->i : NULL ; - const int64_t *restrict A_Yx = (A_is_hyper) ? A->Y->x : NULL ; - const int64_t A_hash_bits = (A_is_hyper) ? (A->Y->vdim - 1) : 0 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; //-------------------------------------------------------------------------- // Method 06n: C(I,J) = A ; no S diff --git a/GraphBLAS/Source/GB_subref_phase0.c b/GraphBLAS/Source/GB_subref_phase0.c index ead990a359..b85999dc8c 100644 --- a/GraphBLAS/Source/GB_subref_phase0.c +++ b/GraphBLAS/Source/GB_subref_phase0.c @@ -327,10 +327,10 @@ GrB_Info GB_subref_phase0 GB_OK (GB_hyper_hash_build (A, Werk)) ; } - const int64_t *restrict A_Yp = (use_hyper_hash) ? A->Y->p : NULL ; - const int64_t *restrict A_Yi = (use_hyper_hash) ? A->Y->i : NULL ; - const int64_t *restrict A_Yx = (use_hyper_hash) ? A->Y->x : NULL ; - const int64_t A_hash_bits = (use_hyper_hash) ? (A->Y->vdim - 1) : 0 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; //-------------------------------------------------------------------------- // determine # of threads to use @@ -486,7 +486,7 @@ GrB_Info GB_subref_phase0 { // find jA using the hyper_hash int64_t ignore1, ignore2 ; - kA = GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, + kA = GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, jA, &ignore1, &ignore2) ; found = (kA >= 0) ; } @@ -683,7 +683,7 @@ GrB_Info GB_subref_phase0 { // find jA using the hyper_hash int64_t ignore1, ignore2 ; - kA = GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, + kA = GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, jA, &ignore1, &ignore2) ; found = (kA >= 0) ; } diff --git a/GraphBLAS/Source/GB_transplant.c b/GraphBLAS/Source/GB_transplant.c index c492d99dc4..d5a8ab19a8 100644 --- a/GraphBLAS/Source/GB_transplant.c +++ b/GraphBLAS/Source/GB_transplant.c @@ -14,8 +14,8 @@ // shallow. This function is not user-callable. The new type of C (ctype) // must be compatible with A->type. -// C->hyper_switch, C->bitmap_switch, C->sparsity_control, and C->static_header -// are not modified by the transplant. +// C->hyper_switch, C->bitmap_switch, C->sparsity_control, C->static_header, +// C->user_name, and C->user_name_size are not modified by the transplant. #define GB_FREE_ALL \ { \ diff --git a/GraphBLAS/Source/GB_type_code_get.c b/GraphBLAS/Source/GB_type_code_get.c new file mode 100644 index 0000000000..b0c3609555 --- /dev/null +++ b/GraphBLAS/Source/GB_type_code_get.c @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// GB_type_code_get: convert a GB_Type_code to a GrB_Type_Code +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Type_Code GB_type_code_get // return the GrB_Type_Code for the code +( + const GB_Type_code code // type code to convert +) +{ + + ASSERT (code >= 0 && code <= GB_UDT_code) ; + switch (code) + { + case GB_BOOL_code : return (GrB_BOOL_CODE) ; + case GB_INT8_code : return (GrB_INT8_CODE) ; + case GB_INT16_code : return (GrB_INT16_CODE) ; + case GB_INT32_code : return (GrB_INT32_CODE) ; + case GB_INT64_code : return (GrB_INT64_CODE) ; + case GB_UINT8_code : return (GrB_UINT8_CODE) ; + case GB_UINT16_code : return (GrB_UINT16_CODE) ; + case GB_UINT32_code : return (GrB_UINT32_CODE) ; + case GB_UINT64_code : return (GrB_UINT64_CODE) ; + case GB_FP32_code : return (GrB_FP32_CODE) ; + case GB_FP64_code : return (GrB_FP64_CODE) ; + case GB_FC32_code : return (GxB_FC32_CODE) ; + case GB_FC64_code : return (GxB_FC64_CODE) ; + default: + case GB_UDT_code : return (GrB_UDT_CODE) ; + } +} + diff --git a/GraphBLAS/Source/GB_type_name_get.c b/GraphBLAS/Source/GB_type_name_get.c new file mode 100644 index 0000000000..5ab8f2d278 --- /dev/null +++ b/GraphBLAS/Source/GB_type_name_get.c @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// GB_type_name_get: get the user_name of a type +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +const char *GB_type_name_get (GrB_Type type) +{ + + if (type == NULL) + { + return (NULL) ; + } + + return (GB_code_name_get (type->code, type->user_name)) ; +} + diff --git a/GraphBLAS/Source/GB_unop_new.c b/GraphBLAS/Source/GB_unop_new.c index 6b8bee30d4..d4486fc9c5 100644 --- a/GraphBLAS/Source/GB_unop_new.c +++ b/GraphBLAS/Source/GB_unop_new.c @@ -42,6 +42,8 @@ GrB_Info GB_unop_new //-------------------------------------------------------------------------- op->magic = GB_MAGIC ; + op->user_name = NULL ; + op->user_name_size = 0 ; op->xtype = xtype ; op->ztype = ztype ; op->ytype = NULL ; @@ -65,7 +67,6 @@ GrB_Info GB_unop_new // output: op->name, &(op->name_len), &(op->hash), &(op->defn), &(op->defn_size), // input: - unop_name, unop_defn, "GxB_unary_function", 18, - opcode == GB_USER_unop_code, jitable)) ; + unop_name, unop_defn, opcode == GB_USER_unop_code, jitable)) ; } diff --git a/GraphBLAS/Source/GB_user_name_set.c b/GraphBLAS/Source/GB_user_name_set.c new file mode 100644 index 0000000000..7b9bed82be --- /dev/null +++ b/GraphBLAS/Source/GB_user_name_set.c @@ -0,0 +1,58 @@ +//------------------------------------------------------------------------------ +// GB_user_name_set: set the user_name of an object +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +GrB_Info GB_user_name_set +( + // input/output + char **object_user_name, // user_name of the object + size_t *object_user_name_size, // user_name_size of the object + // input + const char *new_name, // new name for the object + const bool only_once // if true, the name of the object can + // only be set once +) +{ + + if (only_once && (*object_user_name) != NULL) + { + // types, operators, monoids, and semirings can have their GrB_NAME + // set at most once + return (GrB_ALREADY_SET) ; + } + + // free the object user_name, if it already exists + GB_FREE (object_user_name, (*object_user_name_size)) ; + (*object_user_name_size) = 0 ; + + // get the length of the new name + size_t len = strlen (new_name) ; + if (len == 0) + { + // no new name; leave the object unnamed + return (GrB_SUCCESS) ; + } + + // allocate the new name + size_t user_name_size ; + char *user_name = GB_MALLOC (len + 1, char, &user_name_size) ; + if (user_name == NULL) + { + // out of memory + return (GrB_OUT_OF_MEMORY) ; + } + + // set the new user_name + strcpy (user_name, new_name) ; + (*object_user_name) = user_name ; + (*object_user_name_size) = user_name_size ; + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GrB_BinaryOp_get.c b/GraphBLAS/Source/GrB_BinaryOp_get.c new file mode 100644 index 0000000000..39e0ba7ed0 --- /dev/null +++ b/GraphBLAS/Source/GrB_BinaryOp_get.c @@ -0,0 +1,149 @@ +//------------------------------------------------------------------------------ +// GrB_BinaryOp_get_*: get a field in a binary op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_get_Scalar +( + GrB_BinaryOp op, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_BinaryOp_get_Scalar (op, value, field)") ; + if (op != GxB_IGNORE_DUP) + { + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + ASSERT_BINARYOP_OK (op, "binaryop for get", GB0) ; + } + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_scalar_get ((GB_Operator) op, value, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_get_String +( + GrB_BinaryOp op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_BinaryOp_get_String (op, value, field)") ; + if (op != GxB_IGNORE_DUP) + { + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + ASSERT_BINARYOP_OK (op, "binaryop for get", GB0) ; + } + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_string_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_get_INT32 +( + GrB_BinaryOp op, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_BinaryOp_get_INT32 (op, value, field)") ; + if (op != GxB_IGNORE_DUP) + { + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + ASSERT_BINARYOP_OK (op, "binaryop for get", GB0) ; + } + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_enum_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_get_SIZE +( + GrB_BinaryOp op, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_BinaryOp_get_SIZE (op, value, field)") ; + if (op != GxB_IGNORE_DUP) + { + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + ASSERT_BINARYOP_OK (op, "binaryop for get", GB0) ; + } + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_size_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_get_VOID +( + GrB_BinaryOp op, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_BinaryOp_new.c b/GraphBLAS/Source/GrB_BinaryOp_new.c index ee36f2900f..ca659a44ad 100644 --- a/GraphBLAS/Source/GrB_BinaryOp_new.c +++ b/GraphBLAS/Source/GrB_BinaryOp_new.c @@ -7,17 +7,9 @@ //------------------------------------------------------------------------------ -// GrB_BinaryOp_new is implemented both as a macro and a function. Both are -// user-callable. The macro is used by default since it can capture the name -// of the binary function. - #include "GB.h" -// the macro version of this function must first be #undefined -#undef GrB_BinaryOp_new -#undef GrM_BinaryOp_new - -GrB_Info GRB (BinaryOp_new) +GrB_Info GrB_BinaryOp_new ( GrB_BinaryOp *binaryop, // handle for the new binary operator GxB_binary_function function, // pointer to the binary function diff --git a/GraphBLAS/Source/GrB_BinaryOp_set.c b/GraphBLAS/Source/GrB_BinaryOp_set.c new file mode 100644 index 0000000000..9a72236c4d --- /dev/null +++ b/GraphBLAS/Source/GrB_BinaryOp_set.c @@ -0,0 +1,85 @@ +//------------------------------------------------------------------------------ +// GrB_BinaryOp_set_*: set a field in a binary op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_set_Scalar +( + GrB_BinaryOp op, + GrB_Scalar value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_set_String +( + GrB_BinaryOp op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_BinaryOp_set_String (op, value, field)") ; + if (op != GxB_IGNORE_DUP) + { + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + ASSERT_BINARYOP_OK (op, "binaryop for set", GB0) ; + } + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_op_string_set ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_set_INT32 +( + GrB_BinaryOp op, + int32_t value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_BinaryOp_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_BinaryOp_set_VOID +( + GrB_BinaryOp op, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Descriptor_free.c b/GraphBLAS/Source/GrB_Descriptor_free.c index d39db520d0..acff7daefd 100644 --- a/GraphBLAS/Source/GrB_Descriptor_free.c +++ b/GraphBLAS/Source/GrB_Descriptor_free.c @@ -25,6 +25,8 @@ GrB_Info GrB_Descriptor_free // free a descriptor if (desc != NULL) { size_t header_size = desc->header_size ; + // free the Descriptor user_name + GB_FREE (&(desc->user_name), desc->user_name_size) ; if (header_size > 0) { GB_FREE (&(desc->logger), desc->logger_size) ; diff --git a/GraphBLAS/Source/GrB_Descriptor_get2.c b/GraphBLAS/Source/GrB_Descriptor_get2.c new file mode 100644 index 0000000000..8f9340af52 --- /dev/null +++ b/GraphBLAS/Source/GrB_Descriptor_get2.c @@ -0,0 +1,283 @@ +//------------------------------------------------------------------------------ +// GrB_Descriptor_get_*: get a field in a descriptor +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ + +static GrB_Info GB_desc_get +( + GrB_Descriptor desc, // descriptor to query; NULL is ok + int32_t *value, // return value of the descriptor + int field // parameter to query +) +{ + + //-------------------------------------------------------------------------- + // get the parameter + //-------------------------------------------------------------------------- + + switch (field) + { + case GrB_OUTP : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->out) ; + break ; + + case GrB_MASK : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->mask) ; + break ; + + case GrB_INP0 : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->in0) ; + break ; + + case GrB_INP1 : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->in1) ; + break ; + + case GxB_AxB_METHOD : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->axb) ; + break ; + + case GxB_SORT : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->do_sort); + break ; + + case GxB_COMPRESSION : + + (*value) = (int32_t) ((desc == NULL) ? + GrB_DEFAULT : desc->compression) ; + break ; + + case GxB_IMPORT : + + (*value) = (int32_t) ((desc == NULL) ? GrB_DEFAULT : desc->import) ; + if ((*value) != GrB_DEFAULT) (*value) = GxB_SECURE_IMPORT ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_get_Scalar +( + GrB_Descriptor desc, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Descriptor_get_Scalar (desc, value, field)") ; + GB_RETURN_IF_FAULTY (desc) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_DESCRIPTOR_OK_OR_NULL (desc, "desc for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int32_t i ; + GrB_Info info = GB_desc_get (desc, &i, field) ; + if (info == GrB_SUCCESS) + { + info = GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk) ; + } + return (info) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_get_String +//------------------------------------------------------------------------------ + +#define DNAME(d) \ +{ \ + if (desc == d) \ + { \ + strcpy (value, #d) ; \ + return (GrB_SUCCESS) ; \ + } \ +} + +GrB_Info GrB_Descriptor_get_String +( + GrB_Descriptor desc, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Descriptor_get_String (desc, value, field)") ; + GB_RETURN_IF_FAULTY (desc) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_DESCRIPTOR_OK_OR_NULL (desc, "desc for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the name + //-------------------------------------------------------------------------- + + DNAME (GrB_NULL ) ; + DNAME (GrB_DESC_T1 ) ; + DNAME (GrB_DESC_T0 ) ; + DNAME (GrB_DESC_T0T1 ) ; + + DNAME (GrB_DESC_C ) ; + DNAME (GrB_DESC_CT1 ) ; + DNAME (GrB_DESC_CT0 ) ; + DNAME (GrB_DESC_CT0T1 ) ; + + DNAME (GrB_DESC_S ) ; + DNAME (GrB_DESC_ST1 ) ; + DNAME (GrB_DESC_ST0 ) ; + DNAME (GrB_DESC_ST0T1 ) ; + + DNAME (GrB_DESC_SC ) ; + DNAME (GrB_DESC_SCT1 ) ; + DNAME (GrB_DESC_SCT0 ) ; + DNAME (GrB_DESC_SCT0T1 ) ; + + DNAME (GrB_DESC_R ) ; + DNAME (GrB_DESC_RT1 ) ; + DNAME (GrB_DESC_RT0 ) ; + DNAME (GrB_DESC_RT0T1 ) ; + + DNAME (GrB_DESC_RC ) ; + DNAME (GrB_DESC_RCT1 ) ; + DNAME (GrB_DESC_RCT0 ) ; + DNAME (GrB_DESC_RCT0T1 ) ; + + DNAME (GrB_DESC_RS ) ; + DNAME (GrB_DESC_RST1 ) ; + DNAME (GrB_DESC_RST0 ) ; + DNAME (GrB_DESC_RST0T1 ) ; + + DNAME (GrB_DESC_RSC ) ; + DNAME (GrB_DESC_RSCT1 ) ; + DNAME (GrB_DESC_RSCT0 ) ; + DNAME (GrB_DESC_RSCT0T1) ; + + // user-defined descriptor + (*value) = '\0' ; + + if (desc->user_name_size > 0) + { + // user-defined descriptor, with name defined by GrB_set + strcpy (value, desc->user_name) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_get_INT32 +( + GrB_Descriptor desc, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Descriptor_get_INT32 (desc, value, field)") ; + GB_RETURN_IF_FAULTY (desc) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_DESCRIPTOR_OK_OR_NULL (desc, "desc for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_desc_get (desc, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_get_SIZE +( + GrB_Descriptor desc, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Descriptor_get_SIZE (desc, value, field)") ; + GB_RETURN_IF_FAULTY (desc) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_DESCRIPTOR_OK_OR_NULL (desc, "desc for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + if (field != GrB_NAME) + { + return (GrB_INVALID_VALUE) ; + } + + if (desc != NULL && desc->user_name != NULL) + { + (*value) = desc->user_name_size ; + } + else + { + (*value) = GxB_MAX_NAME_LEN ; + } + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_get_VOID +( + GrB_Descriptor desc, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Descriptor_new.c b/GraphBLAS/Source/GrB_Descriptor_new.c index f607a35057..7c220179f7 100644 --- a/GraphBLAS/Source/GrB_Descriptor_new.c +++ b/GraphBLAS/Source/GrB_Descriptor_new.c @@ -42,6 +42,8 @@ GrB_Info GrB_Descriptor_new // create a new descriptor GrB_Descriptor desc = *descriptor ; desc->magic = GB_MAGIC ; desc->header_size = header_size ; + desc->user_name = NULL ; // user_name for GrB_get/GrB_set + desc->user_name_size = 0 ; desc->logger = NULL ; // error string desc->logger_size = 0 ; desc->out = GxB_DEFAULT ; // descriptor for output diff --git a/GraphBLAS/Source/GrB_Descriptor_set2.c b/GraphBLAS/Source/GrB_Descriptor_set2.c new file mode 100644 index 0000000000..0fa1a4b5f3 --- /dev/null +++ b/GraphBLAS/Source/GrB_Descriptor_set2.c @@ -0,0 +1,260 @@ +//------------------------------------------------------------------------------ +// GrB_Descriptor_set_*: set a field in a descriptor +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GB_desc_set +//------------------------------------------------------------------------------ + +static GrB_Info GB_desc_set +( + GrB_Descriptor desc, // descriptor to modify + int32_t value, // value to change it to + int field, // parameter to change + GB_Werk Werk +) +{ + + //-------------------------------------------------------------------------- + // set the parameter + //-------------------------------------------------------------------------- + + int mask = (int) desc->mask ; + + switch (field) + { + + case GrB_OUTP : // same as GrB_OUTP_FIELD + + if (! (value == GrB_DEFAULT || value == GrB_REPLACE)) + { + GB_ERROR (GrB_INVALID_VALUE, + "invalid descriptor value [%d] for GrB_OUTP field;\n" + "must be GrB_DEFAULT [%d] or GrB_REPLACE [%d]", + value, (int) GrB_DEFAULT, (int) GrB_REPLACE) ; + } + desc->out = (GrB_Desc_Value) value ; + break ; + + case GrB_MASK : // same as GrB_MASK_FIELD + + if (! (value == GrB_DEFAULT || + value == GrB_COMP || + value == GrB_STRUCTURE || + value == (GrB_COMP + GrB_STRUCTURE))) + { + GB_ERROR (GrB_INVALID_VALUE, + "invalid descriptor value [%d] for GrB_MASK field;\n" + "must be GrB_DEFAULT [%d], GrB_COMP [%d],\n" + "GrB_STRUCTURE [%d], or GrB_COMP+GrB_STRUCTURE [%d]", + value, (int) GrB_DEFAULT, (int) GrB_COMP, + (int) GrB_STRUCTURE, + (int) (GrB_COMP + GrB_STRUCTURE)) ; + } + 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 : // same as GrB_INP0_FIELD + + if (! (value == GrB_DEFAULT || value == GrB_TRAN)) + { + GB_ERROR (GrB_INVALID_VALUE, + "invalid descriptor value [%d] for GrB_INP0 field;\n" + "must be GrB_DEFAULT [%d] or GrB_TRAN [%d]", + value, (int) GrB_DEFAULT, (int) GrB_TRAN) ; + } + desc->in0 = (GrB_Desc_Value) value ; + break ; + + case GrB_INP1 : // same as GrB_INP1_FIELD + + if (! (value == GrB_DEFAULT || value == GrB_TRAN)) + { + GB_ERROR (GrB_INVALID_VALUE, + "invalid descriptor value [%d] for GrB_INP1 field;\n" + "must be GrB_DEFAULT [%d] or GrB_TRAN [%d]", + value, (int) GrB_DEFAULT, (int) GrB_TRAN) ; + } + desc->in1 = (GrB_Desc_Value) value ; + break ; + + case GxB_AxB_METHOD : + + if (! (value == GrB_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 [%d] for GrB_AxB_METHOD" + " field;\nmust be GrB_DEFAULT [%d], GxB_AxB_GUSTAVSON" + " [%d]\nGxB_AxB_DOT [%d]" + " GxB_AxB_HASH [%d] or GxB_AxB_SAXPY [%d]", + value, (int) GrB_DEFAULT, (int) GxB_AxB_GUSTAVSON, + (int) GxB_AxB_DOT, + (int) GxB_AxB_HASH, (int) GxB_AxB_SAXPY) ; + } + 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 == GrB_DEFAULT) ? GxB_FAST_IMPORT : GxB_SECURE_IMPORT ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_set_Scalar +( + GrB_Descriptor desc, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + if (desc == NULL || desc->header_size == 0) + { + // built-in descriptors may not be modified + return (GrB_INVALID_VALUE) ; + } + + GB_WHERE (desc, "GrB_Descriptor_set_Scalar (desc, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (desc) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_DESCRIPTOR_OK (desc, "desc to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + int32_t i ; + GrB_Info info = GrB_Scalar_extractElement_INT32 (&i, value) ; + if (info != GrB_SUCCESS) + { + return ((info == GrB_NO_VALUE) ? GrB_EMPTY_OBJECT : info) ; + } + return (GB_desc_set (desc, i, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_set_String +( + GrB_Descriptor desc, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + if (desc == NULL || desc->header_size == 0 || field != GrB_NAME) + { + // built-in descriptors may not be modified + return (GrB_INVALID_VALUE) ; + } + + GB_WHERE (desc, "GrB_Descriptor_set_String (desc, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (desc) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_DESCRIPTOR_OK (desc, "desc to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_user_name_set (&(desc->user_name), &(desc->user_name_size), + value, false)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_set_INT32 +( + GrB_Descriptor desc, + int32_t value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + if (desc == NULL || desc->header_size == 0) + { + // built-in descriptors may not be modified + return (GrB_INVALID_VALUE) ; + } + + GB_WHERE (desc, "GrB_Descriptor_set_INT32 (desc, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (desc) ; + ASSERT_DESCRIPTOR_OK (desc, "desc to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_desc_set (desc, value, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Descriptor_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Descriptor_set_VOID +( + GrB_Descriptor desc, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Global_get.c b/GraphBLAS/Source/GrB_Global_get.c new file mode 100644 index 0000000000..31850b9e39 --- /dev/null +++ b/GraphBLAS/Source/GrB_Global_get.c @@ -0,0 +1,537 @@ +//------------------------------------------------------------------------------ +// GrB_Global_get_*: get a global option +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" +#include "GB_jitifyer.h" + +//------------------------------------------------------------------------------ +// GrB_Global: an object defining the global state +//------------------------------------------------------------------------------ + +struct GB_Global_opaque GB_OPAQUE (WORLD_OBJECT) = +{ + GB_MAGIC, // magic: initialized + 0, // header_size: statically allocated +} ; + +const GrB_Global GrB_GLOBAL = & GB_OPAQUE (WORLD_OBJECT) ; + +//------------------------------------------------------------------------------ +// GB_global_enum_get: get an enum value from the global state +//------------------------------------------------------------------------------ + +static GrB_Info GB_global_enum_get (int32_t *value, int field) +{ + + switch (field) + { + + case GrB_LIBRARY_VER_MAJOR : + + (*value) = GxB_IMPLEMENTATION_MAJOR ; + break ; + + case GrB_LIBRARY_VER_MINOR : + + (*value) = GxB_IMPLEMENTATION_MINOR ; + break ; + + case GrB_LIBRARY_VER_PATCH : + + (*value) = GxB_IMPLEMENTATION_SUB ; + break ; + + case GrB_API_VER_MAJOR : + + (*value) = GxB_SPEC_MAJOR ; + break ; + + case GrB_API_VER_MINOR : + + (*value) = GxB_SPEC_MINOR ; + break ; + + case GrB_API_VER_PATCH : + + (*value) = GxB_SPEC_SUB ; + break ; + + case GrB_BLOCKING_MODE : + + // return just the GrB modes + (*value) = (int) GB_Global_mode_get ( ) ; + if ((*value) == GxB_NONBLOCKING_GPU) (*value) = GrB_NONBLOCKING ; + if ((*value) == GxB_BLOCKING_GPU) (*value) = GrB_BLOCKING ; + break ; + + case GxB_MODE : + + // return all 4 possible modes (GrB and GxB) + (*value) = (int) GB_Global_mode_get ( ) ; + break ; + + case GrB_STORAGE_ORIENTATION_HINT : + + (*value) = (int) (GB_Global_is_csc_get ( )) ? + GrB_COLMAJOR : GrB_ROWMAJOR ; + break ; + + case GxB_FORMAT : + + (*value) = (int) (GB_Global_is_csc_get ( )) ? + GxB_BY_COL : GxB_BY_ROW ; + break ; + + case GxB_GLOBAL_NTHREADS : // same as GxB_NTHREADS + + (*value) = (int) GB_Context_nthreads_max_get (NULL) ; + break ; + + case GxB_GLOBAL_GPU_ID : // same as GxB_GPU_ID + + (*value) = (int) GB_Context_gpu_id_get (NULL) ; + break ; + + case GxB_BURBLE : + + (*value) = (int) GB_Global_burble_get ( ) ; + break ; + + case GxB_LIBRARY_OPENMP : + + #ifdef _OPENMP + (*value) = (int) true ; + #else + (*value) = (int) false ; + #endif + break ; + + case GxB_PRINT_1BASED : + + (*value) = (int) GB_Global_print_one_based_get ( ) ; + break ; + + case GxB_JIT_C_CONTROL : + + (*value) = (int) GB_jitifyer_get_control ( ) ; + break ; + + case GxB_JIT_USE_CMAKE : + + (*value) = (int) GB_jitifyer_get_use_cmake ( ) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_get_Scalar +( + GrB_Global g, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_get_Scalar (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int32_t i ; + GrB_Info info = GB_global_enum_get (&i, field) ; + if (info == GrB_SUCCESS) + { + // field specifies an int: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk) ; + } + else + { + double x ; + int64_t i64 ; + switch ((int) field) + { + + case GxB_HYPER_SWITCH : + + x = (double) GB_Global_hyper_switch_get ( ) ; + info = GB_setElement ((GrB_Matrix) value, NULL, &x, 0, 0, + GB_FP64_code, Werk) ; + + break ; + + case GxB_GLOBAL_CHUNK : // same as GxB_CHUNK + + x = GB_Context_chunk_get (NULL) ; + info = GB_setElement ((GrB_Matrix) value, NULL, &x, 0, 0, + GB_FP64_code, Werk) ; + break ; + + case GxB_HYPER_HASH : + + i64 = GB_Global_hyper_hash_get ( ) ; + info = GB_setElement ((GrB_Matrix) value, NULL, &i64, 0, 0, + GB_INT64_code, Werk) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + } + + return (info) ; +} + +//------------------------------------------------------------------------------ +// GB_global_string_get: get a string from the global state +//------------------------------------------------------------------------------ + +static GrB_Info GB_global_string_get (const char **value, int field) +{ + + switch ((int) field) + { + + case GrB_NAME : + 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 ; + + //---------------------------------------------------------------------- + // JIT configuration: + //---------------------------------------------------------------------- + + case GxB_JIT_C_COMPILER_NAME : + + (*value) = GB_jitifyer_get_C_compiler ( ) ; + break ; + + case GxB_JIT_C_COMPILER_FLAGS : + + (*value) = GB_jitifyer_get_C_flags ( ) ; + break ; + + case GxB_JIT_C_LINKER_FLAGS : + + (*value) = GB_jitifyer_get_C_link_flags ( ) ; + break ; + + case GxB_JIT_C_LIBRARIES : + + (*value) = GB_jitifyer_get_C_libraries ( ) ; + break ; + + case GxB_JIT_C_CMAKE_LIBS : + + (*value) = GB_jitifyer_get_C_cmake_libs ( ) ; + break ; + + case GxB_JIT_C_PREFACE : + + (*value) = GB_jitifyer_get_C_preface ( ) ; + break ; + + case GxB_JIT_ERROR_LOG : + + (*value) = GB_jitifyer_get_error_log ( ) ; + break ; + + case GxB_JIT_CACHE_PATH : + + (*value) = GB_jitifyer_get_cache_path ( ) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_get_String +( + GrB_Global g, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_get_String (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL (value) ; + (*value) = '\0' ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + const char *s ; + GrB_Info info = GB_global_string_get (&s, field) ; + if (info == GrB_SUCCESS) + { + strcpy (value, s) ; + } + #pragma omp flush + return (info) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_get_INT32 +( + GrB_Global g, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_get_INT32 (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_global_enum_get (value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_get_SIZE +( + GrB_Global g, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_get_SIZE (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL (value) ; + (*value) = 0 ; + + //-------------------------------------------------------------------------- + // get the size of the field + //-------------------------------------------------------------------------- + + const char *s ; + GrB_Info info = GB_global_string_get (&s, field) ; + if (info == GrB_SUCCESS) + { + (*value) = strlen (s) + 1 ; + } + else + { + switch ((int) field) + { + + case GxB_BITMAP_SWITCH : + + (*value) = sizeof (double) * GxB_NBITMAP_SWITCH ; + break ; + + case GxB_COMPILER_VERSION : + + (*value) = sizeof (int32_t) * 3 ; + break ; + + case GxB_MALLOC_FUNCTION : + case GxB_CALLOC_FUNCTION : + case GxB_REALLOC_FUNCTION : + case GxB_FREE_FUNCTION : + + (*value) = sizeof (void *) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_get_VOID +( + GrB_Global g, + void * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_get_VOID (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + + case GxB_BITMAP_SWITCH : + + { + double *dvalue = (double *) value ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + dvalue [k] = (double) GB_Global_bitmap_switch_get (k) ; + } + } + break ; + + case GxB_COMPILER_VERSION : + + { + int32_t *ivalue = (int32_t *) value ; + ivalue [0] = GB_COMPILER_MAJOR ; + ivalue [1] = GB_COMPILER_MINOR ; + ivalue [2] = GB_COMPILER_SUB ; + } + break ; + + case GxB_MALLOC_FUNCTION : + { + void **func = (void **) value ; + (*func) = GB_Global_malloc_function_get ( ) ; + } + break ; + + case GxB_CALLOC_FUNCTION : + { + void **func = (void **) value ; + (*func) = GB_Global_calloc_function_get ( ) ; + } + break ; + + case GxB_REALLOC_FUNCTION : + { + void **func = (void **) value ; + (*func) = GB_Global_realloc_function_get ( ) ; + } + break ; + + case GxB_FREE_FUNCTION : + { + void **func = (void **) value ; + (*func) = GB_Global_free_function_get ( ) ; + } + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GrB_Global_set.c b/GraphBLAS/Source/GrB_Global_set.c new file mode 100644 index 0000000000..d8897cf680 --- /dev/null +++ b/GraphBLAS/Source/GrB_Global_set.c @@ -0,0 +1,320 @@ +//------------------------------------------------------------------------------ +// GrB_Global_set_*: set a global option +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" +#include "GB_jitifyer.h" + +//------------------------------------------------------------------------------ +// GB_global_enum_set: get an enum value from the global state +//------------------------------------------------------------------------------ + +static GrB_Info GB_global_enum_set (int32_t value, int field) +{ + + switch (field) + { + + case GrB_STORAGE_ORIENTATION_HINT : + + switch (value) + { + case GrB_ROWMAJOR : value = GxB_BY_ROW ; break ; + case GrB_COLMAJOR : value = GxB_BY_COL ; break ; + case GrB_BOTH : value = GxB_BY_ROW ; break ; + case GrB_UNKNOWN : value = GxB_BY_ROW ; break ; + default : return (GrB_INVALID_VALUE) ; + } + // fall through to the GxB_FORMAT case + + 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 + + GB_Context_nthreads_max_set (NULL, value) ; + break ; + + case GxB_GLOBAL_GPU_ID : // same as GxB_GPU_ID + + GB_Context_gpu_id_set (NULL, 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_JIT_USE_CMAKE : + + GB_jitifyer_set_use_cmake ((bool) value) ; + break ; + + case GxB_JIT_C_CONTROL : + + GB_jitifyer_set_control (value) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_set_Scalar +( + GrB_Global g, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_set_Scalar (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + double dvalue = 0 ; + int32_t ivalue = 0 ; + int64_t i64value = 0 ; + GrB_Info info ; + + switch ((int) field) + { + + case GxB_HYPER_SWITCH : + + info = GrB_Scalar_extractElement_FP64 (&dvalue, value) ; + if (info == GrB_SUCCESS) + { + GB_Global_hyper_switch_set ((float) dvalue) ; + } + break ; + + case GxB_GLOBAL_CHUNK : // same as GxB_CHUNK + + info = GrB_Scalar_extractElement_FP64 (&dvalue, value) ; + if (info == GrB_SUCCESS) + { + GB_Context_chunk_set (NULL, dvalue) ; + } + break ; + + case GxB_HYPER_HASH : + + info = GrB_Scalar_extractElement_INT64 (&i64value, value) ; + if (info == GrB_SUCCESS) + { + GB_Global_hyper_hash_set (i64value) ; + } + break ; + + default : + + info = GrB_Scalar_extractElement_INT32 (&ivalue, value) ; + if (info == GrB_SUCCESS) + { + info = GB_global_enum_set (ivalue, field) ; + } + break ; + } + + return ((info == GrB_NO_VALUE) ? GrB_EMPTY_OBJECT : info) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_set_String +( + GrB_Global g, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_set_String (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + + case GxB_JIT_C_COMPILER_NAME : + + return (GB_jitifyer_set_C_compiler (value)) ; + + case GxB_JIT_C_COMPILER_FLAGS : + + return (GB_jitifyer_set_C_flags (value)) ; + + case GxB_JIT_C_LINKER_FLAGS : + + return (GB_jitifyer_set_C_link_flags (value)) ; + + case GxB_JIT_C_LIBRARIES : + + return (GB_jitifyer_set_C_libraries (value)) ; + + case GxB_JIT_C_CMAKE_LIBS : + + return (GB_jitifyer_set_C_cmake_libs (value)) ; + + case GxB_JIT_C_PREFACE : + + return (GB_jitifyer_set_C_preface (value)) ; + + case GxB_JIT_ERROR_LOG : + + return (GB_jitifyer_set_error_log (value)) ; + + case GxB_JIT_CACHE_PATH : + + return (GB_jitifyer_set_cache_path (value)) ; + + default : + + return (GrB_INVALID_VALUE) ; + } +} + +//------------------------------------------------------------------------------ +// GrB_Global_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_set_INT32 +( + GrB_Global g, + int32_t value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_set_INT32 (g, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_global_enum_set (value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Global_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Global_set_VOID +( + GrB_Global g, + void * value, + GrB_Field field, + size_t size +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Global_set_VOID (g, value, field, size)") ; + GB_RETURN_IF_NULL_OR_FAULTY (g) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + + case GxB_BITMAP_SWITCH : + + if (value == NULL) + { + // set all switches to their default + GB_Global_bitmap_switch_default ( ) ; + } + else + { + if (size < sizeof (double) * GxB_NBITMAP_SWITCH) + { + return (GrB_INVALID_VALUE) ; + } + double *dvalue = (double *) value ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + float b = (float) dvalue [k] ; + GB_Global_bitmap_switch_set (k, b) ; + } + } + break ; + + case GxB_PRINTF : + + if (size != sizeof (GB_printf_function_t)) + { + return (GrB_INVALID_VALUE) ; + } + GB_Global_printf_set ((GB_printf_function_t) value) ; + break ; + + case GxB_FLUSH : + + if (size != sizeof (GB_flush_function_t)) + { + return (GrB_INVALID_VALUE) ; + } + GB_Global_flush_set ((GB_flush_function_t) value) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GrB_IndexUnaryOp_get.c b/GraphBLAS/Source/GrB_IndexUnaryOp_get.c new file mode 100644 index 0000000000..d1708eaccc --- /dev/null +++ b/GraphBLAS/Source/GrB_IndexUnaryOp_get.c @@ -0,0 +1,137 @@ +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_get_*: get a field in a idxunop +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_get_Scalar +( + GrB_IndexUnaryOp op, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_IndexUnaryOp_get_Scalar (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_INDEXUNARYOP_OK (op, "idxunop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_scalar_get ((GB_Operator) op, value, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_get_String +( + GrB_IndexUnaryOp op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_IndexUnaryOp_get_String (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_INDEXUNARYOP_OK (op, "idxunop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_string_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_get_INT32 +( + GrB_IndexUnaryOp op, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_IndexUnaryOp_get_INT32 (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_INDEXUNARYOP_OK (op, "idxunop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_enum_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_get_SIZE +( + GrB_IndexUnaryOp op, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_IndexUnaryOp_get_SIZE (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_INDEXUNARYOP_OK (op, "idxunop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_size_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_get_VOID +( + GrB_IndexUnaryOp op, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_IndexUnaryOp_new.c b/GraphBLAS/Source/GrB_IndexUnaryOp_new.c index 5f35cddac0..04409be64c 100644 --- a/GraphBLAS/Source/GrB_IndexUnaryOp_new.c +++ b/GraphBLAS/Source/GrB_IndexUnaryOp_new.c @@ -7,17 +7,9 @@ //------------------------------------------------------------------------------ -// GrB_IndexUnaryOp_new is implemented both as a macro and a function. Both are -// user-callable. The macro is used by default since it can capture the name -// of the index_unary function. - #include "GB.h" -// the macro version of this function must first be #undefined -#undef GrB_IndexUnaryOp_new -#undef GrM_IndexUnaryOp_new - -GrB_Info GRB (IndexUnaryOp_new) // create a new user-defined IndexUnary op +GrB_Info GrB_IndexUnaryOp_new // create a new user-defined IndexUnary op ( GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator GxB_index_unary_function function, // pointer to IndexUnary function diff --git a/GraphBLAS/Source/GrB_IndexUnaryOp_set.c b/GraphBLAS/Source/GrB_IndexUnaryOp_set.c new file mode 100644 index 0000000000..7a4ed5824a --- /dev/null +++ b/GraphBLAS/Source/GrB_IndexUnaryOp_set.c @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_set_*: set a field in a unary op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_set_Scalar +( + GrB_IndexUnaryOp op, + GrB_Scalar value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_set_String +( + GrB_IndexUnaryOp op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_IndexUnaryOp_set_String (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_INDEXUNARYOP_OK (op, "idxunop for set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_op_string_set ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_set_INT32 +( + GrB_IndexUnaryOp op, + int32_t value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_IndexUnaryOp_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_IndexUnaryOp_set_VOID +( + GrB_IndexUnaryOp op, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Matrix_get.c b/GraphBLAS/Source/GrB_Matrix_get.c new file mode 100644 index 0000000000..d2b12ed58b --- /dev/null +++ b/GraphBLAS/Source/GrB_Matrix_get.c @@ -0,0 +1,166 @@ +//------------------------------------------------------------------------------ +// GrB_Matrix_get_*: get a field in a matrix +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Matrix_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_get_Scalar +( + GrB_Matrix A, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_get_Scalar (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_MATRIX_OK (A, "A to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int32_t i ; + GrB_Info info = GB_matvec_enum_get (A, &i, field) ; + if (info == GrB_SUCCESS) + { + // field specifies an int: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk) ; + } + else + { + double x ; + switch ((int) field) + { + case GxB_HYPER_SWITCH : + x = (double) (A->hyper_switch) ; + break ; + + case GxB_BITMAP_SWITCH : + x = (double) (A->bitmap_switch) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + // field specifies a double: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &x, 0, 0, + GB_FP64_code, Werk) ; + } + + return (info) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_get_String +( + GrB_Matrix A, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_get_String (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MATRIX_OK (A, "A to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_get (A, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_get_INT32 +( + GrB_Matrix A, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_get_INT32 (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MATRIX_OK (A, "A to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_enum_get (A, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_get_SIZE +( + GrB_Matrix A, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_get_SIZE (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MATRIX_OK (A, "A to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_size_get (A, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_get_VOID +( + GrB_Matrix A, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Matrix_reduce.c b/GraphBLAS/Source/GrB_Matrix_reduce.c index 393c0b747b..e849171cf9 100644 --- a/GraphBLAS/Source/GrB_Matrix_reduce.c +++ b/GraphBLAS/Source/GrB_Matrix_reduce.c @@ -37,7 +37,7 @@ GrB_Info GB_EVAL3 (prefix, _Matrix_reduce_, T) /* c = accum (c, reduce (A)) */ \ GB_BURBLE_START ("GrB_reduce") ; \ GB_RETURN_IF_NULL_OR_FAULTY (A) ; \ GrB_Info info = GB_reduce_to_scalar (c, GB_EVAL3 (prefix, _, T), accum, \ - monoid, A, Werk) ; \ + monoid, A, Werk) ; \ GB_BURBLE_END ; \ return (info) ; \ } @@ -148,7 +148,7 @@ GrB_Info GrB_Matrix_reduce_Monoid_Scalar const GrB_Descriptor desc ) { - GB_WHERE (S, "GrB_Matrix_reduce_Monoid_Scalar (s, accum, monoid, A, desc)") ; + GB_WHERE (S, "GrB_Matrix_reduce_Monoid_Scalar (s, accum, monoid, A, desc)"); GB_BURBLE_START ("GrB_reduce") ; GrB_Info info = GB_Scalar_reduce (S, accum, monoid, A, Werk) ; GB_BURBLE_END ; diff --git a/GraphBLAS/Source/GrB_Matrix_removeElement.c b/GraphBLAS/Source/GrB_Matrix_removeElement.c index 69b6a3cabb..722f6bd790 100644 --- a/GraphBLAS/Source/GrB_Matrix_removeElement.c +++ b/GraphBLAS/Source/GrB_Matrix_removeElement.c @@ -76,21 +76,14 @@ static inline bool GB_removeElement // return true if found // C is hypersparse: look for j in hyperlist C->h [0 ... C->nvec-1] //------------------------------------------------------------------ - int64_t k ; - if (C->Y == NULL) - { - // C is sparse but does not yet have a hyper_hash - k = 0 ; - found = GB_lookup (true, Ch, Cp, C->vlen, &k, - C->nvec-1, j, &pC_start, &pC_end) ; - } - else - { - // C is sparse, with a hyper_hash that is already built - k = GB_hyper_hash_lookup (Cp, C->Y->p, C->Y->i, C->Y->x, - C->Y->vdim-1, j, &pC_start, &pC_end) ; - found = (k >= 0) ; - } + const int64_t *restrict C_Yp = (C->Y == NULL) ? NULL : C->Y->p ; + const int64_t *restrict C_Yi = (C->Y == NULL) ? NULL : C->Y->i ; + const int64_t *restrict C_Yx = (C->Y == NULL) ? NULL : C->Y->x ; + const int64_t C_hash_bits = (C->Y == NULL) ? 0 : (C->Y->vdim - 1) ; + const int64_t cnvec = C->nvec ; + int64_t k = GB_hyper_hash_lookup (Ch, cnvec, Cp, C_Yp, C_Yi, C_Yx, + C_hash_bits, j, &pC_start, &pC_end) ; + found = (k >= 0) ; if (!found) { // vector j is empty diff --git a/GraphBLAS/Source/GrB_Matrix_set.c b/GraphBLAS/Source/GrB_Matrix_set.c new file mode 100644 index 0000000000..365907e651 --- /dev/null +++ b/GraphBLAS/Source/GrB_Matrix_set.c @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// GrB_Matrix_set_*: set a field in a matrix +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Matrix_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_set_Scalar +( + GrB_Matrix A, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_set_Scalar (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + ASSERT_MATRIX_OK (A, "A to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + double dvalue = 0 ; + int32_t ivalue = 0 ; + GrB_Info info ; + + switch ((int) field) + { + + case GxB_HYPER_SWITCH : + case GxB_BITMAP_SWITCH : + + info = GrB_Scalar_extractElement_FP64 (&dvalue, value) ; + break ; + + default : + + info = GrB_Scalar_extractElement_INT32 (&ivalue, value) ; + break ; + } + + if (info != GrB_SUCCESS) + { + return ((info == GrB_NO_VALUE) ? GrB_EMPTY_OBJECT : info) ; + } + + return (GB_matvec_set (A, false, ivalue, dvalue, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_set_String +( + GrB_Matrix A, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_set_String (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MATRIX_OK (A, "A to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_set (A, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_set_INT32 +( + GrB_Matrix A, + int32_t value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Matrix_set_INT32 (A, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (A) ; + ASSERT_MATRIX_OK (A, "A to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_matvec_set (A, false, value, 0, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Matrix_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Matrix_set_VOID +( + GrB_Matrix A, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Matrix_wait.c b/GraphBLAS/Source/GrB_Matrix_wait.c index 338a65ea02..602f7783b0 100644 --- a/GraphBLAS/Source/GrB_Matrix_wait.c +++ b/GraphBLAS/Source/GrB_Matrix_wait.c @@ -32,7 +32,7 @@ GrB_Info GrB_Matrix_wait // finish all work on a matrix //-------------------------------------------------------------------------- if (waitmode != GrB_COMPLETE && - (GB_ANY_PENDING_WORK (A) || GB_NEED_HYPER_HASH (A))) + (GB_ANY_PENDING_WORK (A) || GB_hyper_hash_need (A))) { GrB_Info info ; GB_BURBLE_START ("GrB_Matrix_wait") ; diff --git a/GraphBLAS/Source/GrB_Monoid_free.c b/GraphBLAS/Source/GrB_Monoid_free.c index 99934a68c4..45a36f4adc 100644 --- a/GraphBLAS/Source/GrB_Monoid_free.c +++ b/GraphBLAS/Source/GrB_Monoid_free.c @@ -22,6 +22,8 @@ GrB_Info GrB_Monoid_free // free a user-created monoid if (mon != NULL) { size_t header_size = mon->header_size ; + // free the monoid user_name + GB_FREE (&(mon->user_name), mon->user_name_size) ; if (header_size > 0) { mon->magic = GB_FREED ; // to help detect dangling pointers diff --git a/GraphBLAS/Source/GrB_Monoid_get.c b/GraphBLAS/Source/GrB_Monoid_get.c new file mode 100644 index 0000000000..823ff5aab8 --- /dev/null +++ b/GraphBLAS/Source/GrB_Monoid_get.c @@ -0,0 +1,214 @@ +//------------------------------------------------------------------------------ +// GrB_Monoid_get_*: get a field in a monoid +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Monoid_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_get_Scalar +( + GrB_Monoid monoid, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Monoid_get_Scalar (monoid, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (monoid) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_MONOID_OK (monoid, "monoid to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_monoid_get (monoid, value, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_get_String +( + GrB_Monoid monoid, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Monoid_get_String (monoid, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (monoid) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MONOID_OK (monoid, "monoid to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + (*value) = '\0' ; + const char *name ; + + switch ((int) field) + { + case GrB_NAME : + + // get the name of the monoid + name = GB_monoid_name_get (monoid) ; + if (name != NULL) + { + strcpy (value, name) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; + + case GrB_INP0_TYPE_STRING : + case GrB_INP1_TYPE_STRING : + case GrB_OUTP_TYPE_STRING : + return (GB_op_string_get ((GB_Operator) (monoid->op), + value, field)) ; + + default : ; + return (GrB_INVALID_VALUE) ; + } +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_get_INT32 +( + GrB_Monoid monoid, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Monoid_get_INT32 (monoid, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (monoid) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MONOID_OK (monoid, "monoid to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_enum_get ((GB_Operator) (monoid->op), value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_get_SIZE +( + GrB_Monoid monoid, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Monoid_get_SIZE (monoid, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (monoid) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MONOID_OK (monoid, "monoid to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + const char *name ; + + switch ((int) field) + { + + case GrB_NAME : + + // get the length of the monoid user_name, or built-in name + name = GB_monoid_name_get (monoid) ; + break ; + + case GrB_INP0_TYPE_STRING : + case GrB_INP1_TYPE_STRING : + case GrB_OUTP_TYPE_STRING : + name = GB_type_name_get (monoid->op->ztype) ; + break ; + + case GxB_MONOID_OPERATOR : + (*value) = sizeof (GrB_BinaryOp) ; + return (GrB_SUCCESS) ; + + default : + return (GrB_INVALID_VALUE) ; + } + + (*value) = (name == NULL) ? 1 : (strlen (name) + 1) ; + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_get_VOID +( + GrB_Monoid monoid, + void * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Monoid_get_VOID (monoid, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (monoid) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MONOID_OK (monoid, "monoid to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + + case GxB_MONOID_OPERATOR : + memcpy (value, &(monoid->op), sizeof (GrB_BinaryOp)) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GrB_Monoid_set.c b/GraphBLAS/Source/GrB_Monoid_set.c new file mode 100644 index 0000000000..fc1fcc7958 --- /dev/null +++ b/GraphBLAS/Source/GrB_Monoid_set.c @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// GrB_Monoid_set_*: set a field in a monoid +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Monoid_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_set_Scalar +( + GrB_Monoid monoid, + GrB_Scalar value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_set_String +( + GrB_Monoid monoid, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Monoid_set_String (monoid, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (monoid) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_MONOID_OK (monoid, "monoid to get option", GB0) ; + + if (monoid->header_size == 0 || field != GrB_NAME) + { + // built-in monoids may not be modified + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_user_name_set (&(monoid->user_name), + &(monoid->user_name_size), value, true)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_set_INT32 +( + GrB_Monoid monoid, + int32_t value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Monoid_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Monoid_set_VOID +( + GrB_Monoid monoid, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Scalar_get.c b/GraphBLAS/Source/GrB_Scalar_get.c new file mode 100644 index 0000000000..0e88c2ffbe --- /dev/null +++ b/GraphBLAS/Source/GrB_Scalar_get.c @@ -0,0 +1,145 @@ +//------------------------------------------------------------------------------ +// GrB_Scalar_get_*: get a field in a scalar +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Scalar_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_Scalar +( + GrB_Scalar s, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Scalar_get_Scalar (s, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (s) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_SCALAR_OK (s, "s to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int32_t i ; + GrB_Info info = GB_matvec_enum_get ((GrB_Matrix) s, &i, field) ; + if (info == GrB_SUCCESS) + { + // field specifies an int32_t: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk) ; + } + return (info) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_String +( + GrB_Scalar s, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Scalar_get_String (s, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (s) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SCALAR_OK (s, "s to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_get ((GrB_Matrix) s, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_INT32 +( + GrB_Scalar s, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Scalar_get_INT32 (s, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (s) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SCALAR_OK (s, "s to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_enum_get ((GrB_Matrix) s, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_SIZE +( + GrB_Scalar s, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Scalar_get_SIZE (s, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (s) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SCALAR_OK (s, "s to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_size_get ((GrB_Matrix) s, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_get_VOID +( + GrB_Scalar s, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Scalar_set.c b/GraphBLAS/Source/GrB_Scalar_set.c new file mode 100644 index 0000000000..ff7f002084 --- /dev/null +++ b/GraphBLAS/Source/GrB_Scalar_set.c @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// GrB_Scalar_set_*: set a field in a scalar +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Scalar_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_set_Scalar +( + GrB_Scalar s, + GrB_Scalar value, + GrB_Field field +) +{ + // all settings are ignored + return ((field == GrB_STORAGE_ORIENTATION_HINT) ? + GrB_SUCCESS : GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_set_String +( + GrB_Scalar s, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Scalar_set_String (s, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (s) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SCALAR_OK (s, "s to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_set ((GrB_Matrix) s, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_set_INT32 +( + GrB_Scalar s, + int32_t value, + GrB_Field field +) +{ + // all settings are ignored + return ((field == GrB_STORAGE_ORIENTATION_HINT) ? + GrB_SUCCESS : GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Scalar_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Scalar_set_VOID +( + GrB_Scalar s, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Scalar_setElement.c b/GraphBLAS/Source/GrB_Scalar_setElement.c index 59ad11bf3b..4d770d1df2 100644 --- a/GraphBLAS/Source/GrB_Scalar_setElement.c +++ b/GraphBLAS/Source/GrB_Scalar_setElement.c @@ -76,3 +76,4 @@ GrB_Info GxB_Scalar_setElement_UINT64 (GrB_Scalar s, uint64_t x) { return (GrB_S GrB_Info GxB_Scalar_setElement_FP32 (GrB_Scalar s, float x) { return (GrB_Scalar_setElement_FP32 (s,x)) ; } GrB_Info GxB_Scalar_setElement_FP64 (GrB_Scalar s, double x) { return (GrB_Scalar_setElement_FP64 (s,x)) ; } GrB_Info GxB_Scalar_setElement_UDT (GrB_Scalar s, void *x) { return (GrB_Scalar_setElement_UDT (s,x)) ; } + diff --git a/GraphBLAS/Source/GrB_Semiring_free.c b/GraphBLAS/Source/GrB_Semiring_free.c index c5f323a81e..2fcbedeb3c 100644 --- a/GraphBLAS/Source/GrB_Semiring_free.c +++ b/GraphBLAS/Source/GrB_Semiring_free.c @@ -23,6 +23,8 @@ GrB_Info GrB_Semiring_free // free a user-created semiring { // free the semiring name GB_FREE (&(s->name), s->name_size) ; + // free the semiring user_name + GB_FREE (&(s->user_name), s->user_name_size) ; // free the semiring header size_t header_size = s->header_size ; if (header_size > 0) diff --git a/GraphBLAS/Source/GrB_Semiring_get.c b/GraphBLAS/Source/GrB_Semiring_get.c new file mode 100644 index 0000000000..257137b2a0 --- /dev/null +++ b/GraphBLAS/Source/GrB_Semiring_get.c @@ -0,0 +1,241 @@ +//------------------------------------------------------------------------------ +// GrB_Semiring_get_*: get a field in a semiring +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Semiring_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_get_Scalar +( + GrB_Semiring semiring, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Semiring_get_Scalar (semiring, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (semiring) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_SEMIRING_OK (semiring, "semiring to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + case GxB_MONOID_IDENTITY : + case GxB_MONOID_TERMINAL : + return (GB_monoid_get (semiring->add, value, field, Werk)) ; + default : + return (GB_op_scalar_get ((GB_Operator) (semiring->multiply), + value, field, Werk)) ; + } +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_get_String +( + GrB_Semiring semiring, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Semiring_get_String (semiring, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (semiring) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SEMIRING_OK (semiring, "semiring to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + (*value) = '\0' ; + const char *name ; + + switch ((int) field) + { + case GrB_NAME : + + name = GB_semiring_name_get (semiring) ; + if (name != NULL) + { + // get the name of the semiring + strcpy (value, name) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; + + case GrB_INP0_TYPE_STRING : + case GrB_INP1_TYPE_STRING : + case GrB_OUTP_TYPE_STRING : + return (GB_op_string_get ((GB_Operator) (semiring->multiply), + value, field)) ; + + default : ; + return (GrB_INVALID_VALUE) ; + } +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_get_INT32 +( + GrB_Semiring semiring, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Semiring_get_INT32 (semiring, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (semiring) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SEMIRING_OK (semiring, "semiring to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_enum_get ((GB_Operator) (semiring->multiply), value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_get_SIZE +( + GrB_Semiring semiring, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Semiring_get_SIZE (semiring, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (semiring) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SEMIRING_OK (semiring, "semiring to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + const char *name ; + + switch ((int) field) + { + + case GrB_NAME : + + // get the length of the semiring user_name, or built-in name + name = GB_semiring_name_get (semiring) ; + break ; + + case GrB_INP0_TYPE_STRING : + name = GB_type_name_get (semiring->multiply->xtype) ; + break ; + + case GrB_INP1_TYPE_STRING : + name = GB_type_name_get (semiring->multiply->ytype) ; + break ; + + case GrB_OUTP_TYPE_STRING : + name = GB_type_name_get (semiring->multiply->ztype) ; + break ; + + case GxB_MONOID_OPERATOR : + case GxB_SEMIRING_MULTIPLY : + (*value) = sizeof (GrB_BinaryOp) ; + return (GrB_SUCCESS) ; + + case GxB_SEMIRING_MONOID : + (*value) = sizeof (GrB_Monoid) ; + return (GrB_SUCCESS) ; + + default : + return (GrB_INVALID_VALUE) ; + } + + (*value) = (name == NULL) ? 1 : (strlen (name) + 1) ; + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_get_VOID +( + GrB_Semiring semiring, + void * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Semiring_get_VOID (semiring, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (semiring) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SEMIRING_OK (semiring, "semiring to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + + case GxB_MONOID_OPERATOR : + memcpy (value, &(semiring->add->op), sizeof (GrB_BinaryOp)) ; + break ; + + case GxB_SEMIRING_MONOID : + memcpy (value, &(semiring->add), sizeof (GrB_Monoid)) ; + break ; + + case GxB_SEMIRING_MULTIPLY : + memcpy (value, &(semiring->multiply), sizeof (GrB_BinaryOp)) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + diff --git a/GraphBLAS/Source/GrB_Semiring_set.c b/GraphBLAS/Source/GrB_Semiring_set.c new file mode 100644 index 0000000000..e398567ea7 --- /dev/null +++ b/GraphBLAS/Source/GrB_Semiring_set.c @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// GrB_Semiring_set_*: set a field in a semiring +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Semiring_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_set_Scalar +( + GrB_Semiring semiring, + GrB_Scalar value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_set_String +( + GrB_Semiring semiring, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Semiring_set_String (semiring, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (semiring) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_SEMIRING_OK (semiring, "semiring to get option", GB0) ; + + if (semiring->header_size == 0 || field != GrB_NAME) + { + // built-in semirings may not be modified + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_user_name_set (&(semiring->user_name), + &(semiring->user_name_size), value, true)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_set_INT32 +( + GrB_Semiring semiring, + int32_t value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Semiring_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Semiring_set_VOID +( + GrB_Semiring semiring, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Type_free.c b/GraphBLAS/Source/GrB_Type_free.c index 91815a0ab4..b12b9c3603 100644 --- a/GraphBLAS/Source/GrB_Type_free.c +++ b/GraphBLAS/Source/GrB_Type_free.c @@ -21,14 +21,15 @@ GrB_Info GrB_Type_free // free a user-defined type GrB_Type t = *type ; if (t != NULL) { + GB_FREE (&(t->user_name), t->user_name_size) ; + size_t defn_size = t->defn_size ; + if (defn_size > 0) + { + GB_FREE (&(t->defn), defn_size) ; + } size_t header_size = t->header_size ; if (header_size > 0) { - size_t defn_size = t->defn_size ; - if (defn_size > 0) - { - GB_FREE (&(t->defn), defn_size) ; - } t->magic = GB_FREED ; // to help detect dangling pointers t->header_size = 0 ; GB_FREE (type, header_size) ; diff --git a/GraphBLAS/Source/GrB_Type_get.c b/GraphBLAS/Source/GrB_Type_get.c new file mode 100644 index 0000000000..1b2bad06e7 --- /dev/null +++ b/GraphBLAS/Source/GrB_Type_get.c @@ -0,0 +1,235 @@ +//------------------------------------------------------------------------------ +// GrB_Type_get_*: get a field in a type +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Type_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_get_Scalar +( + GrB_Type type, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Type_get_Scalar (type, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (type) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_TYPE_OK (type, "type for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int32_t i ; + uint64_t u ; + + switch ((int) field) + { + case GrB_EL_TYPE_CODE : + i = (int32_t) GB_type_code_get (type->code) ; + return (GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk)) ; + break ; + + case GrB_SIZE : + u = (uint64_t) type->size ; + return (GB_setElement ((GrB_Matrix) value, NULL, &u, 0, 0, + GB_UINT64_code, Werk)) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } +} + +//------------------------------------------------------------------------------ +// GrB_Type_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_get_String +( + GrB_Type type, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Type_get_String (type, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (type) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_TYPE_OK (type, "type for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + (*value) = '\0' ; + const char *name ; + + switch ((int) field) + { + case GrB_NAME : + case GrB_EL_TYPE_STRING : + + name = GB_type_name_get (type) ; + if (name != NULL) + { + strcpy (value, name) ; + } + #pragma omp flush + return (GrB_SUCCESS) ; + + case GxB_JIT_C_NAME : + + strcpy (value, type->name) ; + break ; + + case GxB_JIT_C_DEFINITION : + + if (type->defn != NULL) + { + strcpy (value, type->defn) ; + } + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Type_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_get_INT32 +( + GrB_Type type, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Type_get_INT32 (type, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (type) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_TYPE_OK (type, "type for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch ((int) field) + { + + case GrB_EL_TYPE_CODE : + + (*value) = (int32_t) GB_type_code_get (type->code) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Type_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_get_SIZE +( + GrB_Type type, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Type_get_SIZE (type, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (type) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_TYPE_OK (type, "type for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + const char *s = NULL ; + + switch ((int) field) + { + + case GrB_SIZE : + (*value) = type->size ; + #pragma omp flush + return (GrB_SUCCESS) ; + + case GrB_NAME : + case GrB_EL_TYPE_STRING : + + s = GB_type_name_get (type) ; + break ; + + case GxB_JIT_C_NAME : + + s = type->name ; + break ; + + case GxB_JIT_C_DEFINITION : + + s = type->defn ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + (*value) = (s == NULL) ? 1 : (strlen (s) + 1) ; + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GrB_Type_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_get_VOID +( + GrB_Type type, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Type_new.c b/GraphBLAS/Source/GrB_Type_new.c index 0debf8f594..dcb7f242d0 100644 --- a/GraphBLAS/Source/GrB_Type_new.c +++ b/GraphBLAS/Source/GrB_Type_new.c @@ -7,26 +7,9 @@ //------------------------------------------------------------------------------ -// GrB_Type_new is implemented both as a macro and a function. Both are -// user-callable. The default is to use the macro, since this allows the name -// of the type to be saved as a string, for subsequent error reporting by -// GrB_error and for the return value of GxB_Matrix_type_name. It is also -// provided as a function so that applications that require a function instead -// of macro can access it. User code can simply do #undef GrB_Type_new before -// using the function. This approach also places the function GrB_Type_new in -// the linkable SuiteSparse:GraphBLAS library so that it is visible for linking -// with applications in languages other than ANSI C. The function version does -// not allow the name of the ctype to be saved in the new GraphBLAS type, -// however. It is given a generic name, "user_type_of_size_%d" where "%d" is -// the size of the type. - #include "GB.h" -// the macro version of this function must first be #undefined -#undef GrB_Type_new -#undef GrM_Type_new - -GrB_Info GRB (Type_new) // create a new GraphBLAS type +GrB_Info GrB_Type_new // create a new GraphBLAS type ( GrB_Type *type, // handle of user type to create size_t sizeof_ctype // size = sizeof (ctype) of the C type diff --git a/GraphBLAS/Source/GrB_Type_set.c b/GraphBLAS/Source/GrB_Type_set.c new file mode 100644 index 0000000000..3fa6b4b95f --- /dev/null +++ b/GraphBLAS/Source/GrB_Type_set.c @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// GrB_Type_set_*: set a field in a type +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Type_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_set_Scalar +( + GrB_Type type, + GrB_Scalar value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Type_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_set_String +( + GrB_Type type, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Type_set_String (type, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (type) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_TYPE_OK (type, "unaryop for get", GB0) ; + + //-------------------------------------------------------------------------- + // set the name or defn of a user-defined type + //-------------------------------------------------------------------------- + + bool user_defined = (type->code == GB_UDT_code) ; + + return (GB_op_or_type_string_set (user_defined, true, value, field, + &(type->user_name), &(type->user_name_size), + type->name, &(type->name_len), &(type->defn), &(type->defn_size), + &(type->hash))) ; +} + +//------------------------------------------------------------------------------ +// GrB_Type_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_set_INT32 +( + GrB_Type type, + int32_t value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_Type_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Type_set_VOID +( + GrB_Type type, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_UnaryOp_get.c b/GraphBLAS/Source/GrB_UnaryOp_get.c new file mode 100644 index 0000000000..1a88de4c5b --- /dev/null +++ b/GraphBLAS/Source/GrB_UnaryOp_get.c @@ -0,0 +1,137 @@ +//------------------------------------------------------------------------------ +// GrB_UnaryOp_get_*: get a field in a unary op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_get_Scalar +( + GrB_UnaryOp op, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_UnaryOp_get_Scalar (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_UNARYOP_OK (op, "unaryop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_scalar_get ((GB_Operator) op, value, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_get_String +( + GrB_UnaryOp op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_UnaryOp_get_String (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_UNARYOP_OK (op, "unaryop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_string_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_get_INT32 +( + GrB_UnaryOp op, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_UnaryOp_get_INT32 (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_UNARYOP_OK (op, "unaryop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_enum_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_get_SIZE +( + GrB_UnaryOp op, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_UnaryOp_get_SIZE (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_UNARYOP_OK (op, "unaryop for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_op_size_get ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_get_VOID +( + GrB_UnaryOp op, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_UnaryOp_new.c b/GraphBLAS/Source/GrB_UnaryOp_new.c index f21dc59c9d..bf4c77860c 100644 --- a/GraphBLAS/Source/GrB_UnaryOp_new.c +++ b/GraphBLAS/Source/GrB_UnaryOp_new.c @@ -7,17 +7,9 @@ //------------------------------------------------------------------------------ -// GrB_UnaryOp_new is implemented both as a macro and a function. Both are -// user-callable. The macro is used by default since it can capture the name -// of the unary function. - #include "GB.h" -// the macro version of this function must first be #undefined -#undef GrB_UnaryOp_new -#undef GrM_UnaryOp_new - -GrB_Info GRB (UnaryOp_new) // create a new user-defined unary operator +GrB_Info GrB_UnaryOp_new // create a new user-defined unary operator ( GrB_UnaryOp *unaryop, // handle for the new unary operator GxB_unary_function function, // pointer to the unary function diff --git a/GraphBLAS/Source/GrB_UnaryOp_set.c b/GraphBLAS/Source/GrB_UnaryOp_set.c new file mode 100644 index 0000000000..bf92f6d71a --- /dev/null +++ b/GraphBLAS/Source/GrB_UnaryOp_set.c @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------ +// GrB_UnaryOp_set_*: set a field in a unary op +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_set_Scalar +( + GrB_UnaryOp op, + GrB_Scalar value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_set_String +( + GrB_UnaryOp op, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_UnaryOp_set_String (op, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (op) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_UNARYOP_OK (op, "unaryop for set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_op_string_set ((GB_Operator) op, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_set_INT32 +( + GrB_UnaryOp op, + int32_t value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + +//------------------------------------------------------------------------------ +// GrB_UnaryOp_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_UnaryOp_set_VOID +( + GrB_UnaryOp op, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Vector_get.c b/GraphBLAS/Source/GrB_Vector_get.c new file mode 100644 index 0000000000..8eb0aef5df --- /dev/null +++ b/GraphBLAS/Source/GrB_Vector_get.c @@ -0,0 +1,162 @@ +//------------------------------------------------------------------------------ +// GrB_Vector_get_*: get a field in a matrix +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Vector_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_get_Scalar +( + GrB_Vector v, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_get_Scalar (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_VECTOR_OK (v, "v to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + int32_t i ; + GrB_Info info = GB_matvec_enum_get ((GrB_Matrix) v, &i, field) ; + if (info == GrB_SUCCESS) + { + // field specifies an int32_t: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &i, 0, 0, + GB_INT32_code, Werk) ; + } + else + { + double x ; + switch ((int) field) + { + case GxB_BITMAP_SWITCH : + x = (double) (v->bitmap_switch) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + // field specifies a double: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &x, 0, 0, + GB_FP64_code, Werk) ; + } + + return (info) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_get_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_get_String +( + GrB_Vector v, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_get_String (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_VECTOR_OK (v, "v to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_get ((GrB_Matrix) v, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_get_INT32 +( + GrB_Vector v, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_get_INT32 (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_VECTOR_OK (v, "v to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_enum_get ((GrB_Matrix) v, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_get_SIZE +( + GrB_Vector v, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_get_SIZE (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_VECTOR_OK (v, "v to get option", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_size_get ((GrB_Matrix) v, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_get_VOID +( + GrB_Vector v, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_Vector_set.c b/GraphBLAS/Source/GrB_Vector_set.c new file mode 100644 index 0000000000..aae8adb393 --- /dev/null +++ b/GraphBLAS/Source/GrB_Vector_set.c @@ -0,0 +1,126 @@ +//------------------------------------------------------------------------------ +// GrB_Vector_set_*: set a field in a vector +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GrB_Vector_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_set_Scalar +( + GrB_Vector v, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_set_Scalar (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + ASSERT_VECTOR_OK (v, "v to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + double dvalue = 0 ; + int32_t ivalue = 0 ; + GrB_Info info ; + + switch ((int) field) + { + case GxB_BITMAP_SWITCH : + info = GrB_Scalar_extractElement_FP64 (&dvalue, value) ; + break ; + default : + info = GrB_Scalar_extractElement_INT32 (&ivalue, value) ; + break ; + } + + if (info != GrB_SUCCESS) + { + return ((info == GrB_NO_VALUE) ? GrB_EMPTY_OBJECT : info) ; + } + return (GB_matvec_set ((GrB_Matrix) v, true, ivalue, dvalue, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_set_String +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_set_String +( + GrB_Vector v, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_set_String (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_VECTOR_OK (v, "v to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_matvec_name_set ((GrB_Matrix) v, value, field)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_set_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_set_INT32 +( + GrB_Vector v, + int32_t value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GrB_Vector_set_INT32 (v, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (v) ; + ASSERT_VECTOR_OK (v, "v to set option", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_matvec_set ((GrB_Matrix) v, true, value, 0, field, Werk)) ; +} + +//------------------------------------------------------------------------------ +// GrB_Vector_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GrB_Vector_set_VOID +( + GrB_Vector v, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GrB_init.c b/GraphBLAS/Source/GrB_init.c index c4d4375a2d..d0204449d4 100644 --- a/GraphBLAS/Source/GrB_init.c +++ b/GraphBLAS/Source/GrB_init.c @@ -29,7 +29,7 @@ GrB_Info GrB_init // start up GraphBLAS // initialize GraphBLAS //-------------------------------------------------------------------------- - // default: use the ANSI C11 malloc memory manager, which is thread-safe + // default: use the C11 malloc memory manager, which is thread-safe return (GB_init (mode, // blocking or non-blocking mode malloc, calloc, realloc, free, // ANSI C memory management functions diff --git a/GraphBLAS/Source/GxB_Context_free.c b/GraphBLAS/Source/GxB_Context_free.c index bdf817f52f..32b975961b 100644 --- a/GraphBLAS/Source/GxB_Context_free.c +++ b/GraphBLAS/Source/GxB_Context_free.c @@ -34,6 +34,8 @@ GrB_Info GxB_Context_free // free a Context if (Context != NULL) { size_t header_size = Context->header_size ; + // free the Context user_name + GB_FREE (&(Context->user_name), Context->user_name_size) ; if (header_size > 0) { Context->magic = GB_FREED ; // to help detect dangling pointers diff --git a/GraphBLAS/Source/GxB_Context_get.c b/GraphBLAS/Source/GxB_Context_get.c index c4549a7bf9..927325bd7b 100644 --- a/GraphBLAS/Source/GxB_Context_get.c +++ b/GraphBLAS/Source/GxB_Context_get.c @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// GxB_Context_get: get a field of a Context +// GxB_Context_get: get a field of Context (HISTORICAL; do not use for new code) //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. diff --git a/GraphBLAS/Source/GxB_Context_get2.c b/GraphBLAS/Source/GxB_Context_get2.c new file mode 100644 index 0000000000..8950d95231 --- /dev/null +++ b/GraphBLAS/Source/GxB_Context_get2.c @@ -0,0 +1,229 @@ +//------------------------------------------------------------------------------ +// GxB_Context_get_*: get a field in a context +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GxB_Context_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_get_Scalar +( + GxB_Context Context, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_get_Scalar (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_CONTEXT_OK (Context, "context for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + double dvalue = 0 ; + int32_t ivalue = 0 ; + GrB_Info info ; + + switch ((int) field) + { + + case GxB_CONTEXT_CHUNK : // same as GxB_CHUNK + + dvalue = GB_Context_chunk_get (Context) ; + break ; + + case GxB_CONTEXT_NTHREADS : // same as GxB_NTHREADS + + ivalue = GB_Context_nthreads_max_get (Context) ; + break ; + + case GxB_CONTEXT_GPU_ID : // same as GxB_GPU_ID + + ivalue= GB_Context_gpu_id_get (Context) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + switch ((int) field) + { + + case GxB_CONTEXT_CHUNK : // same as GxB_CHUNK + + info = GB_setElement ((GrB_Matrix) value, NULL, &dvalue, 0, 0, + GB_FP64_code, Werk) ; + break ; + + default : + info = GB_setElement ((GrB_Matrix) value, NULL, &ivalue, 0, 0, + GB_INT32_code, Werk) ; + break ; + } + + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_get_String +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_get_String +( + GxB_Context Context, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_get_String (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_CONTEXT_OK (Context, "context for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + if (field != GrB_NAME) + { + return (GrB_INVALID_VALUE) ; + } + + (*value) = '\0' ; + if (Context == GxB_CONTEXT_WORLD) + { + // built-in Context + strcpy (value, "GxB_CONTEXT_WORLD") ; + } + else if (Context->user_name_size > 0) + { + // user-defined Context, with name defined by GrB_set + strcpy (value, Context->user_name) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_get_INT +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_get_INT +( + GxB_Context Context, + int32_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_get_INT (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_CONTEXT_OK (Context, "context for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_CONTEXT_NTHREADS : // same as GxB_NTHREADS + + (*value) = GB_Context_nthreads_max_get (Context) ; + break ; + + case GxB_CONTEXT_GPU_ID : // same as GxB_GPU_ID + + (*value) = GB_Context_gpu_id_get (Context) ; + break ; + + default : + + return (GrB_INVALID_VALUE) ; + } + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_get_SIZE +( + GxB_Context Context, + size_t * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_get_SIZE (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_CONTEXT_OK (Context, "context for get", GB0) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + if (field != GrB_NAME) + { + return (GrB_INVALID_VALUE) ; + } + + if (Context->user_name != NULL) + { + (*value) = Context->user_name_size ; + } + else + { + (*value) = GxB_MAX_NAME_LEN ; + } + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_get_VOID +( + GxB_Context Context, + void * value, + GrB_Field field +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GxB_Context_new.c b/GraphBLAS/Source/GxB_Context_new.c index 360bb0b7cb..ad0e7d9de9 100644 --- a/GraphBLAS/Source/GxB_Context_new.c +++ b/GraphBLAS/Source/GxB_Context_new.c @@ -41,6 +41,8 @@ GrB_Info GxB_Context_new // create a new Context Context->magic = GB_MAGIC ; Context->header_size = header_size ; + Context->user_name = NULL ; // user_name for GrB_get/GrB_set + Context->user_name_size = 0 ; // initialize the Context with the same settings as GxB_CONTEXT_WORLD Context->nthreads_max = GB_Context_nthreads_max_get (NULL) ; diff --git a/GraphBLAS/Source/GxB_Context_set.c b/GraphBLAS/Source/GxB_Context_set.c index ffa7eb1a34..ece98c8ee8 100644 --- a/GraphBLAS/Source/GxB_Context_set.c +++ b/GraphBLAS/Source/GxB_Context_set.c @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// GxB_Context_set: set a field in a Context +// GxB_Context_set: set a field in Context (HISTORICAL; do not use for new code) //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. diff --git a/GraphBLAS/Source/GxB_Context_set2.c b/GraphBLAS/Source/GxB_Context_set2.c new file mode 100644 index 0000000000..02e0d6ca9c --- /dev/null +++ b/GraphBLAS/Source/GxB_Context_set2.c @@ -0,0 +1,179 @@ +//------------------------------------------------------------------------------ +// GxB_Context_set_*: set a field in a Context +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" + +//------------------------------------------------------------------------------ +// GxB_Context_set_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_set_Scalar +( + GxB_Context Context, + GrB_Scalar value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_set_Scalar (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + ASSERT_CONTEXT_OK (Context, "Context to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + GrB_Info info ; + int32_t ivalue = 0 ; + double dvalue = 0 ; + + switch ((int) field) + { + + case GxB_CONTEXT_NTHREADS : // same as GxB_NTHREADS + case GxB_CONTEXT_GPU_ID : // same as GxB_GPU_ID + info = GrB_Scalar_extractElement_INT32 (&ivalue, value) ; + break ; + + case GxB_CONTEXT_CHUNK : // same as GxB_CHUNK + info = GrB_Scalar_extractElement_FP64 (&dvalue, value) ; + break ; + + default : + info = GrB_INVALID_VALUE ; + break ; + } + + if (info != GrB_SUCCESS) + { + return ((info == GrB_NO_VALUE) ? GrB_EMPTY_OBJECT : info) ; + } + + switch (field) + { + + default: + case GxB_CONTEXT_NTHREADS : // same as GxB_NTHREADS + + GB_Context_nthreads_max_set (Context, ivalue) ; + break ; + + case GxB_CONTEXT_GPU_ID : // same as GxB_GPU_ID + + GB_Context_gpu_id_set (Context, ivalue) ; + break ; + + case GxB_CONTEXT_CHUNK : // same as GxB_CHUNK + + GB_Context_chunk_set (Context, dvalue) ; + break ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_set_String +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_set_String +( + GxB_Context Context, + char * value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_set_String (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + GB_RETURN_IF_NULL (value) ; + ASSERT_CONTEXT_OK (Context, "Context to get option", GB0) ; + + if (Context == GxB_CONTEXT_WORLD || field != GrB_NAME) + { + // built-in GxB_CONTEXT_WORLD may not be modified + return (GrB_INVALID_VALUE) ; + } + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + return (GB_user_name_set (&(Context->user_name), + &(Context->user_name_size), value, false)) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_set_INT +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_set_INT +( + GxB_Context Context, + int32_t value, + GrB_Field field +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Context_set_INT (Context, value, field)") ; + GB_RETURN_IF_NULL_OR_FAULTY (Context) ; + ASSERT_CONTEXT_OK (Context, "Context to set", GB0) ; + + //-------------------------------------------------------------------------- + // set the field + //-------------------------------------------------------------------------- + + switch (field) + { + + case GxB_CONTEXT_NTHREADS : // same as GxB_NTHREADS + + GB_Context_nthreads_max_set (Context, value) ; + break ; + + case GxB_CONTEXT_GPU_ID : // same as GxB_GPU_ID + + GB_Context_gpu_id_set (Context, value) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Context_set_VOID +//------------------------------------------------------------------------------ + +GrB_Info GxB_Context_set_VOID +( + GxB_Context Context, + void * value, + GrB_Field field, + size_t size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GxB_IndexUnaryOp_new.c b/GraphBLAS/Source/GxB_IndexUnaryOp_new.c index 2993e85392..17f9d227c3 100644 --- a/GraphBLAS/Source/GxB_IndexUnaryOp_new.c +++ b/GraphBLAS/Source/GxB_IndexUnaryOp_new.c @@ -63,6 +63,8 @@ GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp //-------------------------------------------------------------------------- op->magic = GB_MAGIC ; + op->user_name = NULL ; + op->user_name_size = 0 ; op->ztype = ztype ; op->xtype = xtype ; op->ytype = ytype ; // thunk type @@ -87,7 +89,7 @@ GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp // output: op->name, &(op->name_len), &(op->hash), &(op->defn), &(op->defn_size), // input: - idxop_name, idxop_defn, "GxB_index_unary_function", 24, true, jitable) ; + idxop_name, idxop_defn, true, jitable) ; if (info != GrB_SUCCESS) { // out of memory diff --git a/GraphBLAS/Source/GxB_Matrix_serialize.c b/GraphBLAS/Source/GxB_Matrix_serialize.c index 181299823b..7674c64c24 100644 --- a/GraphBLAS/Source/GxB_Matrix_serialize.c +++ b/GraphBLAS/Source/GxB_Matrix_serialize.c @@ -12,7 +12,7 @@ // This method is similar to GrB_Matrix_serialize. In contrast with the GrB* // method, this method allocates the blob itself, and hands over the allocated // space to the user application. The blob must be freed by the same free -// function passed in to GxB_init, or by the ANSI C11 free() if GrB_init was +// function passed in to GxB_init, or by the C11 free() if GrB_init was // used. On input, the blob_size need not be initialized; it is returned as // the size of the blob as allocated. diff --git a/GraphBLAS/Source/GxB_Serialized_get.c b/GraphBLAS/Source/GxB_Serialized_get.c new file mode 100644 index 0000000000..ee7725189e --- /dev/null +++ b/GraphBLAS/Source/GxB_Serialized_get.c @@ -0,0 +1,532 @@ +//------------------------------------------------------------------------------ +// GxB_Serialized_get_*: query the contents of a serialized blob +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_get_set.h" +#include "GB_serialize.h" + +//------------------------------------------------------------------------------ +// GB_blob_header_get: get all properties of the blob +//------------------------------------------------------------------------------ + +static GrB_Info GB_blob_header_get +( + // output: + char *type_name, // name of the type (char array of size at + // least GxB_MAX_NAME_LEN) + int32_t *type_code, // type code of the matrix + int32_t *sparsity_status, // sparsity status + int32_t *sparsity_ctrl, // sparsity control + double *hyper_sw, // hyper_switch + double *bitmap_sw, // bitmap_switch + int32_t *storage, // GrB_COLMAJOR or GrB_ROWMAJOR + char **user_name, // GrB_NAME of the blob + char **eltype_string, // GrB_EL_TYPE_STRING of the type of the blob + + // input, not modified: + const GB_void *blob, // the blob + GrB_Index blob_size // size of the blob +) +{ + + //-------------------------------------------------------------------------- + // read the content of the header (160 bytes) + //-------------------------------------------------------------------------- + + size_t s = 0 ; + + if (blob_size < GB_BLOB_HEADER_SIZE) + { + // blob is invalid + return (GrB_INVALID_OBJECT) ; + } + + GB_BLOB_READ (blob_size2, uint64_t) ; + GB_BLOB_READ (typecode, int32_t) ; + uint64_t blob_size1 = (uint64_t) blob_size ; + + if (blob_size1 != blob_size2 + || typecode < GB_BOOL_code || typecode > GB_UDT_code + || (typecode == GB_UDT_code && + blob_size < GB_BLOB_HEADER_SIZE + GxB_MAX_NAME_LEN)) + { + // blob is invalid + return (GrB_INVALID_OBJECT) ; + } + + GB_BLOB_READ (version, int32_t) ; + GB_BLOB_READ (vlen, int64_t) ; + GB_BLOB_READ (vdim, int64_t) ; + GB_BLOB_READ (nvec, int64_t) ; + GB_BLOB_READ (nvec_nonempty, int64_t) ; ASSERT (nvec_nonempty >= 0) ; + GB_BLOB_READ (nvals, int64_t) ; + GB_BLOB_READ (typesize, int64_t) ; + GB_BLOB_READ (Cp_len, int64_t) ; + GB_BLOB_READ (Ch_len, int64_t) ; + GB_BLOB_READ (Cb_len, int64_t) ; + GB_BLOB_READ (Ci_len, int64_t) ; + GB_BLOB_READ (Cx_len, int64_t) ; + GB_BLOB_READ (hyper_switch, float) ; + GB_BLOB_READ (bitmap_switch, float) ; + GB_BLOB_READ (sparsity_control, int32_t) ; + GB_BLOB_READ (sparsity_iso_csc, int32_t) ; + GB_BLOB_READ (Cp_nblocks, int32_t) ; GB_BLOB_READ (Cp_method, int32_t) ; + GB_BLOB_READ (Ch_nblocks, int32_t) ; GB_BLOB_READ (Ch_method, int32_t) ; + GB_BLOB_READ (Cb_nblocks, int32_t) ; GB_BLOB_READ (Cb_method, int32_t) ; + GB_BLOB_READ (Ci_nblocks, int32_t) ; GB_BLOB_READ (Ci_method, int32_t) ; + GB_BLOB_READ (Cx_nblocks, int32_t) ; GB_BLOB_READ (Cx_method, int32_t) ; + + (*sparsity_status) = sparsity_iso_csc / 4 ; + bool iso = ((sparsity_iso_csc & 2) == 2) ; + bool is_csc = ((sparsity_iso_csc & 1) == 1) ; + (*sparsity_ctrl) = sparsity_control ; + (*hyper_sw) = (double) hyper_switch ; + (*bitmap_sw) = (double) bitmap_switch ; + (*storage) = (is_csc) ? GrB_COLMAJOR : GrB_ROWMAJOR ; + + //-------------------------------------------------------------------------- + // determine the matrix type_code and C type_name + //-------------------------------------------------------------------------- + + (*type_code) = GB_type_code_get (typecode) ; + memset (type_name, 0, GxB_MAX_NAME_LEN) ; + + if (typecode >= GB_BOOL_code && typecode < GB_UDT_code) + { + // blob has a built-in type; the name is not in the blob + strcpy (type_name, GB_code_string (typecode)) ; + } + else if (typecode == GB_UDT_code) + { + // blob has a user-defined type + // get the GxB_JIT_C_NAME of the user type from the blob + memcpy (type_name, ((GB_void *) blob) + GB_BLOB_HEADER_SIZE, + GxB_MAX_NAME_LEN) ; + s += GxB_MAX_NAME_LEN ; + } + + // this should already be in the blob, but set it to null just in case + type_name [GxB_MAX_NAME_LEN-1] = '\0' ; +// printf ("JIT C type name [%s]\n", type_name) ; + + //-------------------------------------------------------------------------- + // get the compressed block sizes from the blob for each array + //-------------------------------------------------------------------------- + + GB_BLOB_READS (Cp_Sblocks, Cp_nblocks) ; + GB_BLOB_READS (Ch_Sblocks, Ch_nblocks) ; + GB_BLOB_READS (Cb_Sblocks, Cb_nblocks) ; + GB_BLOB_READS (Ci_Sblocks, Ci_nblocks) ; + GB_BLOB_READS (Cx_Sblocks, Cx_nblocks) ; + + //-------------------------------------------------------------------------- + // skip past each array (Cp, Ch, Cb, Ci, and Cx) + //-------------------------------------------------------------------------- + + switch (*sparsity_status) + { + case GxB_HYPERSPARSE : + // skip Cp, Ch, and Ci + s += (Cp_nblocks > 0) ? Cp_Sblocks [Cp_nblocks-1] : 0 ; + s += (Ch_nblocks > 0) ? Ch_Sblocks [Ch_nblocks-1] : 0 ; + s += (Ci_nblocks > 0) ? Ci_Sblocks [Ci_nblocks-1] : 0 ; + break ; + + case GxB_SPARSE : + // skip Cp and Ci + s += (Cp_nblocks > 0) ? Cp_Sblocks [Cp_nblocks-1] : 0 ; + s += (Ci_nblocks > 0) ? Ci_Sblocks [Ci_nblocks-1] : 0 ; + break ; + + case GxB_BITMAP : + // skip Cb + s += (Cb_nblocks > 0) ? Cb_Sblocks [Cb_nblocks-1] : 0 ; + break ; + + case GxB_FULL : + break ; + default: ; + } + + // skip Cx + s += (Cx_nblocks > 0) ? Cx_Sblocks [Cx_nblocks-1] : 0 ; + + //-------------------------------------------------------------------------- + // get the GrB_NAME and GrB_EL_TYPE_STRING + //-------------------------------------------------------------------------- + + // v8.1.0 adds two nul-terminated uncompressed strings to the end of the + // blob. If the strings are empty, the nul terminators still appear. + + (*user_name) = NULL ; + (*eltype_string) = NULL ; + + if (version >= GxB_VERSION (8,1,0)) + { + + //---------------------------------------------------------------------- + // look for the two nul bytes in blob [s : blob_size-1] + //---------------------------------------------------------------------- + + int nfound = 0 ; + size_t ss [2] ; + for (size_t p = s ; p < blob_size && nfound < 2 ; p++) + { + if (blob [p] == 0) + { + ss [nfound++] = p ; + } + } + + if (nfound == 2) + { + // extract the GrB_NAME and GrB_EL_TYPE_STRING from the blob + (*user_name) = (char *) (blob + s) ; + (*eltype_string) = (char *) (blob + ss [0] + 1) ; +// printf ("deserialize user_name %lu:[%s] eltype %lu:[%s]\n", +// s, *user_name, ss [0] + 1, *eltype_string) ; + } + } + + //-------------------------------------------------------------------------- + // return result + //-------------------------------------------------------------------------- + + #pragma omp flush + return (GrB_SUCCESS) ; +} + +//------------------------------------------------------------------------------ +// GxB_Serialized_get_Scalar +//------------------------------------------------------------------------------ + +GrB_Info GxB_Serialized_get_Scalar +( + const void * blob, + GrB_Scalar value, + GrB_Field field, + size_t blob_size +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Serialized_get_Scalar (blob, value, field, blobsize)") ; + GB_RETURN_IF_NULL (blob) ; + GB_RETURN_IF_NULL_OR_FAULTY (value) ; + + //-------------------------------------------------------------------------- + // read the blob + //-------------------------------------------------------------------------- + + char type_name [GxB_MAX_NAME_LEN], *user_name, *eltype_string ; + int32_t sparsity_status, sparsity_ctrl, type_code, storage ; + double hyper_sw, bitmap_sw ; + + GrB_Info info = GB_blob_header_get (type_name, &type_code, &sparsity_status, + &sparsity_ctrl, &hyper_sw, &bitmap_sw, &storage, + &user_name, &eltype_string, blob, blob_size) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + double dvalue = 0 ; + int32_t ivalue = 0 ; + bool is_double = false ; + + if (info == GrB_SUCCESS) + { + switch (field) + { + case GrB_STORAGE_ORIENTATION_HINT : + + ivalue = storage ; + break ; + + case GrB_EL_TYPE_CODE : + + ivalue = type_code ; + break ; + + case GxB_SPARSITY_CONTROL : + + ivalue = sparsity_ctrl ; + break ; + + case GxB_SPARSITY_STATUS : + + ivalue = sparsity_status ; + break ; + + case GxB_FORMAT : + + ivalue = (storage == GrB_COLMAJOR) ? GxB_BY_COL : GxB_BY_ROW ; + break ; + + case GxB_HYPER_SWITCH : + dvalue = hyper_sw ; + is_double = true ; + break ; + + case GxB_BITMAP_SWITCH : + dvalue = bitmap_sw ; + is_double = true ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + + if (is_double) + { + // field specifies a double: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &dvalue, 0, 0, + GB_FP64_code, Werk) ; + } + else + { + // field specifies an int32_t: assign it to the scalar + info = GB_setElement ((GrB_Matrix) value, NULL, &ivalue, 0, 0, + GB_INT32_code, Werk) ; + } + } + + #pragma omp flush + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Serialized_get_String +//------------------------------------------------------------------------------ + +GrB_Info GxB_Serialized_get_String +( + const void * blob, + char * value, + GrB_Field field, + size_t blob_size +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Serialized_get_String (blob, value, field, blobsize)") ; + GB_RETURN_IF_NULL (blob) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // read the blob + //-------------------------------------------------------------------------- + + char type_name [GxB_MAX_NAME_LEN], *user_name, *eltype_string ; + int32_t sparsity_status, sparsity_ctrl, type_code, storage ; + double hyper_sw, bitmap_sw ; + + GrB_Info info = GB_blob_header_get (type_name, &type_code, &sparsity_status, + &sparsity_ctrl, &hyper_sw, &bitmap_sw, &storage, + &user_name, &eltype_string, blob, blob_size) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + (*value) = '\0' ; + const char *name ; + + if (info == GrB_SUCCESS) + { + switch (field) + { + + case GrB_NAME : + if (user_name != NULL) + { + strcpy (value, user_name) ; + } + break ; + + case GxB_JIT_C_NAME : + strcpy (value, type_name) ; + break ; + + case GrB_EL_TYPE_STRING : + if (eltype_string != NULL) + { + strcpy (value, eltype_string) ; + } + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + } + + #pragma omp flush + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Serialized_get_INT32 +//------------------------------------------------------------------------------ + +GrB_Info GxB_Serialized_get_INT32 +( + const void * blob, + int32_t * value, + GrB_Field field, + size_t blob_size +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Serialized_get_INT32 (blob, value, field, blobsize)") ; + GB_RETURN_IF_NULL (blob) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // read the blob + //-------------------------------------------------------------------------- + + char type_name [GxB_MAX_NAME_LEN], *user_name, *eltype_string ; + int32_t sparsity_status, sparsity_ctrl, type_code, storage ; + double hyper_sw, bitmap_sw ; + + GrB_Info info = GB_blob_header_get (type_name, &type_code, &sparsity_status, + &sparsity_ctrl, &hyper_sw, &bitmap_sw, &storage, + &user_name, &eltype_string, blob, blob_size) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + if (info == GrB_SUCCESS) + { + switch (field) + { + case GrB_STORAGE_ORIENTATION_HINT : + + (*value) = storage ; + break ; + + case GrB_EL_TYPE_CODE : + + (*value) = type_code ; + break ; + + case GxB_SPARSITY_CONTROL : + + (*value) = sparsity_ctrl ; + break ; + + case GxB_SPARSITY_STATUS : + + (*value) = sparsity_status ; + break ; + + case GxB_FORMAT : + + (*value) = (storage == GrB_COLMAJOR) ? GxB_BY_COL : GxB_BY_ROW ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + } + + #pragma omp flush + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Serialized_get_SIZE +//------------------------------------------------------------------------------ + +GrB_Info GxB_Serialized_get_SIZE +( + const void * blob, + size_t * value, + GrB_Field field, + size_t blob_size +) +{ + + //-------------------------------------------------------------------------- + // check inputs + //-------------------------------------------------------------------------- + + GB_WHERE1 ("GxB_Serialized_get_SIZE (blob, value, field, blobsize)") ; + GB_RETURN_IF_NULL (blob) ; + GB_RETURN_IF_NULL (value) ; + + //-------------------------------------------------------------------------- + // read the blob + //-------------------------------------------------------------------------- + + char type_name [GxB_MAX_NAME_LEN], *user_name, *eltype_string ; + int32_t sparsity_status, sparsity_ctrl, type_code, storage ; + double hyper_sw, bitmap_sw ; + + GrB_Info info = GB_blob_header_get (type_name, &type_code, &sparsity_status, + &sparsity_ctrl, &hyper_sw, &bitmap_sw, &storage, + &user_name, &eltype_string, blob, blob_size) ; + + //-------------------------------------------------------------------------- + // get the field + //-------------------------------------------------------------------------- + + const char *name ; + + if (info == GrB_SUCCESS) + { + switch (field) + { + + case GrB_NAME : + (*value) = (user_name == NULL) ? 1 : (strlen (user_name) + 1) ; + break ; + + case GxB_JIT_C_NAME : + (*value) = strlen (type_name) + 1 ; + break ; + + case GrB_EL_TYPE_STRING : + (*value) = (eltype_string == NULL) ? + 1 : (strlen (eltype_string) + 1) ; + break ; + + default : + return (GrB_INVALID_VALUE) ; + } + } + #pragma omp flush + return (info) ; +} + +//------------------------------------------------------------------------------ +// GxB_Serialized_get_VOID +//------------------------------------------------------------------------------ + +GrB_Info GxB_Serialized_get_VOID +( + const void * blob, + void * value, + GrB_Field field, + size_t blob_size +) +{ + return (GrB_INVALID_VALUE) ; +} + diff --git a/GraphBLAS/Source/GxB_Type_from_name.c b/GraphBLAS/Source/GxB_Type_from_name.c index 407e9187fc..57d02ed6d5 100644 --- a/GraphBLAS/Source/GxB_Type_from_name.c +++ b/GraphBLAS/Source/GxB_Type_from_name.c @@ -7,10 +7,10 @@ //------------------------------------------------------------------------------ -// GxB_Type_from_name returns the built-in GrB_Type corresponding to the -// C name of the type as a string. For user-defined types, type is returned -// as NULL. This is not an error condition. This allows the user to write -// code such as this: +// GxB_Type_from_name returns the built-in GrB_Type corresponding to the C name +// of the type as a string, or the GraphBLAS name of the type. For +// user-defined types, type is returned as NULL. This is not an error +// condition. This allows the user to write code such as this: /* typedef struct { double x ; char stuff [16] ; } myfirsttype ; @@ -25,11 +25,14 @@ // ... create a matrix A of some built-in or user-defined type // later on, to query the type of A: + GrB_Scalar tsize ; + GrB_Scalar_new (&tsize, GrB_UINT32) ; + GrB_get (type, tsize, GrB_SIZE) ; // works for any type size_t typesize ; - GxB_Type_size (&typesize, type) ; // works for any type + GrB_Scalar_extractElement (&typesize, tsize) ; GrB_Type atype ; char atype_name [GxB_MAX_NAME_LEN] ; - GxB_Matrix_type_name (atype_name, A) ; + GrB_get (A, atype_name, GrB_NAME) ; GxB_Type_from_name (&atype, atype_name) ; if (atype == NULL) { @@ -57,8 +60,8 @@ // As a result, the GxB_Matrix_type function that appears in SuiteSparse // GraphBLAS has been declared "historical" and its use is discouraged. It -// won't be removed, to preserve backward compatibility, but it will eventually -// removed from the user guide. Use the string-based type mechanism instead. +// won't be removed, to preserve backward compatibility, but it is removed from +// the user guide. Use the string-based type mechanism instead. #include "GB.h" @@ -81,22 +84,23 @@ GrB_Info GxB_Type_from_name // return the GrB_Type from a name //-------------------------------------------------------------------------- #define MATCH(s) (strncmp (type_name, s, GxB_MAX_NAME_LEN) == 0) - - if (MATCH ("bool" )) (*type) = GrB_BOOL ; - else if (MATCH ("int8_t" )) (*type) = GrB_INT8 ; - else if (MATCH ("int16_t" )) (*type) = GrB_INT16 ; - else if (MATCH ("int32_t" )) (*type) = GrB_INT32 ; - else if (MATCH ("int64_t" )) (*type) = GrB_INT64 ; - else if (MATCH ("uint8_t" )) (*type) = GrB_UINT8 ; - else if (MATCH ("uint16_t" )) (*type) = GrB_UINT16 ; - else if (MATCH ("uint32_t" )) (*type) = GrB_UINT32 ; - else if (MATCH ("uint64_t" )) (*type) = GrB_UINT64 ; - else if (MATCH ("float" )) (*type) = GrB_FP32 ; - else if (MATCH ("double" )) (*type) = GrB_FP64 ; - else if (MATCH ("float complex" )) (*type) = GxB_FC32 ; - else if (MATCH ("GxB_FC32_t" )) (*type) = GxB_FC32 ; - else if (MATCH ("double complex")) (*type) = GxB_FC64 ; - else if (MATCH ("GxB_FC64_t" )) (*type) = GxB_FC64 ; + #define MATCH2(s1,s2) MATCH (s1) || MATCH (s2) + + if (MATCH2 ("bool" , "GrB_BOOL" )) (*type) = GrB_BOOL ; + else if (MATCH2 ("int8_t" , "GrB_INT8" )) (*type) = GrB_INT8 ; + else if (MATCH2 ("int16_t" , "GrB_INT16" )) (*type) = GrB_INT16 ; + else if (MATCH2 ("int32_t" , "GrB_INT32" )) (*type) = GrB_INT32 ; + else if (MATCH2 ("int64_t" , "GrB_INT64" )) (*type) = GrB_INT64 ; + else if (MATCH2 ("uint8_t" , "GrB_UINT8" )) (*type) = GrB_UINT8 ; + else if (MATCH2 ("uint16_t" , "GrB_UINT16")) (*type) = GrB_UINT16 ; + else if (MATCH2 ("uint32_t" , "GrB_UINT32")) (*type) = GrB_UINT32 ; + else if (MATCH2 ("uint64_t" , "GrB_UINT64")) (*type) = GrB_UINT64 ; + else if (MATCH2 ("float" , "GrB_FP32" )) (*type) = GrB_FP32 ; + else if (MATCH2 ("double" , "GrB_FP64" )) (*type) = GrB_FP64 ; + else if (MATCH2 ("float complex" , "GxB_FC32_t")) (*type) = GxB_FC32 ; + else if (MATCH ("float _Complex" )) (*type) = GxB_FC32 ; + else if (MATCH2 ("double complex", "GxB_FC64_t")) (*type) = GxB_FC64 ; + else if (MATCH ("double _Complex" )) (*type) = GxB_FC64 ; else { // This is not an error. Returning type as NULL means that A has a diff --git a/GraphBLAS/Source/GxB_Type_new.c b/GraphBLAS/Source/GxB_Type_new.c index 3afd386e2b..eeff523ad2 100644 --- a/GraphBLAS/Source/GxB_Type_new.c +++ b/GraphBLAS/Source/GxB_Type_new.c @@ -40,7 +40,7 @@ GrB_Info GxB_Type_new ( GrB_Type *type, // handle of user type to create size_t sizeof_type, // size of the user type - const char *type_name, // name of the user type, or "sizeof (ctype)" + const char *type_name, // name of the user type const char *type_defn // typedef of the C type (any length) ) { @@ -76,6 +76,8 @@ GrB_Info GxB_Type_new // initialize the type t->header_size = header_size ; + t->user_name = NULL ; + t->user_name_size = 0 ; t->size = sizeof_type ; t->code = GB_UDT_code ; // user-defined type memset (t->name, 0, GxB_MAX_NAME_LEN) ; // no name yet @@ -83,46 +85,13 @@ GrB_Info GxB_Type_new t->defn_size = 0 ; //-------------------------------------------------------------------------- - // get the name: as a type_name or "sizeof (type_name)" + // get the name //-------------------------------------------------------------------------- if (type_name != NULL) { // copy the type_name into the working name - char working [GxB_MAX_NAME_LEN] ; - memset (working, 0, GxB_MAX_NAME_LEN) ; - strncpy (working, type_name, GxB_MAX_NAME_LEN-1) ; - - // look for "sizeof" in the name - char *p = NULL ; - p = strstr (working, "sizeof") ; - if (p != NULL) - { - // "sizeof" appears in the input string, advance past it - p += 6 ; - - // find leading "(" if it appears, and advance to one char past it - char *p2 = strstr (p, "(") ; - if (p2 != NULL) p = p2 + 1 ; - - // find trailing ")" if it appears, and delete it - p2 = strstr (p, ")") ; - if (p2 != NULL) *p2 = '\0' ; - - // p now contains the final name, copy it to the output name - strncpy (t->name, p, GxB_MAX_NAME_LEN-1) ; - } - else - { - // "sizeof" does not appear, take the input type_name as-is - memcpy (t->name, working, GxB_MAX_NAME_LEN) ; - } - } - else - { - // no type name, so give it a generic name, with the size of type only - snprintf (t->name, GxB_MAX_NAME_LEN-1, "user_type_of_size_" GBu, - (uint64_t) sizeof_type) ; + strncpy (t->name, type_name, GxB_MAX_NAME_LEN-1) ; } // ensure t->name is null-terminated @@ -132,7 +101,7 @@ GrB_Info GxB_Type_new t->name_len = (int32_t) strlen (t->name) ; // type can be JIT'd only if it has a name and defn t->hash = GB_jitifyer_hash (t->name, t->name_len, - (type_name != NULL && type_defn != NULL)) ; + (t->name_len > 0 && type_defn != NULL)) ; //-------------------------------------------------------------------------- // get the typedef, if present diff --git a/GraphBLAS/Source/GxB_Vector_serialize.c b/GraphBLAS/Source/GxB_Vector_serialize.c index ef00a5772b..ab8de201f4 100644 --- a/GraphBLAS/Source/GxB_Vector_serialize.c +++ b/GraphBLAS/Source/GxB_Vector_serialize.c @@ -12,7 +12,7 @@ // This method is similar to GxB_Matrix_serialize. Like that method, it // allocates the blob itself, and hands over the allocated space to the user // application. The blob must be freed by the same free function passed in to -// GxB_init, or by the ANSI C11 free() if GrB_init was used. On input, the +// GxB_init, or by the C11 free() if GrB_init was used. On input, the // blob_size need not be initialized; it is returned as the size of the blob as // allocated. diff --git a/GraphBLAS/Source/GxB_deserialize_type_name.c b/GraphBLAS/Source/GxB_deserialize_type_name.c index 9a69a535a7..8ef32fb32b 100644 --- a/GraphBLAS/Source/GxB_deserialize_type_name.c +++ b/GraphBLAS/Source/GxB_deserialize_type_name.c @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// GxB_deserialize_type_name: return the name of a type +// GxB_deserialize_type_name: return the JIT C name of the type of a blob //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. @@ -10,13 +10,16 @@ #include "GB.h" #include "GB_serialize.h" -// GxB_deserialize_type_name extracts the type_name of the GrB_Type of the -// GrB_Matrix or GrB_Vector held in a serialized blob. On input, type_name +// This method is historical; use GrB_get instead. + +// GxB_deserialize_type_name extracts the JIT C type_name of the GrB_Type of +// the GrB_Matrix or GrB_Vector held in a serialized blob. On input, type_name // must point to a user-owned char array of size at least GxB_MAX_NAME_LEN (it // must not point into the blob itself). On output, type_name will contain a // null-terminated string with the corresponding C type name. If the blob // holds a matrix of a built-in type, the name is returned as "bool" for // GrB_BOOL, "uint8_t" for GrB_UINT8, "float complex" for GxB_FC32, etc. +// If the type is user-defined, the GxB_JIT_C_NAME of the type is returned. GrB_Info GxB_deserialize_type_name // return the type name of a blob ( diff --git a/GraphBLAS/Source/GxB_init.c b/GraphBLAS/Source/GxB_init.c index b12fbaef05..d1d999caee 100644 --- a/GraphBLAS/Source/GxB_init.c +++ b/GraphBLAS/Source/GxB_init.c @@ -19,7 +19,7 @@ // Examples: // -// To use GraphBLAS with the ANSI C11 functions (or to another library +// To use GraphBLAS with the C11 functions (or to another library // linked in that replaces them): // // // either use: diff --git a/GraphBLAS/Source/Shared/GB_Operator.h b/GraphBLAS/Source/Shared/GB_Operator.h index 50f09e317a..ea197fd881 100644 --- a/GraphBLAS/Source/Shared/GB_Operator.h +++ b/GraphBLAS/Source/Shared/GB_Operator.h @@ -12,6 +12,10 @@ int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 + // ---------------------// + char *user_name ; // user name for GrB_get/GrB_set + size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set + // ---------------------// GrB_Type ztype ; // type of z GrB_Type xtype ; // type of x @@ -23,8 +27,8 @@ GxB_index_unary_function idxunop_function ; GxB_binary_function binop_function ; - char name [GxB_MAX_NAME_LEN] ; // name of the operator - int32_t name_len ; // length of user-defined name; 0 for builtin + char name [GxB_MAX_NAME_LEN] ; // JIT C name of the operator + int32_t name_len ; // length of JIT C name; 0 for builtin GB_Opcode opcode ; // operator opcode char *defn ; // function definition size_t defn_size ; // allocated size of the definition diff --git a/GraphBLAS/Source/Shared/GB_assign_shared_definitions.h b/GraphBLAS/Source/Shared/GB_assign_shared_definitions.h index c9dc7e79b4..ae5ff10df6 100644 --- a/GraphBLAS/Source/Shared/GB_assign_shared_definitions.h +++ b/GraphBLAS/Source/Shared/GB_assign_shared_definitions.h @@ -82,10 +82,10 @@ #define GB_GET_C_HYPER_HASH \ GB_OK (GB_hyper_hash_build (C, Werk)) ; \ - const int64_t *restrict C_Yp = (C_is_hyper) ? C->Y->p : NULL ; \ - const int64_t *restrict C_Yi = (C_is_hyper) ? C->Y->i : NULL ; \ - const int64_t *restrict C_Yx = (C_is_hyper) ? C->Y->x : NULL ; \ - const int64_t C_hash_bits = (C_is_hyper) ? (C->Y->vdim - 1) : 0 ; + const int64_t *restrict C_Yp = (C->Y == NULL) ? NULL : C->Y->p ; \ + const int64_t *restrict C_Yi = (C->Y == NULL) ? NULL : C->Y->i ; \ + const int64_t *restrict C_Yx = (C->Y == NULL) ? NULL : C->Y->x ; \ + const int64_t C_hash_bits = (C->Y == NULL) ? 0 : (C->Y->vdim - 1) ; //------------------------------------------------------------------------------ // GB_GET_MASK: get the mask matrix M @@ -111,10 +111,10 @@ #define GB_GET_MASK_HYPER_HASH \ GB_OK (GB_hyper_hash_build (M, Werk)) ; \ - const int64_t *restrict M_Yp = (M_is_hyper) ? M->Y->p : NULL ; \ - const int64_t *restrict M_Yi = (M_is_hyper) ? M->Y->i : NULL ; \ - const int64_t *restrict M_Yx = (M_is_hyper) ? M->Y->x : NULL ; \ - const int64_t M_hash_bits = (M_is_hyper) ? (M->Y->vdim - 1) : 0 ; + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; \ + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->i ; \ + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->x ; \ + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; //------------------------------------------------------------------------------ // GB_GET_ACCUM: get the accumulator op and its related typecasting functions @@ -220,10 +220,10 @@ const int64_t Svlen = S->vlen ; \ const int64_t Snvec = S->nvec ; \ const bool S_is_hyper = GB_IS_HYPERSPARSE (S) ; \ - const int64_t *restrict S_Yp = (S_is_hyper) ? S->Y->p : NULL ; \ - const int64_t *restrict S_Yi = (S_is_hyper) ? S->Y->i : NULL ; \ - const int64_t *restrict S_Yx = (S_is_hyper) ? S->Y->x : NULL ; \ - const int64_t S_hash_bits = (S_is_hyper) ? (S->Y->vdim - 1) : 0 ; + const int64_t *restrict S_Yp = (S->Y == NULL) ? NULL : S->Y->p ; \ + const int64_t *restrict S_Yi = (S->Y == NULL) ? NULL : S->Y->i ; \ + const int64_t *restrict S_Yx = (S->Y == NULL) ? NULL : S->Y->x ; \ + const int64_t S_hash_bits = (S->Y == NULL) ? 0 : (S->Y->vdim - 1) ; //------------------------------------------------------------------------------ // basic actions @@ -1277,8 +1277,8 @@ { \ if (X ## _is_hyper) \ { \ - GB_hyper_hash_lookup (X ## p, X ## _Yp, X ## _Yi, X ## _Yx, \ - X ## _hash_bits, j, &pX_start, &pX_end) ; \ + GB_hyper_hash_lookup (X ## h, X ## nvec, X ## p, X ## _Yp, \ + X ## _Yi, X ## _Yx, X ## _hash_bits, j, &pX_start, &pX_end) ; \ } \ else \ { \ diff --git a/GraphBLAS/Source/Shared/GB_complex.h b/GraphBLAS/Source/Shared/GB_complex.h index 45ca58e2f0..d201c05913 100644 --- a/GraphBLAS/Source/Shared/GB_complex.h +++ b/GraphBLAS/Source/Shared/GB_complex.h @@ -153,7 +153,7 @@ #else //-------------------------------------------------------------------------- - // ANSI C11 + // C11 //-------------------------------------------------------------------------- #define GB_crealf(x) crealf(x) diff --git a/GraphBLAS/Source/Shared/GB_hyper_hash_lookup.h b/GraphBLAS/Source/Shared/GB_hyper_hash_lookup.h index 682d7e2115..c32640cb1d 100644 --- a/GraphBLAS/Source/Shared/GB_hyper_hash_lookup.h +++ b/GraphBLAS/Source/Shared/GB_hyper_hash_lookup.h @@ -15,6 +15,9 @@ GB_STATIC_INLINE int64_t GB_hyper_hash_lookup // k if j==Ah[k]; -1 if not found ( + // new inputs, not modified + const int64_t *restrict Ah, // A->h [0..A->nvec-1]: list of vectors + const int64_t anvec, // input, not modified const int64_t *restrict Ap, // A->p [0..A->nvec]: pointers to vectors const int64_t *restrict Yp, // A->Y->p @@ -22,57 +25,79 @@ GB_STATIC_INLINE int64_t GB_hyper_hash_lookup // k if j==Ah[k]; -1 if not found const int64_t *restrict Yx, // A->Y->x const int64_t hash_bits, // A->Y->vdim-1, which is hash table size-1 const int64_t j, // find j in Ah [0..anvec-1], using A->Y + // output int64_t *restrict pstart, // start of vector: Ap [k] int64_t *restrict pend // end of vector: Ap [k+1] ) { - //-------------------------------------------------------------------------- - // determine the hash bucket that would contain vector j - //-------------------------------------------------------------------------- + bool found = false ; + int64_t k ; - const int64_t jhash = GB_HASHF2 (j, hash_bits) ; + if (Yp == NULL) + { - //-------------------------------------------------------------------------- - // search for j in the jhash bucket: Yi [Yp [jhash] ... Yp [jhash+1]-1] - //-------------------------------------------------------------------------- + //---------------------------------------------------------------------- + // no hyper_hash constructed + //---------------------------------------------------------------------- + + // binary search of Ah [0...A->nvec-1] for the value j + k = 0 ; + int64_t pright = anvec - 1 ; + GB_BINARY_SEARCH (j, Ah, k, pright, found) ; - const int64_t ypstart = Yp [jhash] ; - const int64_t ypend = Yp [jhash+1] ; - int64_t k = -1 ; - if ((ypend - ypstart) > 256) - { - // The hash bucket jhash has over 256 entries, which is a very high - // number of collisions. The load factor of the hash table ranges from - // 2 to 4. Do a binary search as a fallback. - bool found ; - int64_t p = ypstart ; - int64_t pright = ypend - 1 ; - GB_BINARY_SEARCH (j, Yi, p, pright, found) ; - if (found) - { - k = Yx [p] ; - } } else { - // Linear-time search for j in the jhash bucket. - for (int64_t p = ypstart ; p < ypend ; p++) + + //---------------------------------------------------------------------- + // using the hyper_hash + //---------------------------------------------------------------------- + + // determine the hash bucket that would contain vector j + const int64_t jhash = GB_HASHF2 (j, hash_bits) ; + + //---------------------------------------------------------------------- + // search for j in the jhash bucket: Yi [Yp [jhash] ... Yp [jhash+1]-1] + //---------------------------------------------------------------------- + + const int64_t ypstart = Yp [jhash] ; + const int64_t ypend = Yp [jhash+1] ; + k = -1 ; + if ((ypend - ypstart) > 256) { - if (j == Yi [p]) + // The hash bucket jhash has over 256 entries, which is a very high + // number of collisions. The load factor of the hash table ranges + // from 2 to 4. Do a binary search as a fallback. + int64_t p = ypstart ; + int64_t pright = ypend - 1 ; + GB_BINARY_SEARCH (j, Yi, p, pright, found) ; + if (found) { - // found: j = Ah [k] where k is given by k = Yx [p] k = Yx [p] ; - break ; } } + else + { + // Linear-time search for j in the jhash bucket. + for (int64_t p = ypstart ; p < ypend ; p++) + { + if (j == Yi [p]) + { + // found: j = Ah [k] where k is given by k = Yx [p] + k = Yx [p] ; + break ; + } + } + found = (k >= 0) ; + } } //-------------------------------------------------------------------------- // if found, return the start and end of A(:,j) //-------------------------------------------------------------------------- - if (k >= 0) + if (found) { // found: j == Ah [k], get the vector A(:,j) (*pstart) = Ap [k] ; @@ -81,6 +106,7 @@ GB_STATIC_INLINE int64_t GB_hyper_hash_lookup // k if j==Ah[k]; -1 if not found else { // not found: j is not in the hyperlist Ah [0..anvec-1] + k = -1 ; (*pstart) = -1 ; (*pend ) = -1 ; } diff --git a/GraphBLAS/Source/Shared/GB_matrix.h b/GraphBLAS/Source/Shared/GB_matrix.h index 543f95f46f..26b5e0518e 100644 --- a/GraphBLAS/Source/Shared/GB_matrix.h +++ b/GraphBLAS/Source/Shared/GB_matrix.h @@ -9,10 +9,11 @@ // The GrB_Matrix and GrB_Vector objects are different names for the same // content. A GrB_Vector is held as an m-by-1 non-hypersparse CSC matrix. -// This file is #include'd in GB_opaque.h to define the GB_Matrix_opaque and -// GB_Vector_opaque structs. It would be cleaner to define just one opaque -// struct, and then GrB_Matrix and GrB_Vector would be typedef'd as pointers to -// the same struct, but then the compiler gets confused with Generic(x). +// This file is #include'd in GB_opaque.h to define the GB_Matrix_opaque, +// GB_Vector_opaque, and GB_Scalar_opaque structs. It would be cleaner to +// define just one opaque struct, and then GrB_Matrix, GrB_Vector, GrB_Scalar +// would be typedef'd as pointers to the same struct, but then the compiler +// gets confused with _Generic(x). // For a GrB_Vector object, as an m-by-1 non-hypersparse CSC matrix: // bool is_csc ; // always true @@ -27,13 +28,18 @@ // basic information: magic, error logger, and type //------------------------------------------------------------------------------ -// The first four items exactly match the first four items in the -// GrB_Descriptor struct. +// The first four items exactly match the first four items of nearly all +// GraphBLAS objects. The first 6 match the GrB_Descriptor struct. int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 +// ---------------------// +char *user_name ; // user name for GrB_get/GrB_set +size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set +// ---------------------// char *logger ; // error logger string size_t logger_size ; // size of the malloc'd block for logger, or 0 +// ---------------------// // The remaining items are specific the GrB_Matrix, GrB_Vector and GrB_Scalar // structs, and do not appear in the GrB_Descriptor struct: diff --git a/GraphBLAS/Source/Shared/GB_opaque.h b/GraphBLAS/Source/Shared/GB_opaque.h index 884536f00d..6c175431da 100644 --- a/GraphBLAS/Source/Shared/GB_opaque.h +++ b/GraphBLAS/Source/Shared/GB_opaque.h @@ -107,8 +107,8 @@ typedef enum GB_ERF_unop_code = 35, // z = erf (x) GB_ERFC_unop_code = 36, // z = erfc (x) GB_CBRT_unop_code = 37, // z = cbrt (x) - GB_FREXPX_unop_code = 38, // z = frexpx (x), mantissa of ANSI C11 frexp - GB_FREXPE_unop_code = 39, // z = frexpe (x), exponent of ANSI C11 frexp + GB_FREXPX_unop_code = 38, // z = frexpx (x), mantissa of C11 frexp + GB_FREXPE_unop_code = 39, // z = frexpe (x), exponent of C11 frexp //-------------------------------------------------------------------------- // unary operators for complex types only @@ -358,15 +358,21 @@ GB_Opcode ; // when A->p array is allocated but not initialized. #define GB_MAGIC2 0x7265745f786f62ULL +// Nearly all GraphBLAS objects contain the same first 4 items (except for +// GB_Global_opaque, which has just the first 2). + struct GB_Type_opaque // content of GrB_Type { int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 // ---------------------// + char *user_name ; // user name for GrB_get/GrB_set + size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set + // ---------------------// size_t size ; // size of the type GB_Type_code code ; // the type code - int32_t name_len ; // length of user-defined name; 0 for builtin - char name [GxB_MAX_NAME_LEN] ; // name of the type + int32_t name_len ; // length of JIT C name; 0 for builtin + char name [GxB_MAX_NAME_LEN] ; // JIT C name of the type char *defn ; // type definition size_t defn_size ; // allocated size of the definition uint64_t hash ; // if 0, type is builtin. @@ -407,6 +413,9 @@ struct GB_Monoid_opaque // content of GrB_Monoid int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 // ---------------------// + char *user_name ; // user name for GrB_get/GrB_set + size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set + // ---------------------// GrB_BinaryOp op ; // binary operator of the monoid void *identity ; // identity of the monoid; type is op->ztype void *terminal ; // early-exit (NULL if no value); type is op->ztype @@ -421,22 +430,29 @@ struct GB_Semiring_opaque // content of GrB_Semiring int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 // ---------------------// + char *user_name ; // user name for GrB_get/GrB_set + size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set + // ---------------------// GrB_Monoid add ; // add operator of the semiring GrB_BinaryOp multiply ; // multiply operator of the semiring - char *name ; // name of the type; NULL for builtin - int32_t name_len ; // length of user-defined name; 0 for builtin + char *name ; // name of the semiring; NULL for builtin + int32_t name_len ; // length of name; 0 for builtin size_t name_size ; // allocated size of the name uint64_t hash ; // if 0, semiring uses only builtin ops and types } ; struct GB_Descriptor_opaque // content of GrB_Descriptor { - // first 4 items exactly match GrB_Matrix, GrB_Vector, GrB_Scalar structs: + // first 6 items exactly match GrB_Matrix, GrB_Vector, GrB_Scalar structs: int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 // ---------------------// + char *user_name ; // user name for GrB_get/GrB_set + size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set + // ---------------------// char *logger ; // error logger string size_t logger_size ; // size of the malloc'd block for logger, or 0 + // ---------------------// // specific to the descriptor struct: GrB_Desc_Value out ; // output descriptor GrB_Desc_Value mask ; // mask descriptor @@ -453,6 +469,9 @@ struct GB_Context_opaque // content of GxB_Context int64_t magic ; // for detecting uninitialized objects size_t header_size ; // size of the malloc'd block for this struct, or 0 // ---------------------// + char *user_name ; // user name for GrB_get/GrB_set + size_t user_name_size ; // allocated size of user_name for GrB_get/GrB_set + // ---------------------// // OpenMP thread(s): double chunk ; // chunk size for # of threads for small problems int nthreads_max ; // max # threads to use in this call to GraphBLAS diff --git a/GraphBLAS/Source/Template/GB_AxB_dot3_meta.c b/GraphBLAS/Source/Template/GB_AxB_dot3_meta.c index e1a8c3c98a..7308d4b34d 100644 --- a/GraphBLAS/Source/Template/GB_AxB_dot3_meta.c +++ b/GraphBLAS/Source/Template/GB_AxB_dot3_meta.c @@ -106,17 +106,15 @@ const bool A_iso = A->iso ; #endif - const GrB_Matrix A_Y = A->Y ; - const int64_t *restrict A_Yp = (A_is_hyper) ? A_Y->p : NULL ; - const int64_t *restrict A_Yi = (A_is_hyper) ? A_Y->i : NULL ; - const int64_t *restrict A_Yx = (A_is_hyper) ? A_Y->x : NULL ; - const int64_t A_hash_bits = (A_is_hyper) ? (A_Y->vdim - 1) : 0 ; - - const GrB_Matrix B_Y = B->Y ; - const int64_t *restrict B_Yp = (B_is_hyper) ? B_Y->p : NULL ; - const int64_t *restrict B_Yi = (B_is_hyper) ? B_Y->i : NULL ; - const int64_t *restrict B_Yx = (B_is_hyper) ? B_Y->x : NULL ; - const int64_t B_hash_bits = (B_is_hyper) ? (B_Y->vdim - 1) : 0 ; + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; + + const int64_t *restrict B_Yp = (B->Y == NULL) ? NULL : B->Y->p ; + const int64_t *restrict B_Yi = (B->Y == NULL) ? NULL : B->Y->i ; + const int64_t *restrict B_Yx = (B->Y == NULL) ? NULL : B->Y->x ; + const int64_t B_hash_bits = (B->Y == NULL) ? 0 : (B->Y->vdim - 1) ; #if !GB_A_IS_PATTERN const GB_A_TYPE *restrict Ax = (GB_A_TYPE *) A->x ; diff --git a/GraphBLAS/Source/Template/GB_AxB_dot3_phase1_template.c b/GraphBLAS/Source/Template/GB_AxB_dot3_phase1_template.c index f02b54cff2..2cd571526d 100644 --- a/GraphBLAS/Source/Template/GB_AxB_dot3_phase1_template.c +++ b/GraphBLAS/Source/Template/GB_AxB_dot3_phase1_template.c @@ -57,8 +57,8 @@ #if GB_B_IS_HYPER // B is hyper: find B(:,j) using the B->Y hyper hash int64_t pB_start, pB_end ; - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, - j, &pB_start, &pB_end) ; + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, + B_hash_bits, j, &pB_start, &pB_end) ; #elif GB_B_IS_SPARSE // B is sparse const int64_t pB_start = Bp [j] ; @@ -106,8 +106,8 @@ #if GB_A_IS_HYPER // A is hyper: find A(:,i) using the A->Y hyper hash int64_t pA, pA_end ; - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, - i, &pA, &pA_end) ; + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, + A_hash_bits, i, &pA, &pA_end) ; const int64_t ainz = pA_end - pA ; work += GB_IMIN (ainz, bjnz) ; #elif GB_A_IS_SPARSE diff --git a/GraphBLAS/Source/Template/GB_AxB_dot3_template.c b/GraphBLAS/Source/Template/GB_AxB_dot3_template.c index e4b41c7b92..d9cdb407d3 100644 --- a/GraphBLAS/Source/Template/GB_AxB_dot3_template.c +++ b/GraphBLAS/Source/Template/GB_AxB_dot3_template.c @@ -72,8 +72,8 @@ #if GB_B_IS_HYPER // B is hyper: find B(:,j) using the B->Y hyper hash int64_t pB_start, pB_end ; - GB_hyper_hash_lookup (Bp, B_Yp, B_Yi, B_Yx, B_hash_bits, - j, &pB_start, &pB_end) ; + GB_hyper_hash_lookup (Bh, bnvec, Bp, B_Yp, B_Yi, B_Yx, + B_hash_bits, j, &pB_start, &pB_end) ; #elif GB_B_IS_SPARSE // B is sparse const int64_t pB_start = Bp [j] ; @@ -136,8 +136,8 @@ #if GB_A_IS_HYPER // A is hyper: find A(:,i) using the A->Y hyper hash int64_t pA, pA_end ; - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, - i, &pA, &pA_end) ; + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, + A_hash_bits, i, &pA, &pA_end) ; const int64_t ainz = pA_end - pA ; if (ainz > 0) #elif GB_A_IS_SPARSE diff --git a/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.c b/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.c index 0775683291..cac0998879 100644 --- a/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.c +++ b/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.c @@ -68,17 +68,10 @@ const bool A_ok_for_binary_search = ((A_is_sparse || A_is_hyper) && !A_jumbled) ; - const int64_t *restrict A_Yp = NULL ; - const int64_t *restrict A_Yi = NULL ; - const int64_t *restrict A_Yx = NULL ; - int64_t A_hash_bits = 0 ; - if (A_is_hyper) - { - A_Yp = A->Y->p ; - A_Yi = A->Y->i ; - A_Yx = A->Y->x ; - A_hash_bits = A->Y->vdim - 1 ; - } + const int64_t *restrict A_Yp = (A->Y == NULL) ? NULL : A->Y->p ; + const int64_t *restrict A_Yi = (A->Y == NULL) ? NULL : A->Y->i ; + const int64_t *restrict A_Yx = (A->Y == NULL) ? NULL : A->Y->x ; + const int64_t A_hash_bits = (A->Y == NULL) ? 0 : (A->Y->vdim - 1) ; #if ( !GB_NO_MASK ) const int64_t *restrict Mp = M->p ; @@ -98,18 +91,10 @@ int64_t mnvec = M->nvec ; int64_t mvlen = M->vlen ; // get the M hyper_hash - const int64_t *restrict M_Yp = NULL ; - const int64_t *restrict M_Yi = NULL ; - const int64_t *restrict M_Yx = NULL ; - int64_t M_hash_bits = 0 ; - if (M_is_hyper) - { - // mask is present, and hypersparse - M_Yp = M->Y->p ; - M_Yi = M->Y->i ; - M_Yx = M->Y->x ; - M_hash_bits = M->Y->vdim - 1 ; - } + const int64_t *restrict M_Yp = (M->Y == NULL) ? NULL : M->Y->p ; + const int64_t *restrict M_Yi = (M->Y == NULL) ? NULL : M->Y->i ; + const int64_t *restrict M_Yx = (M->Y == NULL) ? NULL : M->Y->x ; + const int64_t M_hash_bits = (M->Y == NULL) ? 0 : (M->Y->vdim - 1) ; #endif #if !GB_A_IS_PATTERN diff --git a/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.h b/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.h index d1b9a8ef89..869dc51921 100644 --- a/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.h +++ b/GraphBLAS/Source/Template/GB_AxB_saxpy3_template.h @@ -24,7 +24,7 @@ if (M_is_hyper) \ { \ /* M is hypersparse: find M(:,j) in the M->Y hyper_hash */ \ - GB_hyper_hash_lookup (Mp, M_Yp, M_Yi, M_Yx, M_hash_bits, \ + GB_hyper_hash_lookup (Mh, mnvec, Mp, M_Yp, M_Yi, M_Yx, M_hash_bits, \ GBH_B (Bh, kk), &pM_start, &pM_end) ; \ } \ else \ @@ -229,7 +229,7 @@ if (A_is_hyper) \ { \ /* A is hypersparse: find A(:,k) in the A->Y hyper_hash */ \ - GB_hyper_hash_lookup (Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, \ + GB_hyper_hash_lookup (Ah, anvec, Ap, A_Yp, A_Yi, A_Yx, A_hash_bits, \ k, &pA_start, &pA_end) ; \ } \ else \ diff --git a/GraphBLAS/Source/Template/GB_Template.h b/GraphBLAS/Source/Template/GB_Template.h index 4c85d071e4..c608047fa7 100644 --- a/GraphBLAS/Source/Template/GB_Template.h +++ b/GraphBLAS/Source/Template/GB_Template.h @@ -33,7 +33,7 @@ // Intentionally shadow the built-in "restrict" keyword. See GraphBLAS.h for // the definition of GB_restrict. It becomes empty for C++, and "__restrict" -// for MS Visual Studio. Otherwise, GB_restrict is just "restrict" on ANSI C11 +// for MS Visual Studio. Otherwise, GB_restrict is just "restrict" on C11 // compliant compilers. I prefer to use the "restrict" keyword to make the // code readable. This #define is a patch for compilers that don't support it: diff --git a/GraphBLAS/Source/Template/GB_compiler.h b/GraphBLAS/Source/Template/GB_compiler.h index 7c38e29e7c..4ee1d72b87 100644 --- a/GraphBLAS/Source/Template/GB_compiler.h +++ b/GraphBLAS/Source/Template/GB_compiler.h @@ -140,7 +140,7 @@ #if GB_COMPILER_MSC - // MS Visual Studio is not ANSI C11 compliant, and uses __pragma: + // MS Visual Studio is not C11 compliant, and uses __pragma: #define GB_PRAGMA(x) __pragma (x) // no #pragma omp simd is available in MS Visual Studio #define GB_PRAGMA_SIMD @@ -148,7 +148,7 @@ #else - // ANSI C11 compilers use _Pragma: + // C11 compilers use _Pragma: #define GB_PRAGMA(x) _Pragma (#x) // create two kinds of SIMD pragmas: // GB_PRAGMA_SIMD becomes "#pragma omp simd" diff --git a/GraphBLAS/Source/Template/GB_defaults.h b/GraphBLAS/Source/Template/GB_defaults.h index 28988faa0b..277d3fc792 100644 --- a/GraphBLAS/Source/Template/GB_defaults.h +++ b/GraphBLAS/Source/Template/GB_defaults.h @@ -17,8 +17,8 @@ // These parameters define the content of values that can be // used as inputs to GxB_*Option_set. -// The default format is by row (CSR). #define GB_HYPER_SWITCH_DEFAULT (0.0625) +#define GB_HYPER_HASH_DEFAULT (1024) // by default, give each thread at least 64K units of work to do #define GB_CHUNK_DEFAULT (64*1024) diff --git a/GraphBLAS/Source/Template/GB_math_macros.h b/GraphBLAS/Source/Template/GB_math_macros.h index f025e7763b..b694c45f9f 100644 --- a/GraphBLAS/Source/Template/GB_math_macros.h +++ b/GraphBLAS/Source/Template/GB_math_macros.h @@ -27,7 +27,7 @@ // NaN always return false, so if either x or y are NaN, then z = y, for both // min(x,y) and max(x,y). -// The ANSI C11 fmin, fminf, fmax, and fmaxf functions have the 'omitnan' +// The C11 fmin, fminf, fmax, and fmaxf functions have the 'omitnan' // behavior. These are used in SuiteSparse:GraphBLAS v2.3.0 and later. // for integers only: diff --git a/GraphBLAS/Source/Template/GB_wait_macros.h b/GraphBLAS/Source/Template/GB_wait_macros.h index 4a65848618..a9cde8c8ab 100644 --- a/GraphBLAS/Source/Template/GB_wait_macros.h +++ b/GraphBLAS/Source/Template/GB_wait_macros.h @@ -35,8 +35,5 @@ #define GB_ANY_PENDING_WORK(A) \ (GB_PENDING (A) || GB_ZOMBIES (A) || GB_JUMBLED (A)) -// true if a matrix is hypersparse but has no A->Y component -#define GB_NEED_HYPER_HASH(A) (GB_IS_HYPERSPARSE (A) && (((A)->Y) == NULL)) - #endif diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bba0bbacf__plus_my_rdiv2.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bba0bbacf__plus_my_rdiv2.c index 0ad827c375..0ccddc9deb 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bba0bbacf__plus_my_rdiv2.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bba0bbacf__plus_my_rdiv2.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f000bba0bbacf__plus_my_rdiv2.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -123,7 +123,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0x31aff911c5850713 ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = GB_my_rdiv2_USER_DEFN ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bbb0bbbcd__plus_my_rdiv.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bbb0bbbcd__plus_my_rdiv.c index feb46f314d..7d30d88d5d 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bbb0bbbcd__plus_my_rdiv.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f000bbb0bbbcd__plus_my_rdiv.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f000bbb0bbbcd__plus_my_rdiv.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -123,7 +123,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0x227f98d0b09e286f ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = GB_my_rdiv_USER_DEFN ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f046bbb0bbbcd.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f046bbb0bbbcd.c index 957bb6c964..72155b27e9 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f046bbb0bbbcd.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f046bbb0bbbcd.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f046bbb0bbbcd.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -105,7 +105,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0xdf8cbb0c0ac7ce22 ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = NULL ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0baacf__plus_my_rdiv2.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0baacf__plus_my_rdiv2.c index 39d0247e07..a93931aef2 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0baacf__plus_my_rdiv2.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0baacf__plus_my_rdiv2.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f100bba0baacf__plus_my_rdiv2.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -123,7 +123,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0x422f36dae3aeca51 ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = GB_my_rdiv2_USER_DEFN ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcd__plus_my_rdiv2.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcd__plus_my_rdiv2.c index c2b3fd9ce8..19f7db91ca 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcd__plus_my_rdiv2.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcd__plus_my_rdiv2.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f100bba0babcd__plus_my_rdiv2.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -123,7 +123,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0x654ba0e0a34027e9 ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = GB_my_rdiv2_USER_DEFN ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcf__plus_my_rdiv2.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcf__plus_my_rdiv2.c index 18bc680a26..8295437c66 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcf__plus_my_rdiv2.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0babcf__plus_my_rdiv2.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f100bba0babcf__plus_my_rdiv2.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -123,7 +123,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0x98afaa59c37fb8bb ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = GB_my_rdiv2_USER_DEFN ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0bbac7__plus_my_rdiv2.c b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0bbac7__plus_my_rdiv2.c index 3b33d165b7..8dcbd183b3 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0bbac7__plus_my_rdiv2.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__AxB_dot2__2c1f100bba0bbac7__plus_my_rdiv2.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__AxB_dot2__2c1f100bba0bbac7__plus_my_rdiv2.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -123,7 +123,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0xfaa3c6cd7f90ec16 ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = NULL ; defn [1] = GB_my_rdiv2_USER_DEFN ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/PreJIT/GB_jit__user_op__0__my_rdiv.c b/GraphBLAS/Tcov/PreJIT/GB_jit__user_op__0__my_rdiv.c index d1e0208abd..ababd0a961 100644 --- a/GraphBLAS/Tcov/PreJIT/GB_jit__user_op__0__my_rdiv.c +++ b/GraphBLAS/Tcov/PreJIT/GB_jit__user_op__0__my_rdiv.c @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // GB_jit__user_op__0__my_rdiv.c //------------------------------------------------------------------------------ -// SuiteSparse:GraphBLAS v8.2.0, Timothy A. Davis, (c) 2017-2023, +// SuiteSparse:GraphBLAS v9.0.0, Timothy A. Davis, (c) 2017-2023, // All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // The above copyright and license do not apply to any @@ -37,7 +37,9 @@ GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) ; GB_JIT_GLOBAL GB_JIT_QUERY_PROTO (GB_jit_query) { (*hash) = 0xa98ff14e387744fe ; - v [0] = 8 ; v [1] = 3 ; v [2] = 1 ; // keep at current version + v [0] = GxB_IMPLEMENTATION_MAJOR ; // keep at current version + v [1] = GxB_IMPLEMENTATION_MINOR ; + v [2] = GxB_IMPLEMENTATION_SUB ; defn [0] = GB_my_rdiv_USER_DEFN ; defn [1] = NULL ; defn [2] = NULL ; diff --git a/GraphBLAS/Tcov/README.txt b/GraphBLAS/Tcov/README.txt index 687be5f5f7..0521baf13d 100644 --- a/GraphBLAS/Tcov/README.txt +++ b/GraphBLAS/Tcov/README.txt @@ -3,8 +3,8 @@ SPDX-License-Identifier: Apache-2.0 GraphBLAS/Tcov: statement coverage tests -Requirements: the mex command must use a C compiler supporting ANSI C11. -Microft Visual Studio does not support ANSI C11 so this test is not available +Requirements: the mex command must use a C compiler supporting C11. +Microft Visual Studio does not support C11 so this test is not available on Windows unless you use another compiler. Since nearly all GraphBLAS tests are in *.m files, I have taken the unusual diff --git a/GraphBLAS/Tcov/grbuniq.m b/GraphBLAS/Tcov/grbuniq.m new file mode 100644 index 0000000000..27ef4ccccd --- /dev/null +++ b/GraphBLAS/Tcov/grbuniq.m @@ -0,0 +1,87 @@ + +% load grbstat +ntests = length (GraphBLAS_grbcovs) ; +n = length (GraphBLAS_grbcovs {1}) ; +G = cell2mat (GraphBLAS_grbcovs') ; +T = cell2mat (GraphBLAS_times') ; + +Mine = zeros (ntests, n) ; +Mine (1, :) = G (1, :) ; + +for k = 2:ntests + % find the statements covered by this test + Mine (k,:) = G (k,:) - G (k-1,:) ; +end + +% Mine (k,i) = 1 if the kth test covers statement i +Mine = full (spones (Mine)) ; + +S = sum (Mine) ; +U = (S == 1) ; +keeper = [ ] ; + +for k = 1:ntests + my_uniq = (Mine (k,:) > 0) & U ; + n_uniq = sum (my_uniq) ; + t = T (k) ; + fprintf ('%3d %-20s : %5d %9.2f', k, GraphBLAS_scripts {k}, n_uniq, t) ; + fprintf (' %10.2f ', t/n_uniq) ; + if (n_uniq == 0) + fprintf ('<<<<<<<<<<<') ; + else + keeper = [keeper k] ; + end + fprintf ('\n') ; +end + +fprintf ('\n====================================\n') ; + +[ignore I] = sort (T, 'descend') ; +for kk = 1:ntests + k = I (kk) ; + my_uniq = (Mine (k,:) > 0) & U ; + n_uniq = sum (my_uniq) ; + t = T (k) ; + fprintf ('%3d %3d %-20s : %5d %9.2f', kk, k, GraphBLAS_scripts {k}, n_uniq, t) ; + fprintf (' %10.2f ', t/n_uniq) ; + if (n_uniq == 0) + fprintf ('<<<<<<<<<<<') ; + Mine (k,:) = 0 ; + S = sum (Mine) ; + U = (S == 1) ; + else + keeper = [keeper k] ; + end + fprintf ('\n') ; +end + + + +%{ +fprintf ('\n====================================\n') ; + +Mine2 = Mine (keeper, :) ; +S2 = sum (Mine2) ; +U2 = (S2 == 1) ; +ntests2 = length (keeper) ; +T2 = T (keeper) ; +Scr = GraphBLAS_scripts (keeper) ; + +for k = 1:ntests2 + my_uniq = (Mine2 (k,:) > 0) & U2 ; + n_uniq = sum (my_uniq) ; + t = T2 (k) ; + fprintf ('%3d %-20s : %5d %6.2f', k, Scr {k}, n_uniq, t) ; + fprintf (' %10.2f ', t/n_uniq) ; + if (n_uniq == 0) + fprintf ('<<<<<<<<<<<') ; + else + keeper = [keeper k] ; + end + fprintf ('\n') ; +end + +sum (T) /60 +sum (T2) /60 +(sum (T) - sum (T2)) / 60 +%} diff --git a/GraphBLAS/Tcov/log_Dec20.txt b/GraphBLAS/Tcov/log_Dec20.txt deleted file mode 100644 index d4a3ba8ae1..0000000000 --- a/GraphBLAS/Tcov/log_Dec20.txt +++ /dev/null @@ -1,217 +0,0 @@ - ----------------------------------------------- [malloc] [cover] -20-Dec 15:03:59 test272 0.0 sec 113: 21943 of 22139 0.9% 4063.29/s -20-Dec 15:04:00 test268 0.2 sec 131: 21812 of 22139 1.5% 782.70/s -20-Dec 15:04:01 test145 1.5 sec 293: 21519 of 22139 2.8% 193.83/s -20-Dec 15:04:01 test145 0.0 sec 3: 21516 of 22139 2.8% 74.94/s -20-Dec 15:04:01 test145 0.0 sec 26: 21490 of 22139 2.9% 1401.16/s -20-Dec 15:04:01 test145 0.0 sec 4: 21486 of 22139 2.9% 176.11/s -20-Dec 15:04:02 test145 1.0 sec 52: 21434 of 22139 3.2% 50.71/s -20-Dec 15:04:02 test145 0.0 sec 5: 21429 of 22139 3.2% 541.83/s -20-Dec 15:04:03 test240 0.6 sec 88: 21341 of 22139 3.6% 148.98/s -20-Dec 15:04:03 test240 0.2 sec 1: 21340 of 22139 3.6% 4.36/s -20-Dec 15:04:04 test237 0.8 sec 46: 21294 of 22139 3.8% 54.46/s -20-Dec 15:04:06 test237 1.9 sec 4: 21290 of 22139 3.8% 2.12/s -20-Dec 15:04:06 test237 0.1 sec 20: 21270 of 22139 3.9% 238.08/s -20-Dec 15:04:06 test237 0.0 sec 6: 21264 of 22139 4.0% 242.37/s -20-Dec 15:04:06 test237 0.1 sec 4: 21260 of 22139 4.0% 54.50/s -20-Dec 15:04:07 test267 0.4 sec 35: 21225 of 22139 4.1% 92.09/s -20-Dec 15:04:07 test267 0.0 sec 1: 21224 of 22139 4.1% 1980.20/s -20-Dec 15:04:07 test266 0.0 sec 4: 21220 of 22139 4.2% 124.46/s -20-Dec 15:04:07 test265 0.3 sec 92: 21128 of 22139 4.6% 328.48/s -20-Dec 15:04:07 test264 0.0 sec 191: 20937 of 22139 5.4% 6250.20/s -20-Dec 15:04:07 test263 0.5 sec 28: 20909 of 22139 5.6% 55.15/s -20-Dec 15:04:07 test262 0.0 sec 88: 20821 of 22139 6.0% 2977.80/s -20-Dec 15:04:08 test261 0.0 sec 29: 20792 of 22139 6.1% 1038.87/s -20-Dec 15:04:08 test260 0.0 sec 3: 20789 of 22139 6.1% 109.13/s -20-Dec 15:04:09 test259 1.4 sec 4: 20785 of 22139 6.1% 2.92/s -20-Dec 15:04:09 test258 0.2 sec 22: 20763 of 22139 6.2% 119.89/s -20-Dec 15:04:09 test257 0.1 sec 65: 20698 of 22139 6.5% 483.56/s -20-Dec 15:04:09 test255 0.0 sec 8: 20690 of 22139 6.5% 276.49/s -20-Dec 15:04:09 test254 0.1 sec 29: 20661 of 22139 6.7% 472.83/s -20-Dec 15:04:12 test254 2.8 sec 20: 20641 of 22139 6.8% 7.24/s -20-Dec 15:04:12 test254 0.1 sec 1: 20640 of 22139 6.8% 12.91/s -20-Dec 15:04:12 test253 0.1 sec 27: 20613 of 22139 6.9% 293.58/s -20-Dec 15:04:12 test252 0.0 sec 11: 20602 of 22139 6.9% 388.75/s -20-Dec 15:05:01 test251 48.9 sec 490: 20112 of 22139 9.2% 10.02/s -20-Dec 15:07:15 test251 134.2 sec 12: 20100 of 22139 9.2% 0.09/s -20-Dec 15:09:08 test251 112.2 sec 78: 20022 of 22139 9.6% 0.70/s -20-Dec 15:09:09 test250 1.5 sec 169: 19853 of 22139 10.3% 111.77/s -20-Dec 15:09:11 test250 1.8 sec 13: 19840 of 22139 10.4% 7.31/s -20-Dec 15:09:12 test249 1.0 sec 29: 19811 of 22139 10.5% 30.35/s -20-Dec 15:09:12 test247 0.0 sec 24: 19787 of 22139 10.6% 931.75/s -20-Dec 15:09:23 test246 11.3 sec 74: 19713 of 22139 11.0% 6.57/s -20-Dec 15:09:33 test01 10.0 sec 1451: 18262 of 22139 17.5% 145.31/s -20-Dec 15:09:42 test01 8.3 sec 22: 18240 of 22139 17.6% 2.65/s -20-Dec 15:09:42 test245 0.5 sec 34: 18206 of 22139 17.8% 63.46/s -20-Dec 15:09:42 test245 0.0 sec 8: 18198 of 22139 17.8% 234.28/s -20-Dec 15:09:42 test199 0.0 sec 1: 18197 of 22139 17.8% 132.47/s -20-Dec 15:09:42 test83 0.0 sec 15: 18182 of 22139 17.9% 518.62/s -20-Dec 15:09:42 test210 0.0 sec 9: 18173 of 22139 17.9% 2435.72/s -20-Dec 15:09:42 test165 0.0 sec 1: 18172 of 22139 17.9% 199.68/s -20-Dec 15:09:42 test219 0.0 sec 9: 18163 of 22139 18.0% 267.86/s -20-Dec 15:09:43 test219 0.2 sec 3: 18160 of 22139 18.0% 18.83/s -20-Dec 15:09:43 test241 0.1 sec 10: 18150 of 22139 18.0% 127.59/s -20-Dec 15:09:43 test220 0.1 sec 15: 18135 of 22139 18.1% 269.60/s -20-Dec 15:09:43 test211 0.0 sec 15: 18120 of 22139 18.2% 479.72/s -20-Dec 15:09:43 test202 0.1 sec 83: 18037 of 22139 18.5% 1230.91/s -20-Dec 15:09:43 test202 0.0 sec 1: 18036 of 22139 18.5% 25.49/s -20-Dec 15:09:45 test152 2.2 sec 827: 17209 of 22139 22.3% 370.28/s -20-Dec 15:09:49 test152 3.5 sec 13: 17196 of 22139 22.3% 3.75/s -20-Dec 15:10:30 test152 41.6 sec 245: 16951 of 22139 23.4% 5.90/s -20-Dec 15:10:30 test222 0.1 sec 18: 16933 of 22139 23.5% 269.88/s -20-Dec 15:10:31 test256 0.2 sec 50: 16883 of 22139 23.7% 318.93/s -20-Dec 15:10:32 test186 1.6 sec 42: 16841 of 22139 23.9% 25.93/s -20-Dec 15:10:33 test186 0.4 sec 1: 16840 of 22139 23.9% 2.69/s -20-Dec 15:10:33 test186(0) 0.3 sec 5: 16835 of 22139 24.0% 14.39/s -20-Dec 15:10:40 test150 7.4 sec 39: 16796 of 22139 24.1% 5.27/s -20-Dec 15:10:41 test150 0.1 sec 4: 16792 of 22139 24.2% 26.71/s -20-Dec 15:10:41 test239 0.1 sec 15: 16777 of 22139 24.2% 279.38/s -20-Dec 15:10:41 test239 0.6 sec 2: 16775 of 22139 24.2% 3.40/s -20-Dec 15:10:41 test235 0.0 sec 4: 16771 of 22139 24.2% 116.91/s -20-Dec 15:10:41 test226 0.0 sec 8: 16763 of 22139 24.3% 666.44/s -20-Dec 15:10:41 test223 0.0 sec 2: 16761 of 22139 24.3% 89.78/s -20-Dec 15:10:41 test204 0.1 sec 14: 16747 of 22139 24.4% 260.89/s -20-Dec 15:10:41 test203 0.0 sec 19: 16728 of 22139 24.4% 567.57/s -20-Dec 15:10:41 test183 0.0 sec 12: 16716 of 22139 24.5% 517.09/s -20-Dec 15:10:42 test179 0.1 sec 15: 16701 of 22139 24.6% 194.09/s -20-Dec 15:10:43 test179 1.1 sec 4: 16697 of 22139 24.6% 3.69/s -20-Dec 15:10:43 test174 0.1 sec 10: 16687 of 22139 24.6% 176.36/s -20-Dec 15:10:43 test155 0.1 sec 44: 16643 of 22139 24.8% 524.15/s -20-Dec 15:10:43 test156 0.5 sec 225: 16418 of 22139 25.8% 457.60/s -20-Dec 15:11:09 test156 25.7 sec 37: 16381 of 22139 26.0% 1.44/s -20-Dec 15:11:09 test136 0.1 sec 57: 16324 of 22139 26.3% 598.43/s -20-Dec 15:11:10 test02 0.4 sec 22: 16302 of 22139 26.4% 54.69/s -20-Dec 15:11:10 test109 0.3 sec 10: 16292 of 22139 26.4% 32.05/s -20-Dec 15:11:10 test109 0.0 sec 4: 16288 of 22139 26.4% 833.51/s -20-Dec 15:11:10 test109 0.2 sec 8: 16280 of 22139 26.5% 35.34/s -20-Dec 15:11:10 test04 0.1 sec 15: 16265 of 22139 26.5% 237.41/s -20-Dec 15:11:10 test207 0.0 sec 2: 16263 of 22139 26.5% 395.10/s -20-Dec 15:11:10 test221 0.0 sec 2: 16261 of 22139 26.6% 262.33/s -20-Dec 15:11:10 test162 0.0 sec 5: 16256 of 22139 26.6% 101.45/s -20-Dec 15:11:46 test159 35.6 sec 80: 16176 of 22139 26.9% 2.25/s -20-Dec 15:11:48 test159 1.9 sec 55: 16121 of 22139 27.2% 28.64/s -20-Dec 15:11:48 test09 0.0 sec 5: 16116 of 22139 27.2% 353.31/s -20-Dec 15:11:48 test132 0.0 sec 8: 16108 of 22139 27.2% 162.96/s -20-Dec 15:12:13 test141 24.6 sec 476: 15632 of 22139 29.4% 19.35/s -20-Dec 15:12:23 test141 9.8 sec 77: 15555 of 22139 29.7% 7.83/s -20-Dec 15:15:18 test141 175.3 sec 2: 15553 of 22139 29.7% 0.01/s -20-Dec 15:15:19 testc2(1,1) 0.8 sec 20: 15533 of 22139 29.8% 25.86/s -20-Dec 15:15:23 testc2(1,1) 3.6 sec 4: 15529 of 22139 29.9% 1.11/s -20-Dec 15:15:23 test214 0.0 sec 3: 15526 of 22139 29.9% 306.81/s -20-Dec 15:15:23 test213 0.0 sec 2: 15524 of 22139 29.9% 179.99/s -20-Dec 15:15:25 test206 1.8 sec 219: 15305 of 22139 30.9% 122.91/s -20-Dec 15:15:32 test206 7.7 sec 8: 15297 of 22139 30.9% 1.04/s -20-Dec 15:15:33 test212 0.0 sec 9: 15288 of 22139 30.9% 386.27/s -20-Dec 15:15:33 test212 0.1 sec 2: 15286 of 22139 31.0% 17.84/s -20-Dec 15:15:33 test128 0.3 sec 49: 15237 of 22139 31.2% 191.92/s -20-Dec 15:15:33 test82 0.1 sec 18: 15219 of 22139 31.3% 242.12/s -20-Dec 15:15:35 test229 2.1 sec 9: 15210 of 22139 31.3% 4.28/s -20-Dec 15:15:36 test229 1.1 sec 1: 15209 of 22139 31.3% 0.91/s -20-Dec 15:15:37 test144 0.5 sec 2: 15207 of 22139 31.3% 3.72/s -20-Dec 15:16:26 test14 49.5 sec 664: 14543 of 22139 34.3% 13.41/s -20-Dec 15:16:50 test14 23.2 sec 2: 14541 of 22139 34.3% 0.09/s -20-Dec 15:19:19 test14 149.2 sec 117: 14424 of 22139 34.8% 0.78/s -20-Dec 15:19:25 test180 5.7 sec 134: 14290 of 22139 35.5% 23.70/s -20-Dec 15:19:28 test236 3.2 sec 74: 14216 of 22139 35.8% 23.23/s -20-Dec 15:19:30 test232 2.3 sec 20: 14196 of 22139 35.9% 8.51/s -20-Dec 15:19:45 test228 14.3 sec 28: 14168 of 22139 36.0% 1.96/s -20-Dec 15:21:05 test154 80.1 sec 1502: 12666 of 22139 42.8% 18.76/s -20-Dec 15:25:50 test154 284.7 sec 2: 12664 of 22139 42.8% 0.01/s -20-Dec 15:25:57 test238 7.7 sec 50: 12614 of 22139 43.0% 6.46/s -20-Dec 15:26:36 test238 38.9 sec 2: 12612 of 22139 43.0% 0.05/s -20-Dec 15:27:39 test151b 62.8 sec 173: 12439 of 22139 43.8% 2.76/s -20-Dec 15:28:58 test151b 78.6 sec 1: 12438 of 22139 43.8% 0.01/s -20-Dec 15:33:28 test151b 270.6 sec 1: 12437 of 22139 43.8% 0.00/s -20-Dec 15:33:32 test184 3.2 sec 38: 12399 of 22139 44.0% 11.83/s -20-Dec 15:33:42 test191 10.2 sec 21: 12378 of 22139 44.1% 2.05/s -20-Dec 15:34:04 test191 21.2 sec 3: 12375 of 22139 44.1% 0.14/s -20-Dec 15:38:43 test188 279.3 sec 183: 12192 of 22139 44.9% 0.66/s -20-Dec 15:40:37 test188 113.4 sec 3: 12189 of 22139 44.9% 0.03/s -20-Dec 15:40:41 test224 3.6 sec 24: 12165 of 22139 45.1% 6.62/s -20-Dec 15:40:43 test196 2.3 sec 11: 12154 of 22139 45.1% 4.72/s -20-Dec 15:40:47 test209 4.4 sec 20: 12134 of 22139 45.2% 4.54/s -20-Dec 15:41:01 test104 13.2 sec 40: 12094 of 22139 45.4% 3.04/s -20-Dec 15:41:10 test189 9.2 sec 1: 12093 of 22139 45.4% 0.11/s -20-Dec 15:42:02 test194 52.6 sec 5: 12088 of 22139 45.4% 0.10/s -20-Dec 15:42:12 test76 10.0 sec 15: 12073 of 22139 45.5% 1.51/s -20-Dec 15:42:45 test244 32.3 sec 17: 12056 of 22139 45.5% 0.53/s -[malloc debugging turned off] -20-Dec 15:42:45 test201 0.0 sec 3: 12053 of 22139 45.6% 373.46/s -20-Dec 15:42:45 test225 0.1 sec 4: 12049 of 22139 45.6% 34.44/s -20-Dec 15:42:45 test176 0.1 sec 5: 12044 of 22139 45.6% 87.49/s -20-Dec 15:42:45 test208 0.0 sec 5: 12039 of 22139 45.6% 355.47/s -20-Dec 15:42:45 test216 0.0 sec 3: 12036 of 22139 45.6% 74.09/s -20-Dec 15:43:32 test142 47.4 sec 630: 11406 of 22139 48.5% 13.29/s -20-Dec 15:43:51 test142 18.2 sec 2: 11404 of 22139 48.5% 0.11/s -20-Dec 15:46:01 test142 130.7 sec 2: 11402 of 22139 48.5% 0.02/s -20-Dec 15:46:20 test142 17.9 sec 2: 11400 of 22139 48.5% 0.11/s -20-Dec 15:46:20 test137 0.2 sec 3: 11397 of 22139 48.5% 14.77/s -20-Dec 15:46:20 test137 0.0 sec 2: 11395 of 22139 48.5% 357.14/s -20-Dec 15:46:20 test139 0.3 sec 2: 11393 of 22139 48.5% 6.66/s -20-Dec 15:46:20 test172 0.1 sec 3: 11390 of 22139 48.6% 48.03/s -20-Dec 15:46:21 test148 0.4 sec 4: 11386 of 22139 48.6% 10.26/s -20-Dec 15:46:21 test157 0.4 sec 12: 11374 of 22139 48.6% 27.17/s -20-Dec 15:46:22 test182 0.7 sec 8: 11366 of 22139 48.7% 11.21/s -20-Dec 15:46:22 test108 0.3 sec 2: 11364 of 22139 48.7% 5.92/s -20-Dec 15:46:23 test108 0.3 sec 1: 11363 of 22139 48.7% 3.11/s -20-Dec 15:46:23 test130 0.6 sec 26: 11337 of 22139 48.8% 46.69/s -20-Dec 15:46:23 test124 0.1 sec 3: 11334 of 22139 48.8% 25.50/s -20-Dec 15:46:23 test138 0.1 sec 1: 11333 of 22139 48.8% 18.60/s -20-Dec 15:46:27 test227 3.2 sec 27: 11306 of 22139 48.9% 8.53/s -20-Dec 15:46:46 test125 19.3 sec 630: 10676 of 22139 51.8% 32.71/s -20-Dec 15:48:19 test234 93.2 sec 396: 10280 of 22139 53.6% 4.25/s -20-Dec 15:51:12 test234 172.9 sec 2: 10278 of 22139 53.6% 0.01/s -20-Dec 15:51:42 test242 30.2 sec 77: 10201 of 22139 53.9% 2.55/s -20-Dec 15:51:43 test173 1.1 sec 11: 10190 of 22139 54.0% 9.80/s -20-Dec 15:51:45 test200 1.9 sec 10: 10180 of 22139 54.0% 5.22/s -20-Dec 15:51:45 test197 0.1 sec 1: 10179 of 22139 54.0% 8.39/s -20-Dec 15:51:46 test84 0.9 sec 18: 10161 of 22139 54.1% 20.71/s -20-Dec 15:51:54 test19b 8.0 sec 58: 10103 of 22139 54.4% 7.24/s -20-Dec 15:51:58 test19b 3.9 sec 5: 10098 of 22139 54.4% 1.28/s -20-Dec 15:51:59 test133 0.3 sec 2: 10096 of 22139 54.4% 7.44/s -20-Dec 15:52:02 test80 3.3 sec 12: 10084 of 22139 54.5% 3.59/s -20-Dec 15:52:13 test151 11.3 sec 73: 10011 of 22139 54.8% 6.45/s -20-Dec 15:53:04 test151 50.5 sec 2: 10009 of 22139 54.8% 0.04/s -20-Dec 15:53:53 test23 49.1 sec 146: 9863 of 22139 55.4% 2.98/s -20-Dec 15:54:38 test23 45.3 sec 2: 9861 of 22139 55.5% 0.04/s -20-Dec 15:54:40 test135 1.4 sec 7: 9854 of 22139 55.5% 5.18/s -20-Dec 15:55:39 test160 59.8 sec 23: 9831 of 22139 55.6% 0.38/s -20-Dec 15:56:38 test160 58.6 sec 1: 9830 of 22139 55.6% 0.02/s -20-Dec 15:56:42 test54 3.8 sec 20: 9810 of 22139 55.7% 5.21/s -20-Dec 15:56:43 test129 0.8 sec 4: 9806 of 22139 55.7% 5.04/s -20-Dec 15:56:44 test69 1.5 sec 3: 9803 of 22139 55.7% 2.00/s -20-Dec 15:57:41 test230 56.3 sec 114: 9689 of 22139 56.2% 2.02/s -20-Dec 16:46:28 test74 2927.9 sec 6588: 3101 of 22139 86.0% 2.25/s -20-Dec 17:09:03 test74 1354.1 sec 7: 3094 of 22139 86.0% 0.01/s -20-Dec 17:12:49 test127 226.0 sec 1633: 1461 of 22139 93.4% 7.23/s -20-Dec 17:21:30 test127 521.0 sec 18: 1443 of 22139 93.5% 0.03/s -20-Dec 18:08:28 test127 2818.0 sec 2: 1441 of 22139 93.5% 0.00/s -20-Dec 18:09:24 test19 1.8 sec 12: 1429 of 22139 93.5% 6.57/s -20-Dec 18:09:26 test11 2.3 sec 3: 1426 of 22139 93.6% 1.31/s -20-Dec 18:09:29 test215 2.3 sec 1: 1425 of 22139 93.6% 0.43/s -20-Dec 18:09:40 test193 10.8 sec 5: 1420 of 22139 93.6% 0.46/s -20-Dec 18:11:31 test195 111.9 sec 39: 1381 of 22139 93.8% 0.35/s -20-Dec 18:11:46 test243 14.5 sec 7: 1374 of 22139 93.8% 0.48/s -20-Dec 18:11:55 test29 8.7 sec 1: 1373 of 22139 93.8% 0.11/s -20-Dec 18:12:03 test29 8.0 sec 2: 1371 of 22139 93.8% 0.25/s -20-Dec 18:12:14 testc2(0,0) 11.2 sec 2: 1369 of 22139 93.8% 0.18/s -20-Dec 18:12:15 testc2(0,0) 0.9 sec 6: 1363 of 22139 93.8% 6.51/s -20-Dec 18:12:16 testc2(0,0) 1.0 sec 1: 1362 of 22139 93.8% 0.99/s -20-Dec 18:12:16 testc4(0) 0.4 sec 4: 1358 of 22139 93.9% 10.43/s -20-Dec 18:12:28 testc7(0) 12.0 sec 1: 1357 of 22139 93.9% 0.08/s -20-Dec 18:12:32 testcc(1) 4.1 sec 1: 1356 of 22139 93.9% 0.24/s -20-Dec 18:12:38 test187 5.9 sec 3: 1353 of 22139 93.9% 0.51/s -20-Dec 18:12:42 test192 3.5 sec 1: 1352 of 22139 93.9% 0.28/s -20-Dec 18:12:51 test181 9.2 sec 10: 1342 of 22139 93.9% 1.08/s -20-Dec 18:14:07 test185 76.2 sec 6: 1336 of 22139 94.0% 0.08/s -20-Dec 18:14:35 test53 27.8 sec 4: 1332 of 22139 94.0% 0.14/s -20-Dec 18:15:07 test17 31.4 sec 28: 1304 of 22139 94.1% 0.89/s -20-Dec 18:19:23 test231 256.3 sec 162: 1142 of 22139 94.8% 0.63/s -20-Dec 18:56:19 test10 2216.5 sec 946: 196 of 22139 99.1% 0.43/s -20-Dec 19:01:07 test75b 256.6 sec 151: 45 of 22139 99.8% 0.59/s -20-Dec 19:02:09 test21b 61.0 sec 26: 19 of 22139 99.9% 0.43/s -20-Dec 19:02:52 testca(1) 42.9 sec 5: 14 of 22139 99.9% 0.12/s -20-Dec 19:04:19 test81 87.2 sec 1: 13 of 22139 99.9% 0.01/s -20-Dec 19:08:04 test18 225.0 sec 13: all 22139 full 100% 0.06/s -[malloc debugging turned back on] diff --git a/GraphBLAS/Tcov/log_Dec26.txt b/GraphBLAS/Tcov/log_Dec26.txt new file mode 100644 index 0000000000..3ea2d21c98 --- /dev/null +++ b/GraphBLAS/Tcov/log_Dec26.txt @@ -0,0 +1,204 @@ + +---------------------------------------------- [malloc] [cover] +25-Dec 22:05:04 test250 1.6 sec 415: 24525 of 25102 2.3% 262.33/s +25-Dec 22:05:06 test250 2.0 sec 57: 24468 of 25102 2.5% 29.06/s +25-Dec 22:05:06 test279 0.0 sec 130: 24338 of 25102 3.0% 4854.91/s +25-Dec 22:05:06 test278 0.0 sec 49: 24289 of 25102 3.2% 1855.29/s +25-Dec 22:05:06 test277 0.0 sec 38: 24251 of 25102 3.4% 1398.14/s +25-Dec 22:05:06 test276 0.0 sec 1626: 22625 of 25102 9.9% 57072.66/s +25-Dec 22:05:06 test275 0.0 sec 117: 22508 of 25102 10.3% 4238.98/s +25-Dec 22:05:06 test274 0.0 sec 129: 22379 of 25102 10.8% 4635.62/s +25-Dec 22:05:06 test273 0.1 sec 110: 22269 of 25102 11.3% 1005.27/s +25-Dec 22:05:06 test272 0.0 sec 11: 22258 of 25102 11.3% 401.34/s +25-Dec 22:05:06 test271 0.0 sec 497: 21761 of 25102 13.3% 17291.77/s +25-Dec 22:05:07 test270 0.0 sec 286: 21475 of 25102 14.4% 10366.45/s +25-Dec 22:05:07 test269 0.0 sec 87: 21388 of 25102 14.8% 3014.14/s +25-Dec 22:05:07 test268 0.1 sec 102: 21286 of 25102 15.2% 1401.56/s +25-Dec 22:05:08 test145 1.2 sec 221: 21065 of 25102 16.1% 181.83/s +25-Dec 22:05:08 test145 0.0 sec 1: 21064 of 25102 16.1% 24.27/s +25-Dec 22:05:08 test145 0.0 sec 18: 21046 of 25102 16.2% 650.10/s +25-Dec 22:05:08 test145 0.0 sec 4: 21042 of 25102 16.2% 214.52/s +25-Dec 22:05:09 test145 0.9 sec 34: 21008 of 25102 16.3% 37.36/s +25-Dec 22:05:09 test145 0.0 sec 3: 21005 of 25102 16.3% 241.99/s +25-Dec 22:05:10 test240 0.4 sec 80: 20922 of 25102 16.7% 184.46/s +25-Dec 22:05:10 test240 0.2 sec 1: 20921 of 25102 16.7% 4.40/s +25-Dec 22:05:10 test237 0.4 sec 42: 20879 of 25102 16.8% 93.91/s +25-Dec 22:05:12 test237 1.3 sec 2: 20877 of 25102 16.8% 1.57/s +25-Dec 22:05:12 test237 0.1 sec 18: 20859 of 25102 16.9% 196.77/s +25-Dec 22:05:12 test237 0.0 sec 6: 20853 of 25102 16.9% 252.33/s +25-Dec 22:05:12 test237 0.1 sec 4: 20849 of 25102 16.9% 49.92/s +25-Dec 22:05:12 test267 0.4 sec 8: 20841 of 25102 17.0% 18.56/s +25-Dec 22:05:13 test267 0.0 sec 1: 20840 of 25102 17.0% 1169.59/s +25-Dec 22:05:13 test265 0.3 sec 36: 20804 of 25102 17.1% 138.19/s +25-Dec 22:05:13 test264 0.0 sec 173: 20631 of 25102 17.8% 5330.62/s +25-Dec 22:05:14 test263 0.5 sec 16: 20615 of 25102 17.9% 32.99/s +25-Dec 22:05:14 test262 0.0 sec 76: 20539 of 25102 18.2% 2400.20/s +25-Dec 22:05:14 test261 0.0 sec 22: 20517 of 25102 18.3% 741.21/s +25-Dec 22:05:14 test260 0.0 sec 3: 20514 of 25102 18.3% 99.23/s +25-Dec 22:05:15 test259 1.2 sec 4: 20510 of 25102 18.3% 3.31/s +25-Dec 22:05:15 test258 0.2 sec 20: 20490 of 25102 18.4% 132.49/s +25-Dec 22:05:15 test257 0.1 sec 54: 20436 of 25102 18.6% 395.22/s +25-Dec 22:05:16 test255 0.0 sec 8: 20428 of 25102 18.6% 278.66/s +25-Dec 22:05:16 test254 0.1 sec 29: 20399 of 25102 18.7% 402.61/s +25-Dec 22:05:18 test254 2.5 sec 20: 20379 of 25102 18.8% 8.06/s +25-Dec 22:05:18 test254 0.1 sec 1: 20378 of 25102 18.8% 12.78/s +25-Dec 22:05:19 test253 0.1 sec 8: 20370 of 25102 18.9% 66.69/s +25-Dec 22:05:19 test252 0.0 sec 7: 20363 of 25102 18.9% 231.52/s +25-Dec 22:06:13 test251 54.5 sec 472: 19891 of 25102 20.8% 8.67/s +25-Dec 22:07:54 test251 100.9 sec 76: 19815 of 25102 21.1% 0.75/s +25-Dec 22:07:56 test249 1.1 sec 27: 19788 of 25102 21.2% 25.71/s +25-Dec 22:07:56 test247 0.0 sec 24: 19764 of 25102 21.3% 777.60/s +25-Dec 22:08:07 test246 11.4 sec 72: 19692 of 25102 21.6% 6.33/s +25-Dec 22:08:17 test01 10.1 sec 1420: 18272 of 25102 27.2% 141.06/s +25-Dec 22:08:18 test245 0.5 sec 34: 18238 of 25102 27.3% 62.10/s +25-Dec 22:08:18 test245 0.0 sec 8: 18230 of 25102 27.4% 223.04/s +25-Dec 22:08:18 test199 0.0 sec 1: 18229 of 25102 27.4% 150.47/s +25-Dec 22:08:18 test83 0.0 sec 15: 18214 of 25102 27.4% 494.41/s +25-Dec 22:08:18 test210 0.0 sec 9: 18205 of 25102 27.5% 2196.73/s +25-Dec 22:08:19 test165 0.0 sec 1: 18204 of 25102 27.5% 169.03/s +25-Dec 22:08:19 test219 0.0 sec 9: 18195 of 25102 27.5% 228.10/s +25-Dec 22:08:19 test219 0.1 sec 3: 18192 of 25102 27.5% 26.15/s +25-Dec 22:08:19 test241 0.1 sec 10: 18182 of 25102 27.6% 111.27/s +25-Dec 22:08:19 test220 0.1 sec 15: 18167 of 25102 27.6% 245.30/s +25-Dec 22:08:19 test211 0.0 sec 15: 18152 of 25102 27.7% 469.66/s +25-Dec 22:08:20 test202 0.1 sec 83: 18069 of 25102 28.0% 1164.55/s +25-Dec 22:08:20 test202 0.0 sec 1: 18068 of 25102 28.0% 20.52/s +25-Dec 22:08:23 test152 2.7 sec 827: 17241 of 25102 31.3% 307.17/s +25-Dec 22:08:27 test152 3.9 sec 13: 17228 of 25102 31.4% 3.34/s +25-Dec 22:09:11 test152 43.8 sec 245: 16983 of 25102 32.3% 5.60/s +25-Dec 22:09:11 test222 0.1 sec 18: 16965 of 25102 32.4% 264.18/s +25-Dec 22:09:11 test256 0.2 sec 58: 16907 of 25102 32.6% 240.95/s +25-Dec 22:09:12 test186 1.0 sec 44: 16863 of 25102 32.8% 43.27/s +25-Dec 22:09:13 test186 0.4 sec 3: 16860 of 25102 32.8% 8.14/s +25-Dec 22:09:13 test186(0) 0.4 sec 5: 16855 of 25102 32.9% 14.28/s +25-Dec 22:09:14 test150 0.2 sec 44: 16811 of 25102 33.0% 210.99/s +25-Dec 22:09:14 test239 0.1 sec 15: 16796 of 25102 33.1% 244.13/s +25-Dec 22:09:15 test239 0.4 sec 2: 16794 of 25102 33.1% 5.41/s +25-Dec 22:09:15 test235 0.0 sec 4: 16790 of 25102 33.1% 112.86/s +25-Dec 22:09:15 test226 0.0 sec 8: 16782 of 25102 33.1% 689.89/s +25-Dec 22:09:15 test223 0.0 sec 2: 16780 of 25102 33.2% 83.48/s +25-Dec 22:09:15 test204 0.1 sec 14: 16766 of 25102 33.2% 255.55/s +25-Dec 22:09:15 test203 0.0 sec 19: 16747 of 25102 33.3% 531.65/s +25-Dec 22:09:16 test183 0.0 sec 12: 16735 of 25102 33.3% 490.96/s +25-Dec 22:09:16 test179 0.1 sec 15: 16720 of 25102 33.4% 187.87/s +25-Dec 22:09:17 test179 1.1 sec 4: 16716 of 25102 33.4% 3.79/s +25-Dec 22:09:17 test174 0.1 sec 10: 16706 of 25102 33.4% 182.44/s +25-Dec 22:09:18 test155 0.1 sec 43: 16663 of 25102 33.6% 521.26/s +25-Dec 22:09:18 test136 0.1 sec 57: 16606 of 25102 33.8% 561.72/s +25-Dec 22:09:18 test02 0.4 sec 247: 16359 of 25102 34.8% 563.73/s +25-Dec 22:09:19 test109 0.2 sec 10: 16349 of 25102 34.9% 55.68/s +25-Dec 22:09:19 test109 0.0 sec 4: 16345 of 25102 34.9% 1203.01/s +25-Dec 22:09:19 test109 0.1 sec 8: 16337 of 25102 34.9% 69.79/s +25-Dec 22:09:20 test04 0.1 sec 15: 16322 of 25102 35.0% 233.25/s +25-Dec 22:09:20 test207 0.0 sec 2: 16320 of 25102 35.0% 422.30/s +25-Dec 22:09:20 test221 0.0 sec 2: 16318 of 25102 35.0% 297.53/s +25-Dec 22:09:20 test162 0.1 sec 5: 16313 of 25102 35.0% 97.09/s +25-Dec 22:09:23 test159 2.4 sec 72: 16241 of 25102 35.3% 29.45/s +25-Dec 22:09:23 test09 0.0 sec 5: 16236 of 25102 35.3% 402.51/s +25-Dec 22:09:23 test132 0.1 sec 8: 16228 of 25102 35.4% 156.46/s +25-Dec 22:09:35 test141 11.3 sec 551: 15677 of 25102 37.5% 48.92/s +25-Dec 22:09:36 testc2(1,1) 1.0 sec 20: 15657 of 25102 37.6% 20.64/s +25-Dec 22:09:40 testc2(1,1) 3.3 sec 4: 15653 of 25102 37.6% 1.22/s +25-Dec 22:09:40 test214 0.0 sec 3: 15650 of 25102 37.7% 331.16/s +25-Dec 22:09:40 test213 0.0 sec 2: 15648 of 25102 37.7% 178.40/s +25-Dec 22:09:42 test206 2.1 sec 221: 15427 of 25102 38.5% 107.07/s +25-Dec 22:09:52 test206 9.5 sec 24: 15403 of 25102 38.6% 2.53/s +25-Dec 22:09:52 test212 0.0 sec 9: 15394 of 25102 38.7% 373.03/s +25-Dec 22:09:53 test212 0.1 sec 2: 15392 of 25102 38.7% 16.90/s +25-Dec 22:09:53 test128 0.3 sec 49: 15343 of 25102 38.9% 195.01/s +25-Dec 22:09:54 test82 0.1 sec 18: 15325 of 25102 38.9% 246.30/s +25-Dec 22:09:56 test229 1.8 sec 9: 15316 of 25102 39.0% 4.99/s +25-Dec 22:09:57 test229 1.1 sec 1: 15315 of 25102 39.0% 0.92/s +25-Dec 22:09:58 test144 0.5 sec 2: 15313 of 25102 39.0% 4.08/s +25-Dec 22:10:38 test14 40.3 sec 671: 14642 of 25102 41.7% 16.64/s +25-Dec 22:12:34 test14 114.9 sec 118: 14524 of 25102 42.1% 1.03/s +25-Dec 22:12:40 test180 6.0 sec 136: 14388 of 25102 42.7% 22.80/s +25-Dec 22:12:44 test236 3.4 sec 74: 14314 of 25102 43.0% 21.74/s +25-Dec 22:12:47 test232 2.5 sec 22: 14292 of 25102 43.1% 8.73/s +25-Dec 22:13:02 test228 15.5 sec 27: 14265 of 25102 43.2% 1.75/s +25-Dec 22:14:35 test154 92.1 sec 1502: 12763 of 25102 49.2% 16.31/s +25-Dec 22:19:32 test154 296.9 sec 2: 12761 of 25102 49.2% 0.01/s +25-Dec 22:19:42 test238 9.7 sec 54: 12707 of 25102 49.4% 5.54/s +25-Dec 22:20:19 test238 36.2 sec 9: 12698 of 25102 49.4% 0.25/s +25-Dec 22:21:09 test151b 50.3 sec 174: 12524 of 25102 50.1% 3.46/s +25-Dec 22:21:13 test184 3.1 sec 38: 12486 of 25102 50.3% 12.22/s +25-Dec 22:21:24 test191 10.6 sec 21: 12465 of 25102 50.3% 1.98/s +25-Dec 22:21:47 test191 23.4 sec 3: 12462 of 25102 50.4% 0.13/s +25-Dec 22:26:14 test188 266.6 sec 212: 12250 of 25102 51.2% 0.80/s +25-Dec 22:28:07 test188 111.8 sec 3: 12247 of 25102 51.2% 0.03/s +25-Dec 22:28:11 test224 3.8 sec 24: 12223 of 25102 51.3% 6.26/s +25-Dec 22:28:13 test196 2.2 sec 11: 12212 of 25102 51.4% 5.10/s +25-Dec 22:28:18 test209 4.6 sec 20: 12192 of 25102 51.4% 4.37/s +25-Dec 22:28:33 test104 14.0 sec 40: 12152 of 25102 51.6% 2.86/s +25-Dec 22:28:42 test189 9.1 sec 1: 12151 of 25102 51.6% 0.11/s +25-Dec 22:29:37 test194 54.7 sec 5: 12146 of 25102 51.6% 0.09/s +25-Dec 22:29:48 test76 10.1 sec 15: 12131 of 25102 51.7% 1.49/s +25-Dec 22:30:21 test244 33.0 sec 17: 12114 of 25102 51.7% 0.52/s +[malloc debugging turned off] +25-Dec 22:30:21 test201 0.0 sec 3: 12111 of 25102 51.8% 436.17/s +25-Dec 22:30:22 test225 0.1 sec 4: 12107 of 25102 51.8% 41.12/s +25-Dec 22:30:22 test176 0.0 sec 5: 12102 of 25102 51.8% 100.80/s +25-Dec 22:30:22 test208 0.0 sec 5: 12097 of 25102 51.8% 376.59/s +25-Dec 22:30:23 test216 0.0 sec 3: 12094 of 25102 51.8% 79.96/s +25-Dec 22:30:42 test142 18.4 sec 631: 11463 of 25102 54.3% 34.22/s +25-Dec 22:33:24 test142 162.0 sec 10: 11453 of 25102 54.4% 0.06/s +25-Dec 22:33:43 test142 17.9 sec 2: 11451 of 25102 54.4% 0.11/s +25-Dec 22:33:43 test137 0.2 sec 3: 11448 of 25102 54.4% 17.28/s +25-Dec 22:33:43 test137 0.0 sec 2: 11446 of 25102 54.4% 347.71/s +25-Dec 22:33:44 test139 0.3 sec 2: 11444 of 25102 54.4% 7.29/s +25-Dec 22:33:44 test172 0.1 sec 3: 11441 of 25102 54.4% 55.13/s +25-Dec 22:33:45 test148 0.4 sec 4: 11437 of 25102 54.4% 10.60/s +25-Dec 22:33:46 test157 0.5 sec 12: 11425 of 25102 54.5% 26.55/s +25-Dec 22:33:47 test182 0.7 sec 8: 11417 of 25102 54.5% 12.02/s +25-Dec 22:33:48 test108 0.3 sec 2: 11415 of 25102 54.5% 6.64/s +25-Dec 22:33:49 test108 0.3 sec 2: 11413 of 25102 54.5% 6.21/s +25-Dec 22:33:50 test130 0.6 sec 25: 11388 of 25102 54.6% 39.39/s +25-Dec 22:33:50 test124 0.1 sec 3: 11385 of 25102 54.6% 29.57/s +25-Dec 22:33:51 test138 0.0 sec 1: 11384 of 25102 54.6% 22.87/s +25-Dec 22:33:54 test227 3.4 sec 27: 11357 of 25102 54.8% 7.96/s +25-Dec 22:34:16 test125 20.8 sec 630: 10727 of 25102 57.3% 30.31/s +25-Dec 22:35:38 test234 81.9 sec 397: 10330 of 25102 58.8% 4.85/s +25-Dec 22:38:32 test234 173.4 sec 3: 10327 of 25102 58.9% 0.02/s +25-Dec 22:39:06 test242 33.5 sec 77: 10250 of 25102 59.2% 2.30/s +25-Dec 22:39:07 test173 1.2 sec 12: 10238 of 25102 59.2% 10.41/s +25-Dec 22:39:10 test200 2.1 sec 10: 10228 of 25102 59.3% 4.81/s +25-Dec 22:39:10 test197 0.1 sec 1: 10227 of 25102 59.3% 9.45/s +25-Dec 22:39:12 test84 0.9 sec 18: 10209 of 25102 59.3% 19.85/s +25-Dec 22:39:17 test19b 4.3 sec 59: 10150 of 25102 59.6% 13.73/s +25-Dec 22:39:17 test133 0.2 sec 2: 10148 of 25102 59.6% 8.14/s +25-Dec 22:39:21 test80 3.2 sec 12: 10136 of 25102 59.6% 3.77/s +25-Dec 22:40:09 test23 47.6 sec 148: 9988 of 25102 60.2% 3.11/s +25-Dec 22:40:11 test135 1.4 sec 7: 9981 of 25102 60.2% 5.01/s +25-Dec 22:41:11 test160 60.0 sec 24: 9957 of 25102 60.3% 0.40/s +25-Dec 22:41:15 test54 3.5 sec 20: 9937 of 25102 60.4% 5.73/s +25-Dec 22:41:17 test129 0.8 sec 4: 9933 of 25102 60.4% 4.73/s +25-Dec 22:41:18 test69 1.5 sec 6: 9927 of 25102 60.5% 4.05/s +25-Dec 22:42:24 test230 65.2 sec 114: 9813 of 25102 60.9% 1.75/s +25-Dec 23:06:23 test74 1437.8 sec 6637: 3176 of 25102 87.3% 4.62/s +25-Dec 23:15:32 test127 549.4 sec 1707: 1469 of 25102 94.1% 3.11/s +25-Dec 23:15:35 test19 2.1 sec 12: 1457 of 25102 94.2% 5.63/s +25-Dec 23:15:38 test11 3.0 sec 3: 1454 of 25102 94.2% 1.01/s +25-Dec 23:15:41 test215 2.5 sec 1: 1453 of 25102 94.2% 0.40/s +25-Dec 23:15:55 test193 13.1 sec 5: 1448 of 25102 94.2% 0.38/s +25-Dec 23:17:54 test195 118.6 sec 39: 1409 of 25102 94.4% 0.33/s +25-Dec 23:18:12 test243 17.1 sec 7: 1402 of 25102 94.4% 0.41/s +25-Dec 23:18:21 test29 8.5 sec 3: 1399 of 25102 94.4% 0.35/s +25-Dec 23:18:22 testc2(0,0) 1.1 sec 7: 1392 of 25102 94.5% 6.51/s +25-Dec 23:18:33 testc2(0,0) 9.9 sec 1: 1391 of 25102 94.5% 0.10/s +25-Dec 23:18:34 testc4(0) 0.4 sec 4: 1387 of 25102 94.5% 10.84/s +25-Dec 23:18:47 testc7(0) 12.3 sec 3: 1384 of 25102 94.5% 0.24/s +25-Dec 23:18:52 testcc(1) 4.3 sec 1: 1383 of 25102 94.5% 0.23/s +25-Dec 23:18:59 test187 7.0 sec 3: 1380 of 25102 94.5% 0.43/s +25-Dec 23:19:04 test192 4.0 sec 1: 1379 of 25102 94.5% 0.25/s +25-Dec 23:19:16 test181 11.3 sec 10: 1369 of 25102 94.5% 0.88/s +25-Dec 23:20:36 test185 79.7 sec 6: 1363 of 25102 94.6% 0.08/s +25-Dec 23:20:59 test53 22.4 sec 4: 1359 of 25102 94.6% 0.18/s +25-Dec 23:21:36 test17 36.2 sec 27: 1332 of 25102 94.7% 0.75/s +25-Dec 23:26:39 test231 302.6 sec 162: 1170 of 25102 95.3% 0.54/s +26-Dec 00:03:27 test10 2208.1 sec 970: 200 of 25102 99.2% 0.44/s +26-Dec 00:14:02 test75b 610.3 sec 155: 45 of 25102 99.8% 0.25/s +26-Dec 00:15:11 test21b 67.3 sec 26: 19 of 25102 99.9% 0.39/s +26-Dec 00:15:56 testca(1) 44.4 sec 5: 14 of 25102 99.9% 0.11/s +26-Dec 00:17:30 test81 93.7 sec 1: 13 of 25102 99.9% 0.01/s +26-Dec 00:21:49 test18 258.8 sec 13: all 25102 full 100% 0.05/s +[malloc debugging turned back on] diff --git a/GraphBLAS/Test/GB_mex_dup.c b/GraphBLAS/Test/GB_mex_dup.c index f518d95610..ee51af00f2 100644 --- a/GraphBLAS/Test/GB_mex_dup.c +++ b/GraphBLAS/Test/GB_mex_dup.c @@ -10,6 +10,7 @@ // copy and typecast a matrix #include "GB_mex.h" +#include "GB_mex_errors.h" #define USAGE "C = GB_mex_dup (A, type, method, sparsity)" @@ -40,16 +41,11 @@ void mexFunction mexErrMsgTxt ("Usage: " USAGE) ; } - #define GET_DEEP_COPY ; + #define GET_DEEP_COPY ; #define FREE_DEEP_COPY ; - // get A (shallow copy) A = GB_mx_mxArray_to_Matrix (pargin [0], "A input", false, true) ; - if (A == NULL) - { - FREE_ALL ; - mexErrMsgTxt ("A failed") ; - } + GrB_Matrix_set_String (A, "A input", GrB_NAME) ; // get ctype of output matrix GrB_Type ctype = GB_mx_string_to_Type (PARGIN (1), A->type) ; @@ -66,6 +62,12 @@ void mexFunction if (method == 0 && sparsity == GxB_DEFAULT) { METHOD (GrB_Matrix_dup (&C, A)) ; + + // get the name of the C matrix + char name [256] ; + GrB_Matrix_get_String (C, name, GrB_NAME) ; + CHECK (MATCH (name, "A input")) ; + } else { diff --git a/GraphBLAS/Test/GB_mex_generic.h b/GraphBLAS/Test/GB_mex_generic.h index 31ffd1f08a..bcf017b62c 100644 --- a/GraphBLAS/Test/GB_mex_generic.h +++ b/GraphBLAS/Test/GB_mex_generic.h @@ -16,6 +16,147 @@ // testing the _Generic versions //------------------------------------------------------------------------------ +// GrB_get: +#define GrB_Scalar_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Scalar_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Scalar_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Scalar_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Scalar_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Vector_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Vector_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Vector_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Vector_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Vector_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Matrix_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Matrix_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Matrix_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Matrix_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Matrix_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GxB_Serialized_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GxB_Serialized_get_String_(...) GrB_get (__VA_ARGS__) +#define GxB_Serialized_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GxB_Serialized_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GxB_Serialized_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_UnaryOp_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_UnaryOp_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_UnaryOp_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_UnaryOp_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_UnaryOp_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_IndexUnaryOp_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_IndexUnaryOp_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_IndexUnaryOp_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_IndexUnaryOp_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_IndexUnaryOp_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_BinaryOp_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_BinaryOp_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_BinaryOp_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_BinaryOp_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_BinaryOp_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Monoid_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Monoid_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Monoid_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Monoid_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Monoid_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Semiring_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Semiring_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Semiring_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Semiring_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Semiring_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Descriptor_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Descriptor_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Descriptor_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Descriptor_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Descriptor_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Type_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Type_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Type_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Type_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Type_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GrB_Global_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GrB_Global_get_String_(...) GrB_get (__VA_ARGS__) +#define GrB_Global_get_INT32_(...) GrB_get (__VA_ARGS__) +#define GrB_Global_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GrB_Global_get_VOID_(...) GrB_get (__VA_ARGS__) + +#define GxB_Context_get_Scalar_(...) GrB_get (__VA_ARGS__) +#define GxB_Context_get_String_(...) GrB_get (__VA_ARGS__) +#define GxB_Context_get_INT_(...) GrB_get (__VA_ARGS__) +#define GxB_Context_get_SIZE_(...) GrB_get (__VA_ARGS__) +#define GxB_Context_get_VOID_(...) GrB_get (__VA_ARGS__) + +// GrB_set: + +#define GrB_Scalar_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Scalar_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Scalar_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Scalar_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Vector_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Vector_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Vector_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Vector_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Matrix_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Matrix_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Matrix_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Matrix_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_UnaryOp_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_UnaryOp_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_UnaryOp_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_UnaryOp_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_IndexUnaryOp_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_IndexUnaryOp_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_IndexUnaryOp_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_IndexUnaryOp_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_BinaryOp_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_BinaryOp_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_BinaryOp_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_BinaryOp_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Monoid_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Monoid_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Monoid_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Monoid_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Semiring_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Semiring_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Semiring_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Semiring_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Descriptor_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Descriptor_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Descriptor_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Descriptor_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Type_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Type_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Type_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Type_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GrB_Global_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GrB_Global_set_String_(...) GrB_set (__VA_ARGS__) +#define GrB_Global_set_INT32_(...) GrB_set (__VA_ARGS__) +#define GrB_Global_set_VOID_(...) GrB_set (__VA_ARGS__) + +#define GxB_Context_set_Scalar_(...) GrB_set (__VA_ARGS__) +#define GxB_Context_set_String_(...) GrB_set (__VA_ARGS__) +#define GxB_Context_set_INT_(...) GrB_set (__VA_ARGS__) +#define GxB_Context_set_VOID_(...) GrB_set (__VA_ARGS__) + // GrB_free: #define GrB_Type_free_(...) GrB_free (__VA_ARGS__) #define GrB_UnaryOp_free_(...) GrB_free (__VA_ARGS__) @@ -592,6 +733,147 @@ // testing the non-polymorphic versions //------------------------------------------------------------------------------ +// GrB_get: +#define GrB_Scalar_get_Scalar_(...) GrB_Scalar_get_Scalar (__VA_ARGS__ ) +#define GrB_Scalar_get_String_(...) GrB_Scalar_get_String (__VA_ARGS__ ) +#define GrB_Scalar_get_INT32_(...) GrB_Scalar_get_INT32 (__VA_ARGS__ ) +#define GrB_Scalar_get_SIZE_(...) GrB_Scalar_get_SIZE (__VA_ARGS__ ) +#define GrB_Scalar_get_VOID_(...) GrB_Scalar_get_VOID (__VA_ARGS__ ) + +#define GrB_Vector_get_Scalar_(...) GrB_Vector_get_Scalar (__VA_ARGS__ ) +#define GrB_Vector_get_String_(...) GrB_Vector_get_String (__VA_ARGS__ ) +#define GrB_Vector_get_INT32_(...) GrB_Vector_get_INT32 (__VA_ARGS__ ) +#define GrB_Vector_get_SIZE_(...) GrB_Vector_get_SIZE (__VA_ARGS__ ) +#define GrB_Vector_get_VOID_(...) GrB_Vector_get_VOID (__VA_ARGS__ ) + +#define GrB_Matrix_get_Scalar_(...) GrB_Matrix_get_Scalar (__VA_ARGS__ ) +#define GrB_Matrix_get_String_(...) GrB_Matrix_get_String (__VA_ARGS__ ) +#define GrB_Matrix_get_INT32_(...) GrB_Matrix_get_INT32 (__VA_ARGS__ ) +#define GrB_Matrix_get_SIZE_(...) GrB_Matrix_get_SIZE (__VA_ARGS__ ) +#define GrB_Matrix_get_VOID_(...) GrB_Matrix_get_VOID (__VA_ARGS__ ) + +#define GxB_Serialized_get_Scalar_(...) GxB_Serialized_get_Scalar (__VA_ARGS__ ) +#define GxB_Serialized_get_String_(...) GxB_Serialized_get_String (__VA_ARGS__ ) +#define GxB_Serialized_get_INT32_(...) GxB_Serialized_get_INT32 (__VA_ARGS__ ) +#define GxB_Serialized_get_SIZE_(...) GxB_Serialized_get_SIZE (__VA_ARGS__ ) +#define GxB_Serialized_get_VOID_(...) GxB_Serialized_get_VOID (__VA_ARGS__ ) + +#define GrB_UnaryOp_get_Scalar_(...) GrB_UnaryOp_get_Scalar (__VA_ARGS__ ) +#define GrB_UnaryOp_get_String_(...) GrB_UnaryOp_get_String (__VA_ARGS__ ) +#define GrB_UnaryOp_get_INT32_(...) GrB_UnaryOp_get_INT32 (__VA_ARGS__ ) +#define GrB_UnaryOp_get_SIZE_(...) GrB_UnaryOp_get_SIZE (__VA_ARGS__ ) +#define GrB_UnaryOp_get_VOID_(...) GrB_UnaryOp_get_VOID (__VA_ARGS__ ) + +#define GrB_IndexUnaryOp_get_Scalar_(...) GrB_IndexUnaryOp_get_Scalar (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_get_String_(...) GrB_IndexUnaryOp_get_String (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_get_INT32_(...) GrB_IndexUnaryOp_get_INT32 (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_get_SIZE_(...) GrB_IndexUnaryOp_get_SIZE (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_get_VOID_(...) GrB_IndexUnaryOp_get_VOID (__VA_ARGS__ ) + +#define GrB_BinaryOp_get_Scalar_(...) GrB_BinaryOp_get_Scalar (__VA_ARGS__ ) +#define GrB_BinaryOp_get_String_(...) GrB_BinaryOp_get_String (__VA_ARGS__ ) +#define GrB_BinaryOp_get_INT32_(...) GrB_BinaryOp_get_INT32 (__VA_ARGS__ ) +#define GrB_BinaryOp_get_SIZE_(...) GrB_BinaryOp_get_SIZE (__VA_ARGS__ ) +#define GrB_BinaryOp_get_VOID_(...) GrB_BinaryOp_get_VOID (__VA_ARGS__ ) + +#define GrB_Monoid_get_Scalar_(...) GrB_Monoid_get_Scalar (__VA_ARGS__ ) +#define GrB_Monoid_get_String_(...) GrB_Monoid_get_String (__VA_ARGS__ ) +#define GrB_Monoid_get_INT32_(...) GrB_Monoid_get_INT32 (__VA_ARGS__ ) +#define GrB_Monoid_get_SIZE_(...) GrB_Monoid_get_SIZE (__VA_ARGS__ ) +#define GrB_Monoid_get_VOID_(...) GrB_Monoid_get_VOID (__VA_ARGS__ ) + +#define GrB_Semiring_get_Scalar_(...) GrB_Semiring_get_Scalar (__VA_ARGS__ ) +#define GrB_Semiring_get_String_(...) GrB_Semiring_get_String (__VA_ARGS__ ) +#define GrB_Semiring_get_INT32_(...) GrB_Semiring_get_INT32 (__VA_ARGS__ ) +#define GrB_Semiring_get_SIZE_(...) GrB_Semiring_get_SIZE (__VA_ARGS__ ) +#define GrB_Semiring_get_VOID_(...) GrB_Semiring_get_VOID (__VA_ARGS__ ) + +#define GrB_Descriptor_get_Scalar_(...) GrB_Descriptor_get_Scalar (__VA_ARGS__ ) +#define GrB_Descriptor_get_String_(...) GrB_Descriptor_get_String (__VA_ARGS__ ) +#define GrB_Descriptor_get_INT32_(...) GrB_Descriptor_get_INT32 (__VA_ARGS__ ) +#define GrB_Descriptor_get_SIZE_(...) GrB_Descriptor_get_SIZE (__VA_ARGS__ ) +#define GrB_Descriptor_get_VOID_(...) GrB_Descriptor_get_VOID (__VA_ARGS__ ) + +#define GrB_Type_get_Scalar_(...) GrB_Type_get_Scalar (__VA_ARGS__ ) +#define GrB_Type_get_String_(...) GrB_Type_get_String (__VA_ARGS__ ) +#define GrB_Type_get_INT32_(...) GrB_Type_get_INT32 (__VA_ARGS__ ) +#define GrB_Type_get_SIZE_(...) GrB_Type_get_SIZE (__VA_ARGS__ ) +#define GrB_Type_get_VOID_(...) GrB_Type_get_VOID (__VA_ARGS__ ) + +#define GrB_Global_get_Scalar_(...) GrB_Global_get_Scalar (__VA_ARGS__ ) +#define GrB_Global_get_String_(...) GrB_Global_get_String (__VA_ARGS__ ) +#define GrB_Global_get_INT32_(...) GrB_Global_get_INT32 (__VA_ARGS__ ) +#define GrB_Global_get_SIZE_(...) GrB_Global_get_SIZE (__VA_ARGS__ ) +#define GrB_Global_get_VOID_(...) GrB_Global_get_VOID (__VA_ARGS__ ) + +#define GxB_Context_get_Scalar_(...) GxB_Context_get_Scalar (__VA_ARGS__ ) +#define GxB_Context_get_String_(...) GxB_Context_get_String (__VA_ARGS__ ) +#define GxB_Context_get_INT_(...) GxB_Context_get_INT (__VA_ARGS__ ) +#define GxB_Context_get_SIZE_(...) GxB_Context_get_SIZE (__VA_ARGS__ ) +#define GxB_Context_get_VOID_(...) GxB_Context_get_VOID (__VA_ARGS__ ) + +// GrB_set: + +#define GrB_Scalar_set_Scalar_(...) GrB_Scalar_set_Scalar (__VA_ARGS__ ) +#define GrB_Scalar_set_String_(...) GrB_Scalar_set_String (__VA_ARGS__ ) +#define GrB_Scalar_set_INT32_(...) GrB_Scalar_set_INT32 (__VA_ARGS__ ) +#define GrB_Scalar_set_VOID_(...) GrB_Scalar_set_VOID (__VA_ARGS__ ) + +#define GrB_Vector_set_Scalar_(...) GrB_Vector_set_Scalar (__VA_ARGS__ ) +#define GrB_Vector_set_String_(...) GrB_Vector_set_String (__VA_ARGS__ ) +#define GrB_Vector_set_INT32_(...) GrB_Vector_set_INT32 (__VA_ARGS__ ) +#define GrB_Vector_set_VOID_(...) GrB_Vector_set_VOID (__VA_ARGS__ ) + +#define GrB_Matrix_set_Scalar_(...) GrB_Matrix_set_Scalar (__VA_ARGS__ ) +#define GrB_Matrix_set_String_(...) GrB_Matrix_set_String (__VA_ARGS__ ) +#define GrB_Matrix_set_INT32_(...) GrB_Matrix_set_INT32 (__VA_ARGS__ ) +#define GrB_Matrix_set_VOID_(...) GrB_Matrix_set_VOID (__VA_ARGS__ ) + +#define GrB_UnaryOp_set_Scalar_(...) GrB_UnaryOp_set_Scalar (__VA_ARGS__ ) +#define GrB_UnaryOp_set_String_(...) GrB_UnaryOp_set_String (__VA_ARGS__ ) +#define GrB_UnaryOp_set_INT32_(...) GrB_UnaryOp_set_INT32 (__VA_ARGS__ ) +#define GrB_UnaryOp_set_VOID_(...) GrB_UnaryOp_set_VOID (__VA_ARGS__ ) + +#define GrB_IndexUnaryOp_set_Scalar_(...) GrB_IndexUnaryOp_set_Scalar (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_set_String_(...) GrB_IndexUnaryOp_set_String (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_set_INT32_(...) GrB_IndexUnaryOp_set_INT32 (__VA_ARGS__ ) +#define GrB_IndexUnaryOp_set_VOID_(...) GrB_IndexUnaryOp_set_VOID (__VA_ARGS__ ) + +#define GrB_BinaryOp_set_Scalar_(...) GrB_BinaryOp_set_Scalar (__VA_ARGS__ ) +#define GrB_BinaryOp_set_String_(...) GrB_BinaryOp_set_String (__VA_ARGS__ ) +#define GrB_BinaryOp_set_INT32_(...) GrB_BinaryOp_set_INT32 (__VA_ARGS__ ) +#define GrB_BinaryOp_set_VOID_(...) GrB_BinaryOp_set_VOID (__VA_ARGS__ ) + +#define GrB_Monoid_set_Scalar_(...) GrB_Monoid_set_Scalar (__VA_ARGS__ ) +#define GrB_Monoid_set_String_(...) GrB_Monoid_set_String (__VA_ARGS__ ) +#define GrB_Monoid_set_INT32_(...) GrB_Monoid_set_INT32 (__VA_ARGS__ ) +#define GrB_Monoid_set_VOID_(...) GrB_Monoid_set_VOID (__VA_ARGS__ ) + +#define GrB_Semiring_set_Scalar_(...) GrB_Semiring_set_Scalar (__VA_ARGS__ ) +#define GrB_Semiring_set_String_(...) GrB_Semiring_set_String (__VA_ARGS__ ) +#define GrB_Semiring_set_INT32_(...) GrB_Semiring_set_INT32 (__VA_ARGS__ ) +#define GrB_Semiring_set_VOID_(...) GrB_Semiring_set_VOID (__VA_ARGS__ ) + +#define GrB_Descriptor_set_Scalar_(...) GrB_Descriptor_set_Scalar (__VA_ARGS__ ) +#define GrB_Descriptor_set_String_(...) GrB_Descriptor_set_String (__VA_ARGS__ ) +#define GrB_Descriptor_set_INT32_(...) GrB_Descriptor_set_INT32 (__VA_ARGS__ ) +#define GrB_Descriptor_set_VOID_(...) GrB_Descriptor_set_VOID (__VA_ARGS__ ) + +#define GrB_Type_set_Scalar_(...) GrB_Type_set_Scalar (__VA_ARGS__ ) +#define GrB_Type_set_String_(...) GrB_Type_set_String (__VA_ARGS__ ) +#define GrB_Type_set_INT32_(...) GrB_Type_set_INT32 (__VA_ARGS__ ) +#define GrB_Type_set_VOID_(...) GrB_Type_set_VOID (__VA_ARGS__ ) + +#define GrB_Global_set_Scalar_(...) GrB_Global_set_Scalar (__VA_ARGS__ ) +#define GrB_Global_set_String_(...) GrB_Global_set_String (__VA_ARGS__ ) +#define GrB_Global_set_INT32_(...) GrB_Global_set_INT32 (__VA_ARGS__ ) +#define GrB_Global_set_VOID_(...) GrB_Global_set_VOID (__VA_ARGS__ ) + +#define GxB_Context_set_Scalar_(...) GxB_Context_set_Scalar (__VA_ARGS__ ) +#define GxB_Context_set_String_(...) GxB_Context_set_String (__VA_ARGS__ ) +#define GxB_Context_set_INT_(...) GxB_Context_set_INT (__VA_ARGS__ ) +#define GxB_Context_set_VOID_(...) GxB_Context_set_VOID (__VA_ARGS__ ) + // GrB_free: #define GrB_Type_free_(...) GrB_Type_free (__VA_ARGS__) #define GrB_UnaryOp_free_(...) GrB_UnaryOp_free (__VA_ARGS__) diff --git a/GraphBLAS/Test/GB_mex_serialize.c b/GraphBLAS/Test/GB_mex_serialize.c index c12dc9f68e..ca30a0cfec 100644 --- a/GraphBLAS/Test/GB_mex_serialize.c +++ b/GraphBLAS/Test/GB_mex_serialize.c @@ -19,7 +19,7 @@ // method: // -2 // GrB*serialize with default LZ4 compression // GxB_COMPRESSION_NONE -1 // no compression -// GxB_COMPRESSION_DEFAULT 0 // LZ4 +// GxB_COMPRESSION_DEFAULT 0 // ZSTD level 1 // GxB_COMPRESSION_LZ4 1000 // LZ4 // GxB_COMPRESSION_LZ4HC 2000 // LZ4HC, with default level 9 // GxB_COMPRESSION_LZ4HC 2001 // LZ4HC:1 diff --git a/GraphBLAS/Test/GB_mex_test0.c b/GraphBLAS/Test/GB_mex_test0.c index d0f258cb6a..c0fcb37635 100644 --- a/GraphBLAS/Test/GB_mex_test0.c +++ b/GraphBLAS/Test/GB_mex_test0.c @@ -3868,10 +3868,7 @@ void mexFunction ERR (GB_Type_check (Tcrud, "Tcrud", G1, ff)) ; CHECK (T == NULL) ; - // test the function instead of the macro: - #undef GrB_Type_new - #undef GrM_Type_new - OK (GRB (Type_new) (&T, sizeof (int))) ; + OK (GrB_Type_new (&T, sizeof (int))) ; Werk->where = "GB_Type_check" ; OK (GB_Type_check (T, "T ok (via function)", G3, ff)) ; @@ -3913,10 +3910,7 @@ void mexFunction CHECK (info == GrB_NULL_POINTER) ; CHECK (op1b == NULL) ; - // test the function instead of the macro: - #undef GrB_UnaryOp_new - #undef GrM_UnaryOp_new - OK (GRB (UnaryOp_new) (&op1b, (GxB_unary_function) f1, GrB_FP64, GrB_UINT32)) ; + OK (GrB_UnaryOp_new (&op1b, (GxB_unary_function) f1, GrB_FP64, GrB_UINT32)) ; CHECK (op1b != NULL) ; OK (GrB_UnaryOp_wait_(op1b, GrB_MATERIALIZE)) ; @@ -3961,10 +3955,7 @@ void mexFunction CHECK (info == GrB_NULL_POINTER) ; CHECK (op2b == NULL) ; - // test the function instead of the macro: - #undef GrB_BinaryOp_new - #undef GrM_BinaryOp_new - OK (GRB (BinaryOp_new) (&op2b, (GxB_binary_function) f2, GrB_INT32, GrB_UINT8, GrB_INT16)) ; + OK (GrB_BinaryOp_new (&op2b, (GxB_binary_function) f2, GrB_INT32, GrB_UINT8, GrB_INT16)) ; CHECK (op2b != NULL) ; Werk->where = "GB_BinaryOp_check" ; @@ -4000,54 +3991,6 @@ void mexFunction printf ("\nAll GB_BinaryOp_check tests passed (errors expected)\n") ; - //-------------------------------------------------------------------------- - // SelectOp check - //-------------------------------------------------------------------------- - -#if 0 - printf ("\n-------------- GB_SelectOp_check:\n") ; - - Werk->where = "GB_SelectOp_check" ; - - info = GB_SelectOp_check (NULL, "null selectop", G3, ff) ; - CHECK (info == GrB_NULL_POINTER) ; - - CHECK (selectop == NULL) ; - // test the function instead of the macro: - #undef GxB_SelectOp_new - #undef GxM_SelectOp_new - OK (GXB (SelectOp_new) (&selectop, (GxB_select_function) fselect, GrB_FP64, GrB_FP64)) ; - CHECK (selectop != NULL) ; - - Werk->where = "GB_SelectOp_check" ; - OK (GB_SelectOp_check (selectop, "user selectop ok (via function)", G3, - ff)) ; - - expected = GrB_UNINITIALIZED_OBJECT ; - - selectop->magic = GB_FREED ; - ERR (GB_SelectOp_check (selectop, "selectop freed", G1, ff)) ; - selectop->magic = GB_MAGIC ; - - expected = GrB_INVALID_OBJECT ; - - selectop->selop_function = NULL ; - ERR (GB_SelectOp_check (selectop, "selectop invalid function", G1, ff)) ; - selectop->selop_function = (GxB_select_function) fselect ; - - selectop->opcode = 9999 ; - ERR (GB_SelectOp_check (selectop, "selectop invalid opcode", G1, ff)) ; - selectop->opcode = GB_USER_selop_code ; - - selectop->xtype = Tcrud ; - ERR (GB_SelectOp_check (selectop, "selectop invalid xtype", G1, ff)) ; - selectop->xtype = GrB_FP64 ; - - OK (GB_SelectOp_check (selectop, "user selectop ok", G3, ff)) ; - - printf ("\nAll GB_SelectOp_check tests passed (errors expected)\n") ; -#endif - //-------------------------------------------------------------------------- // Monoid check //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_test1.c b/GraphBLAS/Test/GB_mex_test1.c index 0423432732..44d943e043 100644 --- a/GraphBLAS/Test/GB_mex_test1.c +++ b/GraphBLAS/Test/GB_mex_test1.c @@ -84,12 +84,16 @@ void mexFunction sizeof (struct GB_Monoid_opaque)) ; printf ("sizeof (struct GB_Semiring_opaque) %d\n", sizeof (struct GB_Semiring_opaque)) ; + printf ("sizeof (struct GB_Scalar_opaque) %d\n", + sizeof (struct GB_Scalar_opaque)) ; printf ("sizeof (struct GB_Vector_opaque) %d\n", sizeof (struct GB_Vector_opaque)) ; printf ("sizeof (struct GB_Matrix_opaque) %d\n", sizeof (struct GB_Matrix_opaque)) ; printf ("sizeof (struct GB_Descriptor_opaque) %d\n", sizeof (struct GB_Descriptor_opaque)) ; + printf ("sizeof (struct GB_Context_opaque) %d\n", + sizeof (struct GB_Context_opaque)) ; size_t s ; GxB_Type_size (&s, GrB_BOOL ) ; printf ("%d %d\n", s, sizeof (bool )); diff --git a/GraphBLAS/Test/GB_mex_test11.c b/GraphBLAS/Test/GB_mex_test11.c index a731a0402c..6ee30630ae 100644 --- a/GraphBLAS/Test/GB_mex_test11.c +++ b/GraphBLAS/Test/GB_mex_test11.c @@ -489,7 +489,7 @@ if (jit_enabled) OK (GxB_Context_engage (context1)) ; expected = GrB_INVALID_VALUE ; ERR (GxB_Context_disengage (context2)) ; - OK (GxB_Context_set (context1, GxB_CHUNK, -1)) ; + OK (GxB_Context_set (context1, GxB_CHUNK, (double) -1)) ; double chunk = 0 ; OK (GxB_Context_get (context1, GxB_CHUNK, &chunk)) ; CHECK (chunk == GB_CHUNK_DEFAULT) ; diff --git a/GraphBLAS/Test/GB_mex_test25.c b/GraphBLAS/Test/GB_mex_test25.c index 7dbfa16e21..ab9ad206fd 100644 --- a/GraphBLAS/Test/GB_mex_test25.c +++ b/GraphBLAS/Test/GB_mex_test25.c @@ -9,6 +9,7 @@ #include "GB_mex.h" #include "GB_mex_errors.h" +#include "GB_get_set.h" #define USAGE "GB_mex_test25" @@ -72,6 +73,35 @@ void mexFunction printf ("GxB_Context_error [%s] ok\n", s) ; OK (GxB_Context_wait (GxB_CONTEXT_WORLD, GrB_COMPLETE)) ; + //-------------------------------------------------------------------------- + // report object sizes + //-------------------------------------------------------------------------- + + printf ("%4d: sizeof (struct GB_Type_opaque)\n", + (int) sizeof (struct GB_Type_opaque)) ; + printf ("%4d: sizeof (struct GB_UnaryOp_opaque)\n", + (int) sizeof (struct GB_UnaryOp_opaque)) ; + printf ("%4d: sizeof (struct GB_BinaryOp_opaque)\n", + (int) sizeof (struct GB_BinaryOp_opaque)) ; + printf ("%4d: sizeof (struct GB_SelectOp_opaque)\n", + (int) sizeof (struct GB_SelectOp_opaque)) ; + printf ("%4d: sizeof (struct GB_Monoid_opaque)\n", + (int) sizeof (struct GB_Monoid_opaque)) ; + printf ("%4d: sizeof (struct GB_Semiring_opaque)\n", + (int) sizeof (struct GB_Semiring_opaque)) ; + printf ("%4d: sizeof (struct GB_Scalar_opaque)\n", + (int) sizeof (struct GB_Scalar_opaque)) ; + printf ("%4d: sizeof (struct GB_Vector_opaque)\n", + (int) sizeof (struct GB_Vector_opaque)) ; + printf ("%4d: sizeof (struct GB_Matrix_opaque)\n", + (int) sizeof (struct GB_Matrix_opaque)) ; + printf ("%4d: sizeof (struct GB_Descriptor_opaque)\n", + (int) sizeof (struct GB_Descriptor_opaque)) ; + printf ("%4d: sizeof (struct GB_Context_opaque)\n", + (int) sizeof (struct GB_Context_opaque)) ; + printf ("%4d: sizeof (struct GB_Global_opaque)\n", + (int) sizeof (struct GB_Global_opaque)) ; + //-------------------------------------------------------------------------- // finalize GraphBLAS //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_test26.c b/GraphBLAS/Test/GB_mex_test26.c new file mode 100644 index 0000000000..f85142470d --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test26.c @@ -0,0 +1,674 @@ +//------------------------------------------------------------------------------ +// GB_mex_test26: test GrB_get and GrB_set (type, scalar, vector, matrix) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test26" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +typedef struct { int32_t stuff ; } mytype ; +#define MYTYPE_DEFN \ +"typedef struct { int32_t stuff ; } mytype ;" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Matrix A = NULL ; + GrB_Vector v = NULL ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL, + s_uint64 = NULL ; + GrB_Type type = NULL ; + uint64_t u64 ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + OK (GrB_Scalar_new (&s_uint64, GrB_UINT64)) ; + + //-------------------------------------------------------------------------- + // GrB_Type get/set + //-------------------------------------------------------------------------- + + // type name size + OK (GrB_Type_get_SIZE_(GrB_BOOL, &size, GrB_NAME)) ; + CHECK (size == strlen ("GrB_BOOL") + 1) ; + + OK (GrB_Type_get_SIZE_(GrB_BOOL, &size, GxB_JIT_C_NAME)) ; + CHECK (size == strlen ("bool") + 1) ; + + // type name + OK (GrB_Type_get_String_(GrB_BOOL, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_BOOL")) ; + + OK (GrB_Type_get_String_(GrB_INT8, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_INT8")) ; + + OK (GrB_Type_get_String_(GrB_INT16, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_INT16")) ; + + OK (GrB_Type_get_String_(GrB_INT32, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_INT32")) ; + + OK (GrB_Type_get_String_(GrB_INT64, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_INT64")) ; + + OK (GrB_Type_get_String_(GrB_UINT8, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_UINT8")) ; + + OK (GrB_Type_get_String_(GrB_UINT16, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_UINT16")) ; + + OK (GrB_Type_get_String_(GrB_UINT32, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_UINT32")) ; + + OK (GrB_Type_get_String_(GrB_UINT64, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_UINT64")) ; + + OK (GrB_Type_get_String_(GrB_FP32, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Type_get_String_(GrB_FP64, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_FP64")) ; + + OK (GrB_Type_get_String_(GxB_FC32, name, GrB_NAME)) ; + CHECK (MATCH (name, "GxB_FC32")) ; + + OK (GrB_Type_get_String_(GxB_FC64, name, GrB_NAME)) ; + CHECK (MATCH (name, "GxB_FC64")) ; + + // type JIT name + OK (GrB_Type_get_String_(GrB_BOOL, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "bool")) ; + + OK (GrB_Type_get_String_(GrB_INT8, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "int8_t")) ; + + OK (GrB_Type_get_String_(GrB_INT16, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "int16_t")) ; + + OK (GrB_Type_get_String_(GrB_INT32, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "int32_t")) ; + + OK (GrB_Type_get_String_(GrB_INT64, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "int64_t")) ; + + OK (GrB_Type_get_String_(GrB_UINT8, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "uint8_t")) ; + + OK (GrB_Type_get_String_(GrB_UINT16, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "uint16_t")) ; + + OK (GrB_Type_get_String_(GrB_UINT32, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "uint32_t")) ; + + OK (GrB_Type_get_String_(GrB_UINT64, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "uint64_t")) ; + + OK (GrB_Type_get_String_(GrB_FP32, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "float")) ; + + OK (GrB_Type_get_String_(GrB_FP64, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "double")) ; + + OK (GrB_Type_get_String_(GxB_FC32, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "GxB_FC32_t")) ; + + OK (GrB_Type_get_String_(GxB_FC64, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "GxB_FC64_t")) ; + + // type code + OK (GrB_Type_get_INT32_(GrB_BOOL, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_BOOL_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_INT8, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_INT8_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_INT16, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_INT16_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_INT32, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_INT32_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_INT64, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_INT64_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_UINT8, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_UINT8_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_UINT16, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_UINT16_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_UINT32, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_UINT32_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_UINT64, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_UINT64_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_FP32, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_Type_get_INT32_(GrB_FP64, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_Type_get_INT32_(GxB_FC32, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GxB_FC32_CODE) ; + + OK (GrB_Type_get_INT32_(GxB_FC64, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GxB_FC64_CODE) ; + + // type size (using a GrB_Scalar): recommended type of GrB_UINT64 + OK (GrB_Type_get_Scalar_(GrB_BOOL, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (bool)) ; + + OK (GrB_Type_get_Scalar_(GrB_INT8, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (int8_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_INT16, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (int16_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_INT32, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (int32_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_INT64, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (int64_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_UINT8, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (uint8_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_UINT16, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (uint16_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_UINT32, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (uint32_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_UINT64, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (uint64_t)) ; + + OK (GrB_Type_get_Scalar_(GrB_FP32, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (float)) ; + + OK (GrB_Type_get_Scalar_(GrB_FP64, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (double)) ; + + OK (GrB_Type_get_Scalar_(GxB_FC32, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (float complex)) ; + + OK (GrB_Type_get_Scalar_(GxB_FC64, s_uint64, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_UINT64_(&u64, s_uint64)) ; + CHECK (u64 == sizeof (double complex)) ; + + + // type size (using a size_t) + size = 0 ; + OK (GrB_Type_get_SIZE_(GrB_BOOL, &size, GrB_SIZE)) ; + CHECK (size == sizeof (bool)) ; + + OK (GrB_Type_get_SIZE_(GrB_INT8, &size, GrB_SIZE)) ; + CHECK (size == sizeof (int8_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_INT16, &size, GrB_SIZE)) ; + CHECK (size == sizeof (int16_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_INT32, &size, GrB_SIZE)) ; + CHECK (size == sizeof (int32_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_INT64, &size, GrB_SIZE)) ; + CHECK (size == sizeof (int64_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_UINT8, &size, GrB_SIZE)) ; + CHECK (size == sizeof (uint8_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_UINT16, &size, GrB_SIZE)) ; + CHECK (size == sizeof (uint16_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_UINT32, &size, GrB_SIZE)) ; + CHECK (size == sizeof (uint32_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_UINT64, &size, GrB_SIZE)) ; + CHECK (size == sizeof (uint64_t)) ; + + OK (GrB_Type_get_SIZE_(GrB_FP32, &size, GrB_SIZE)) ; + CHECK (size == sizeof (float)) ; + + OK (GrB_Type_get_SIZE_(GrB_FP64, &size, GrB_SIZE)) ; + CHECK (size == sizeof (double)) ; + + OK (GrB_Type_get_SIZE_(GxB_FC32, &size, GrB_SIZE)) ; + CHECK (size == sizeof (float complex)) ; + + OK (GrB_Type_get_SIZE_(GxB_FC64, &size, GrB_SIZE)) ; + CHECK (size == sizeof (double complex)) ; + + + + // built-in type definition + OK (GrB_Type_get_SIZE_(GrB_BOOL, &size, GxB_JIT_C_DEFINITION)) ; + CHECK (size == 1) ; + OK (GrB_Type_get_String_(GrB_BOOL, defn, GxB_JIT_C_DEFINITION)) ; + CHECK (MATCH (defn, "")) ; + + // user-defined type + OK (GrB_Type_new (&type, sizeof (mytype))) ; + OK (GxB_print (type, 3)) ; + expected = GrB_INVALID_VALUE ; + ERR (GrB_Type_set_String_(type, "", GxB_JIT_C_NAME)) ; + OK (GrB_Type_set_String_(type, "mytype", GxB_JIT_C_NAME)) ; + CHECK (type->hash == UINT64_MAX) ; + OK (GrB_Type_set_String_(type, MYTYPE_DEFN, GxB_JIT_C_DEFINITION)) ; + OK (GxB_print (type, 3)) ; + CHECK (type->hash != UINT64_MAX) ; + printf (" hash: %016lx\n", type->hash) ; + + OK (GrB_Type_get_SIZE_(type, &size, GrB_NAME)) ; + CHECK (size == 1) ; + OK (GrB_Type_set_String_ (type, "user name of a type", GrB_NAME)) ; + OK (GrB_Type_get_SIZE_(type, &size, GrB_NAME)) ; + CHECK (size == strlen ("user name of a type") + 1) ; + OK (GrB_Type_get_String_ (type, name, GrB_NAME)) ; + CHECK (MATCH (name, "user name of a type")) ; + + expected = GrB_ALREADY_SET ; + ERR (GrB_Type_set_String_ (type, "another user name of a type", GrB_NAME)) ; + printf (" test GrB_ALREADY_SET: ok\n") ; + + OK (GrB_Type_get_String_(type, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "mytype")) ; + OK (GrB_Type_get_SIZE_(type, &size, GxB_JIT_C_NAME)) ; + CHECK (size == strlen ("mytype") + 1) ; + + OK (GrB_Type_get_SIZE_(type, &size, GxB_JIT_C_DEFINITION)) ; + CHECK (size == strlen (MYTYPE_DEFN) + 1) ; + OK (GrB_Type_get_String_(type, defn, GxB_JIT_C_DEFINITION)) ; + CHECK (MATCH (defn, MYTYPE_DEFN)) ; + + OK (GrB_Type_get_Scalar_(type, s_int32, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == sizeof (mytype)) ; + + OK (GrB_Type_get_INT32_(type, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_UDT_CODE) ; + + OK (GrB_Type_get_String_(type, name, GrB_EL_TYPE_STRING)) ; + CHECK (MATCH (name, "user name of a type")) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Type_get_INT32_(type, &code, GrB_EL_TYPE_STRING)) ; + + i = -1 ; + OK (GrB_Type_get_Scalar_(type, s_int32, GrB_EL_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GrB_UDT_CODE) ; + + OK (GrB_Type_get_Scalar_(type, s_int32, GrB_SIZE)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == sizeof (mytype)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Type_get_Scalar_(type, s_int32, GrB_OUTP)) ; + ERR (GrB_Type_get_String_(type, name, GrB_OUTP)) ; + ERR (GrB_Type_get_SIZE_(type, &size, GrB_OUTP)) ; + + ERR (GrB_Type_get_SIZE_(GrB_FP32, &i, GrB_SIZE)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Type_get_VOID_(type, nothing, 0)) ; + ERR (GrB_Type_set_Scalar_(type, s_int32, 0)) ; + ERR (GrB_Type_set_INT32_(type, 3, 0)) ; + ERR (GrB_Type_set_VOID_(type, nothing, 0, 256)) ; + + //-------------------------------------------------------------------------- + // GrB_Scalar get/set + //-------------------------------------------------------------------------- + + OK (GrB_Scalar_new (&s, GrB_FP32)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Scalar_get_VOID_(s, nothing, 0)) ; + + OK (GrB_Scalar_get_SIZE_(s, &size, GrB_EL_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + OK (GrB_Scalar_get_String_(s, name, GrB_EL_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Scalar_get_String_(s, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + + OK (GrB_Scalar_get_INT32_(s, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + i = -1 ; + OK (GrB_Scalar_get_Scalar_(s, s_int32, GrB_EL_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GrB_FP32_CODE) ; + + GxB_print (s, 3) ; + + OK (GrB_Scalar_get_INT32_(s, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + printf ("scalar storage: %d\n", i) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Scalar_get_INT32_(s, &i, GxB_FORMAT)) ; + printf ("scalar storage: %d\n", i) ; + CHECK (i == GxB_BY_COL) ; + + OK (GrB_Scalar_get_INT32_(s, &i, GxB_SPARSITY_CONTROL)) ; + printf ("sparsity control: %d\n", i) ; + CHECK (i == GxB_AUTO_SPARSITY) ; + + GxB_print (s_int32, 3) ; + OK (GrB_Scalar_get_INT32_(s_int32, &i, GxB_SPARSITY_STATUS)) ; + printf ("sparsity status: %d\n", i) ; + CHECK (i == GxB_FULL) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Scalar_get_INT32_(s_int32, &i, 0)) ; + ERR (GrB_Scalar_get_SIZE_(s, &size, 0)) ; + + ERR (GrB_Scalar_set_Scalar_(s, s_int32, 0)) ; + OK (GrB_Scalar_set_Scalar_(s, s_int32, GrB_STORAGE_ORIENTATION_HINT)) ; + + ERR (GrB_Scalar_set_INT32_(s, 0, 0)) ; + OK (GrB_Scalar_set_INT32_(s, 0, GrB_STORAGE_ORIENTATION_HINT)) ; + + OK (GrB_Scalar_set_String_(s, "scalar name", GrB_NAME)) ; + OK (GrB_Scalar_get_String_(s, name, GrB_NAME)) ; + OK (GrB_Scalar_get_SIZE_(s, &size, GrB_NAME)) ; + CHECK (MATCH (name, "scalar name")) ; + CHECK (size == strlen (name) + 1) ; + + OK (GrB_Scalar_set_String_(s, "another scalar name", GrB_NAME)) ; + OK (GrB_Scalar_get_String_(s, name, GrB_NAME)) ; + OK (GrB_Scalar_get_SIZE_(s, &size, GrB_NAME)) ; + CHECK (MATCH (name, "another scalar name")) ; + CHECK (size == strlen (name) + 1) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Scalar_set_VOID_(s, nothing, 0, 0)) ; + + //-------------------------------------------------------------------------- + // GrB_Vector get/set + //-------------------------------------------------------------------------- + + OK (GrB_Vector_new (&v, GrB_FP32, 10)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Vector_get_VOID_(v, nothing, 0)) ; + + OK (GrB_Vector_get_SIZE_(v, &size, GrB_EL_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + OK (GrB_Vector_get_String_(v, name, GrB_EL_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Vector_get_String_(v, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + + OK (GrB_Vector_get_INT32_(v, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + i = -1 ; + OK (GrB_Vector_get_Scalar_(v, s_int32, GrB_EL_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GrB_FP32_CODE) ; + + GxB_print (v, 3) ; + + OK (GrB_Vector_get_INT32_(v, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + printf ("vector storage: %d\n", i) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Vector_get_INT32_(v, &i, GxB_FORMAT)) ; + printf ("vector storage: %d\n", i) ; + CHECK (i == GxB_BY_COL) ; + + OK (GrB_Vector_set_INT32_(v, GrB_ROWMAJOR, GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Vector_get_INT32_(v, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Vector_get_INT32_(v, &i, GxB_SPARSITY_CONTROL)) ; + printf ("sparsity control: %d\n", i) ; + CHECK (i == GxB_AUTO_SPARSITY) ; + + OK (GrB_assign (v, NULL, NULL, 1, GrB_ALL, 10, NULL)) ; + GxB_print (v, 3) ; + + OK (GrB_Vector_get_INT32_(v, &i, GxB_SPARSITY_STATUS)) ; + printf ("sparsity status: %d\n", i) ; + CHECK (i == GxB_FULL) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Vector_get_INT32_(v, &i, 0)) ; + ERR (GrB_Vector_get_SIZE_(v, &size, 0)) ; + + fvalue = -1 ; + OK (GrB_Vector_get_Scalar_(v, s_fp32, GxB_BITMAP_SWITCH)) ; + OK (GrB_Scalar_extractElement_FP32_(&fvalue, s_fp32)) ; + printf ("bitmap switch: %g\n", fvalue) ; + CHECK (abs (fvalue - 0.04) < 1e-6) ; + + OK (GrB_Scalar_setElement_FP32_(s_fp32, 0.5)) ; + OK (GrB_Vector_set_Scalar_(v, s_fp32, GxB_BITMAP_SWITCH)) ; + OK (GrB_Vector_get_Scalar_(v, s_fp64, GxB_BITMAP_SWITCH)) ; + OK (GrB_Scalar_extractElement_FP64_(&dvalue, s_fp64)) ; + printf ("bitmap switch: %g\n", dvalue) ; + CHECK (abs (dvalue - 0.5) < 1e-6) ; + + OK (GrB_Scalar_setElement_INT32_(s_int32, GxB_BITMAP)) ; + OK (GrB_Vector_set_Scalar_(v, s_int32, GxB_SPARSITY_CONTROL)) ; + GxB_print (v, 3) ; + + OK (GrB_Vector_get_INT32_(v, &i, GxB_SPARSITY_STATUS)) ; + printf ("sparsity status: %d\n", i) ; + CHECK (i == GxB_BITMAP) ; + + OK (GrB_Vector_set_INT32_(v, GxB_SPARSE, GxB_SPARSITY_CONTROL)) ; + OK (GrB_Vector_get_INT32_(v, &i, GxB_SPARSITY_STATUS)) ; + printf ("sparsity status: %d\n", i) ; + CHECK (i == GxB_SPARSE) ; + + ERR (GrB_Vector_set_Scalar_(v, s_int32, GxB_HYPER_SWITCH)) ; + ERR (GrB_Vector_get_Scalar_(v, s_int32, GxB_HYPER_SWITCH)) ; + + OK (GrB_Vector_set_String_(v, "vector name", GrB_NAME)) ; + OK (GrB_Vector_get_String_(v, name, GrB_NAME)) ; + OK (GrB_Vector_get_SIZE_(v, &size, GrB_NAME)) ; + CHECK (MATCH (name, "vector name")) ; + CHECK (size == strlen (name) + 1) ; + + OK (GrB_Vector_set_String_(v, "another vector name", GrB_NAME)) ; + OK (GrB_Vector_get_String_(v, name, GrB_NAME)) ; + OK (GrB_Vector_get_SIZE_(v, &size, GrB_NAME)) ; + CHECK (MATCH (name, "another vector name")) ; + CHECK (size == strlen (name) + 1) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Vector_set_VOID_(v, nothing, 0, 1)) ; + + expected = GrB_EMPTY_OBJECT ; + OK (GrB_Scalar_clear (s_int32)) ; + ERR (GrB_Vector_set_Scalar_(v, s_int32, GxB_FORMAT)) ; + + //-------------------------------------------------------------------------- + // GrB_Matrix get/set + //-------------------------------------------------------------------------- + + OK (GrB_Matrix_new (&A, GrB_FP32, 5, 5)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Matrix_get_VOID_(A, nothing, 0)) ; + + OK (GrB_Matrix_get_SIZE_(A, &size, GrB_EL_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + OK (GrB_Matrix_get_String_(A, name, GrB_EL_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Matrix_get_String_(A, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + + OK (GrB_Matrix_get_INT32_(A, &code, GrB_EL_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + i = -1 ; + OK (GrB_Matrix_get_Scalar_(A, s_int32, GrB_EL_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GrB_FP32_CODE) ; + + GxB_print (A, 3) ; + + OK (GrB_Matrix_get_INT32_(A, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + printf ("matrix storage: %d\n", i) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Matrix_get_INT32_(A, &i, GxB_FORMAT)) ; + printf ("matrix storage: %d\n", i) ; + CHECK (i == GxB_BY_COL) ; + + OK (GrB_Matrix_get_INT32_(A, &i, GxB_SPARSITY_CONTROL)) ; + printf ("sparsity control: %d\n", i) ; + CHECK (i == GxB_AUTO_SPARSITY) ; + + OK (GrB_assign (A, NULL, NULL, 1, GrB_ALL, 5, GrB_ALL, 5, NULL)) ; + GxB_print (A, 3) ; + + OK (GrB_Matrix_get_INT32_(A, &i, GxB_SPARSITY_STATUS)) ; + printf ("sparsity status: %d\n", i) ; + CHECK (i == GxB_FULL) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Matrix_get_INT32_(A, &i, 0)) ; + ERR (GrB_Matrix_get_SIZE_(A, &size, 0)) ; + + fvalue = -1 ; + OK (GrB_Matrix_get_Scalar_(A, s_fp32, GxB_BITMAP_SWITCH)) ; + OK (GrB_Scalar_extractElement_FP32_(&fvalue, s_fp32)) ; + printf ("bitmap switch: %g\n", fvalue) ; + CHECK (abs (fvalue - 0.04) < 1e-6) ; + + OK (GrB_Scalar_setElement_FP32_(s_fp32, 0.5)) ; + OK (GrB_Matrix_set_Scalar_(A, s_fp32, GxB_BITMAP_SWITCH)) ; + OK (GrB_Matrix_get_Scalar_(A, s_fp64, GxB_BITMAP_SWITCH)) ; + OK (GrB_Scalar_extractElement_FP64_(&dvalue, s_fp64)) ; + printf ("bitmap switch: %g\n", dvalue) ; + CHECK (abs (dvalue - 0.5) < 1e-6) ; + + OK (GrB_Scalar_setElement_INT32_(s_int32, GxB_BITMAP)) ; + OK (GrB_Matrix_set_Scalar_(A, s_int32, GxB_SPARSITY_CONTROL)) ; + GxB_print (A, 3) ; + + OK (GrB_Matrix_get_INT32_(A, &i, GxB_SPARSITY_STATUS)) ; + printf ("sparsity status: %d\n", i) ; + CHECK (i == GxB_BITMAP) ; + + OK (GrB_Scalar_setElement_FP32_(s_fp32, 0.25)) ; + OK (GrB_Matrix_set_Scalar_(A, s_fp32, GxB_HYPER_SWITCH)) ; + OK (GrB_Matrix_get_Scalar_(A, s_fp64, GxB_HYPER_SWITCH)) ; + OK (GrB_Scalar_extractElement_FP64_(&dvalue, s_fp64)) ; + printf ("hyper switch: %g\n", dvalue) ; + CHECK (abs (dvalue - 0.25) < 1e-6) ; + + OK (GrB_Matrix_get_SIZE_(A, &size, GrB_NAME)) ; + CHECK (size == 1) ; + + OK (GrB_Matrix_set_String_(A, "matrix name", GrB_NAME)) ; + OK (GrB_Matrix_get_String_(A, name, GrB_NAME)) ; + OK (GrB_Matrix_get_SIZE_(A, &size, GrB_NAME)) ; + CHECK (MATCH (name, "matrix name")) ; + CHECK (size == strlen (name) + 1) ; + + OK (GrB_Matrix_set_String_(A, "another matrix name", GrB_NAME)) ; + OK (GrB_Matrix_get_String_(A, name, GrB_NAME)) ; + OK (GrB_Matrix_get_SIZE_(A, &size, GrB_NAME)) ; + CHECK (MATCH (name, "another matrix name")) ; + CHECK (size == strlen (name) + 1) ; + + OK (GrB_Matrix_get_String_(A, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "float")) ; + OK (GrB_Matrix_get_SIZE_(A, &size, GxB_JIT_C_NAME)) ; + CHECK (size == strlen ("float") + 1) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Matrix_set_String_ (A, "garbage", 999)) ; + ERR (GrB_Matrix_set_VOID_(A, nothing, 0, 1)) ; + ERR (GrB_Matrix_get_SIZE_(A, &size, 999)) ; + + OK (GrB_Matrix_set_INT32_(A, GrB_ROWMAJOR, GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Matrix_get_INT32_(A, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_ROWMAJOR) ; + OK (GrB_Matrix_get_INT32_(A, &i, GxB_FORMAT)) ; + CHECK (i == GxB_BY_ROW) ; + GxB_print (A, 3) ; + + OK (GrB_Matrix_set_INT32_(A, GrB_COLMAJOR, GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Matrix_get_INT32_(A, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_COLMAJOR) ; + OK (GrB_Matrix_get_INT32_(A, &i, GxB_FORMAT)) ; + CHECK (i == GxB_BY_COL) ; + GxB_print (A, 3) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Matrix_set_INT32_(A, 99, GxB_FORMAT)) ; + ERR (GrB_Matrix_set_INT32_(A, 99, 999)) ; + ERR (GrB_Matrix_get_String_(A, defn, 999)) ; + ERR (GrB_Matrix_get_Scalar(A, s_int32, 999)) ; + + expected = GrB_EMPTY_OBJECT ; + OK (GrB_Scalar_clear (s_int32)) ; + ERR (GrB_Matrix_set_Scalar_(A, s_int32, GxB_FORMAT)) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&A) ; + GrB_free (&v) ; + GrB_free (&s) ; + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&s_uint64) ; + GrB_free (&type) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test26: all tests passed.\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test27.c b/GraphBLAS/Test/GB_mex_test27.c new file mode 100644 index 0000000000..8a57ea678f --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test27.c @@ -0,0 +1,476 @@ +//------------------------------------------------------------------------------ +// GB_mex_test27: test GrB_get and GrB_set (unary ops) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test27" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +#define GETOP(op,opname) \ +{ \ + OK (GrB_UnaryOp_get_String (op, name, GrB_NAME)) ; \ + CHECK (MATCH (name, opname)) ; \ + OK (GrB_UnaryOp_get_String (op, cname, GxB_JIT_C_NAME)) ; \ + printf ("%s: %s\n", name, cname) ; \ + OK (GrB_UnaryOp_get_SIZE (op, &size, GrB_NAME)) ; \ + CHECK (size == strlen (name) + 1) ; \ + GrB_Info info2, info3 ; \ + info2 = GrB_UnaryOp_get_SIZE (op, &size, GrB_INP0_TYPE_STRING) ; \ + info3 = GrB_UnaryOp_get_String (op, name, GrB_INP0_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (size == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (size == 1) ; } \ + info2 = GrB_UnaryOp_get_SIZE (op, &size, GrB_INP1_TYPE_STRING) ; \ + info3 = GrB_UnaryOp_get_String (op, name, GrB_INP1_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (size == 1) ; \ + CHECK (info2 == GrB_NO_VALUE) ; \ + info2 = GrB_UnaryOp_get_SIZE (op, &size, GrB_OUTP_TYPE_STRING) ; \ + info3 = GrB_UnaryOp_get_String (op, name, GrB_OUTP_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (size == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (size == 1) ; } \ +} + +#define GETNAME(op) \ +{ \ + GETOP (op, #op) ; \ +/* OK (GxB_UnaryOp_fprint (op, "unop", 3, NULL)) ; */ \ +} + +#define GETNAM2(op,alias) \ +{ \ + GETOP (op,alias) ; \ +/* OK (GxB_UnaryOp_fprint (op, "unop", 3, NULL)) ; */ \ +} + +void myfunc (float *z, const float *x) ; +void myfunc (float *z, const float *x) { (*z) = -(*x) ; } +#define MYFUNC_DEFN \ +"void myfunc (float *z, const float *x) { (*z) = -(*x) ; }" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_UnaryOp unop = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char cname [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GrB_UnaryOp get name + //-------------------------------------------------------------------------- + + GETNAME (GrB_IDENTITY_BOOL) ; + GETNAME (GrB_IDENTITY_INT8) ; + GETNAME (GrB_IDENTITY_INT16) ; + GETNAME (GrB_IDENTITY_INT32) ; + GETNAME (GrB_IDENTITY_INT64) ; + GETNAME (GrB_IDENTITY_UINT8) ; + GETNAME (GrB_IDENTITY_UINT16) ; + GETNAME (GrB_IDENTITY_UINT32) ; + GETNAME (GrB_IDENTITY_UINT64) ; + GETNAME (GrB_IDENTITY_FP32) ; + GETNAME (GrB_IDENTITY_FP64) ; + GETNAME (GxB_IDENTITY_FC32) ; + GETNAME (GxB_IDENTITY_FC64) ; + + GETNAME (GrB_AINV_BOOL) ; + GETNAME (GrB_AINV_INT8) ; + GETNAME (GrB_AINV_INT16) ; + GETNAME (GrB_AINV_INT32) ; + GETNAME (GrB_AINV_INT64) ; + GETNAME (GrB_AINV_UINT8) ; + GETNAME (GrB_AINV_UINT16) ; + GETNAME (GrB_AINV_UINT32) ; + GETNAME (GrB_AINV_UINT64) ; + GETNAME (GrB_AINV_FP32) ; + GETNAME (GrB_AINV_FP64) ; + GETNAME (GxB_AINV_FC32) ; + GETNAME (GxB_AINV_FC64) ; + + GETNAME (GrB_MINV_BOOL) ; + GETNAME (GrB_MINV_INT8) ; + GETNAME (GrB_MINV_INT16) ; + GETNAME (GrB_MINV_INT32) ; + GETNAME (GrB_MINV_INT64) ; + GETNAME (GrB_MINV_UINT8) ; + GETNAME (GrB_MINV_UINT16) ; + GETNAME (GrB_MINV_UINT32) ; + GETNAME (GrB_MINV_UINT64) ; + GETNAME (GrB_MINV_FP32) ; + GETNAME (GrB_MINV_FP64) ; + GETNAME (GxB_MINV_FC32) ; + GETNAME (GxB_MINV_FC64) ; + + GETNAME (GrB_LNOT) ; + GETNAM2 (GxB_LNOT_BOOL, "GrB_LNOT") ; + GETNAME (GxB_LNOT_INT8) ; + GETNAME (GxB_LNOT_INT16) ; + GETNAME (GxB_LNOT_INT32) ; + GETNAME (GxB_LNOT_INT64) ; + GETNAME (GxB_LNOT_UINT8) ; + GETNAME (GxB_LNOT_UINT16) ; + GETNAME (GxB_LNOT_UINT32) ; + GETNAME (GxB_LNOT_UINT64) ; + GETNAME (GxB_LNOT_FP32) ; + GETNAME (GxB_LNOT_FP64) ; + + GETNAME (GxB_ONE_BOOL) ; + GETNAME (GxB_ONE_INT8) ; + GETNAME (GxB_ONE_INT16) ; + GETNAME (GxB_ONE_INT32) ; + GETNAME (GxB_ONE_INT64) ; + GETNAME (GxB_ONE_UINT8) ; + GETNAME (GxB_ONE_UINT16) ; + GETNAME (GxB_ONE_UINT32) ; + GETNAME (GxB_ONE_UINT64) ; + GETNAME (GxB_ONE_FP32) ; + GETNAME (GxB_ONE_FP64) ; + GETNAME (GxB_ONE_FC32) ; + GETNAME (GxB_ONE_FC64) ; + + GETNAME (GrB_ABS_BOOL) ; + GETNAME (GrB_ABS_INT8) ; + GETNAME (GrB_ABS_INT16) ; + GETNAME (GrB_ABS_INT32) ; + GETNAME (GrB_ABS_INT64) ; + GETNAME (GrB_ABS_UINT8) ; + GETNAME (GrB_ABS_UINT16) ; + GETNAME (GrB_ABS_UINT32) ; + GETNAME (GrB_ABS_UINT64) ; + GETNAME (GrB_ABS_FP32) ; + GETNAME (GrB_ABS_FP64) ; + + GETNAME (GrB_BNOT_INT8) ; + GETNAME (GrB_BNOT_INT16) ; + GETNAME (GrB_BNOT_INT32) ; + GETNAME (GrB_BNOT_INT64) ; + GETNAME (GrB_BNOT_UINT8) ; + GETNAME (GrB_BNOT_UINT16) ; + GETNAME (GrB_BNOT_UINT32) ; + GETNAME (GrB_BNOT_UINT64) ; + + GETNAM2 (GxB_ABS_BOOL, "GrB_ABS_BOOL") ; + GETNAM2 (GxB_ABS_INT8, "GrB_ABS_INT8") ; + GETNAM2 (GxB_ABS_INT16, "GrB_ABS_INT16") ; + GETNAM2 (GxB_ABS_INT32, "GrB_ABS_INT32") ; + GETNAM2 (GxB_ABS_INT64, "GrB_ABS_INT64") ; + GETNAM2 (GxB_ABS_UINT8, "GrB_ABS_UINT8") ; + GETNAM2 (GxB_ABS_UINT16, "GrB_ABS_UINT16") ; + GETNAM2 (GxB_ABS_UINT32, "GrB_ABS_UINT32") ; + GETNAM2 (GxB_ABS_UINT64, "GrB_ABS_UINT64") ; + GETNAM2 (GxB_ABS_FP32, "GrB_ABS_FP32") ; + GETNAM2 (GxB_ABS_FP64, "GrB_ABS_FP64") ; + GETNAME (GxB_ABS_FC32) ; + GETNAME (GxB_ABS_FC64) ; + + GETNAME (GxB_SQRT_FP32) ; + GETNAME (GxB_SQRT_FP64) ; + GETNAME (GxB_SQRT_FC32) ; + GETNAME (GxB_SQRT_FC64) ; + + GETNAME (GxB_LOG_FP32) ; + GETNAME (GxB_LOG_FP64) ; + GETNAME (GxB_LOG_FC32) ; + GETNAME (GxB_LOG_FC64) ; + + GETNAME (GxB_EXP_FP32) ; + GETNAME (GxB_EXP_FP64) ; + GETNAME (GxB_EXP_FC32) ; + GETNAME (GxB_EXP_FC64) ; + + GETNAME (GxB_LOG2_FP32) ; + GETNAME (GxB_LOG2_FP64) ; + GETNAME (GxB_LOG2_FC32) ; + GETNAME (GxB_LOG2_FC64) ; + + GETNAME (GxB_SIN_FP32) ; + GETNAME (GxB_SIN_FP64) ; + GETNAME (GxB_SIN_FC32) ; + GETNAME (GxB_SIN_FC64) ; + + GETNAME (GxB_COS_FP32) ; + GETNAME (GxB_COS_FP64) ; + GETNAME (GxB_COS_FC32) ; + GETNAME (GxB_COS_FC64) ; + + GETNAME (GxB_TAN_FP32) ; + GETNAME (GxB_TAN_FP64) ; + GETNAME (GxB_TAN_FC32) ; + GETNAME (GxB_TAN_FC64) ; + + GETNAME (GxB_ACOS_FP32) ; + GETNAME (GxB_ACOS_FP64) ; + GETNAME (GxB_ACOS_FC32) ; + GETNAME (GxB_ACOS_FC64) ; + + GETNAME (GxB_ASIN_FP32) ; + GETNAME (GxB_ASIN_FP64) ; + GETNAME (GxB_ASIN_FC32) ; + GETNAME (GxB_ASIN_FC64) ; + + GETNAME (GxB_ATAN_FP32) ; + GETNAME (GxB_ATAN_FP64) ; + GETNAME (GxB_ATAN_FC32) ; + GETNAME (GxB_ATAN_FC64) ; + + GETNAME (GxB_SINH_FP32) ; + GETNAME (GxB_SINH_FP64) ; + GETNAME (GxB_SINH_FC32) ; + GETNAME (GxB_SINH_FC64) ; + + GETNAME (GxB_COSH_FP32) ; + GETNAME (GxB_COSH_FP64) ; + GETNAME (GxB_COSH_FC32) ; + GETNAME (GxB_COSH_FC64) ; + + GETNAME (GxB_TANH_FP32) ; + GETNAME (GxB_TANH_FP64) ; + GETNAME (GxB_TANH_FC32) ; + GETNAME (GxB_TANH_FC64) ; + + GETNAME (GxB_ATANH_FP32) ; + GETNAME (GxB_ATANH_FP64) ; + GETNAME (GxB_ATANH_FC32) ; + GETNAME (GxB_ATANH_FC64) ; + + GETNAME (GxB_ASINH_FP32) ; + GETNAME (GxB_ASINH_FP64) ; + GETNAME (GxB_ASINH_FC32) ; + GETNAME (GxB_ASINH_FC64) ; + + GETNAME (GxB_ACOSH_FP32) ; + GETNAME (GxB_ACOSH_FP64) ; + GETNAME (GxB_ACOSH_FC32) ; + GETNAME (GxB_ACOSH_FC64) ; + + GETNAME (GxB_SIGNUM_FP32) ; + GETNAME (GxB_SIGNUM_FP64) ; + GETNAME (GxB_SIGNUM_FC32) ; + GETNAME (GxB_SIGNUM_FC64) ; + + GETNAME (GxB_CEIL_FP32) ; + GETNAME (GxB_CEIL_FP64) ; + GETNAME (GxB_CEIL_FC32) ; + GETNAME (GxB_CEIL_FC64) ; + + GETNAME (GxB_FLOOR_FP32) ; + GETNAME (GxB_FLOOR_FP64) ; + GETNAME (GxB_FLOOR_FC32) ; + GETNAME (GxB_FLOOR_FC64) ; + + GETNAME (GxB_ROUND_FP32) ; + GETNAME (GxB_ROUND_FP64) ; + GETNAME (GxB_ROUND_FC32) ; + GETNAME (GxB_ROUND_FC64) ; + + GETNAME (GxB_TRUNC_FP32) ; + GETNAME (GxB_TRUNC_FP64) ; + GETNAME (GxB_TRUNC_FC32) ; + GETNAME (GxB_TRUNC_FC64) ; + + GETNAME (GxB_EXP2_FP32) ; + GETNAME (GxB_EXP2_FP64) ; + GETNAME (GxB_EXP2_FC32) ; + GETNAME (GxB_EXP2_FC64) ; + + GETNAME (GxB_EXPM1_FP32) ; + GETNAME (GxB_EXPM1_FP64) ; + GETNAME (GxB_EXPM1_FC32) ; + GETNAME (GxB_EXPM1_FC64) ; + + GETNAME (GxB_LOG10_FP32) ; + GETNAME (GxB_LOG10_FP64) ; + GETNAME (GxB_LOG10_FC32) ; + GETNAME (GxB_LOG10_FC64) ; + + GETNAME (GxB_LOG1P_FP32) ; + GETNAME (GxB_LOG1P_FP64) ; + GETNAME (GxB_LOG1P_FC32) ; + GETNAME (GxB_LOG1P_FC64) ; + + GETNAME (GxB_LGAMMA_FP32) ; + GETNAME (GxB_LGAMMA_FP64) ; + + GETNAME (GxB_TGAMMA_FP32) ; + GETNAME (GxB_TGAMMA_FP64) ; + + GETNAME (GxB_ERF_FP32) ; + GETNAME (GxB_ERF_FP64) ; + + GETNAME (GxB_ERFC_FP32) ; + GETNAME (GxB_ERFC_FP64) ; + + GETNAME (GxB_CBRT_FP32) ; + GETNAME (GxB_CBRT_FP64) ; + + GETNAME (GxB_FREXPX_FP32) ; + GETNAME (GxB_FREXPX_FP64) ; + + GETNAME (GxB_FREXPE_FP32) ; + GETNAME (GxB_FREXPE_FP64) ; + + GETNAME (GxB_CONJ_FC32) ; + GETNAME (GxB_CONJ_FC64) ; + + GETNAME (GxB_CREAL_FC32) ; + GETNAME (GxB_CREAL_FC64) ; + + GETNAME (GxB_CIMAG_FC32) ; + GETNAME (GxB_CIMAG_FC64) ; + + GETNAME (GxB_CARG_FC32) ; + GETNAME (GxB_CARG_FC64) ; + + GETNAME (GxB_ISINF_FP32) ; + GETNAME (GxB_ISINF_FP64) ; + GETNAME (GxB_ISINF_FC32) ; + GETNAME (GxB_ISINF_FC64) ; + + GETNAME (GxB_ISNAN_FP32) ; + GETNAME (GxB_ISNAN_FP64) ; + GETNAME (GxB_ISNAN_FC32) ; + GETNAME (GxB_ISNAN_FC64) ; + + GETNAME (GxB_ISFINITE_FP32) ; + GETNAME (GxB_ISFINITE_FP64) ; + GETNAME (GxB_ISFINITE_FC32) ; + GETNAME (GxB_ISFINITE_FC64) ; + + GETNAME (GxB_POSITIONI_INT32) ; + GETNAME (GxB_POSITIONI_INT64) ; + GETNAME (GxB_POSITIONI1_INT32) ; + GETNAME (GxB_POSITIONI1_INT64) ; + + GETNAME (GxB_POSITIONJ_INT32) ; + GETNAME (GxB_POSITIONJ_INT64) ; + GETNAME (GxB_POSITIONJ1_INT32) ; + GETNAME (GxB_POSITIONJ1_INT64) ; + + //-------------------------------------------------------------------------- + // other get/set methods for GrB_UnaryOp + //-------------------------------------------------------------------------- + + OK (GrB_UnaryOp_get_INT32_(GrB_ABS_FP32, &code, GrB_INP0_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_UnaryOp_get_String_(GrB_ABS_FP32, name, GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_UnaryOp_get_INT32_(GrB_ABS_FP64, &code, GrB_OUTP_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_UnaryOp_get_String_(GrB_ABS_FP64, name, GrB_OUTP_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP64")) ; + + OK (GrB_UnaryOp_get_Scalar_(GrB_ABS_FP32, s_int32, GrB_INP0_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_UnaryOp_get_Scalar_(GrB_LNOT, s_int32, GrB_OUTP_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + expected = GrB_NO_VALUE ; + ERR (GrB_UnaryOp_get_INT32_(GrB_BNOT_UINT8, &code, GrB_INP1_TYPE_CODE)) ; + ERR (GrB_UnaryOp_get_Scalar_(GrB_LNOT, s_int32, GrB_INP1_TYPE_CODE)) ; + ERR (GrB_UnaryOp_get_String_(GrB_BNOT_UINT8, name, GrB_INP1_TYPE_STRING)) ; + ERR (GrB_UnaryOp_get_SIZE_(GrB_BNOT_UINT8, &size, GrB_INP1_TYPE_STRING)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_UnaryOp_get_INT32_(GrB_BNOT_UINT8, &code, GrB_NAME)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_UnaryOp_get_VOID_(GrB_LNOT, nothing, 0)) ; + + OK (GrB_UnaryOp_new (&unop, myfunc, GrB_FP32, GrB_FP32)) ; + OK (GrB_UnaryOp_get_SIZE_(unop, &size, GrB_NAME)) ; + CHECK (size == 1) ; + OK (GrB_UnaryOp_get_SIZE_(unop, &size, GxB_JIT_C_NAME)) ; + CHECK (size == 1) ; + OK (GrB_UnaryOp_get_SIZE_(unop, &size, GxB_JIT_C_DEFINITION)) ; + CHECK (size == 1) ; + + expected = GrB_INVALID_VALUE ; + OK (GrB_UnaryOp_set_String_(unop, "myfunc", GxB_JIT_C_NAME)) ; + OK (GrB_UnaryOp_get_String_(unop, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "myfunc")) ; + + CHECK (unop->hash == UINT64_MAX) ; + METHOD (GrB_UnaryOp_set_String (unop, MYFUNC_DEFN, GxB_JIT_C_DEFINITION)) ; + OK (GrB_UnaryOp_get_String_(unop, defn, GxB_JIT_C_DEFINITION)) ; + CHECK (MATCH (defn, MYFUNC_DEFN)) ; + CHECK (unop->hash != UINT64_MAX) ; + OK (GxB_print (unop, 3)) ; + + OK (GrB_UnaryOp_set_String_(unop, "user name for myfunc", GrB_NAME)) ; + OK (GrB_UnaryOp_get_String_(unop, name, GrB_NAME)) ; + CHECK (MATCH (name, "user name for myfunc")) ; + expected = GrB_ALREADY_SET ; + ERR (GrB_UnaryOp_set_String_(unop, "another user name", GrB_NAME)) ; + printf (" test GrB_ALREADY_SET: ok\n") ; + + expected = GrB_NO_VALUE ; + ERR (GrB_UnaryOp_get_INT32_(unop, &code, GrB_INP1_TYPE_CODE)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_UnaryOp_set_String_(unop, "another_name", 999)) ; + ERR (GrB_UnaryOp_get_SIZE(unop, &size, 999)) ; + + expected = GrB_ALREADY_SET ; + ERR (GrB_UnaryOp_set_String_(unop, "another_name", GxB_JIT_C_NAME)) ; + ERR (GrB_UnaryOp_set_String_(unop, "another_defn", GxB_JIT_C_DEFINITION)) ; + CHECK (MATCH ("GrB_ALREADY_SET", GB_status_code (GrB_ALREADY_SET))) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_UnaryOp_set_String_(GrB_LNOT, "another_name", GxB_JIT_C_NAME)) ; + ERR (GrB_UnaryOp_set_Scalar_(unop, s_int32, 0)) ; + ERR (GrB_UnaryOp_set_INT32_(unop, 0, 0)) ; + ERR (GrB_UnaryOp_set_VOID_(unop, nothing, 0, 0)) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&unop) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test27: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test28.c b/GraphBLAS/Test/GB_mex_test28.c new file mode 100644 index 0000000000..cd7899b959 --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test28.c @@ -0,0 +1,680 @@ +//------------------------------------------------------------------------------ +// GB_mex_test28: test GrB_get and GrB_set (binary ops) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test28" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +#define GETOP(op,opname) \ +{ \ + size_t siz1, siz2, siz3 ; \ + OK (GrB_BinaryOp_get_String (op, name, GrB_NAME)) ; \ + CHECK (MATCH (name, opname)) ; \ + OK (GrB_BinaryOp_get_String (op, cname, GxB_JIT_C_NAME)) ; \ + printf ("%s: %s\n", name, cname) ; \ + OK (GrB_BinaryOp_get_SIZE (op, &size, GrB_NAME)) ; \ + CHECK (size == strlen (name) + 1) ; \ + GrB_Info info2, info3 ; \ + info2 = GrB_BinaryOp_get_SIZE (op, &siz1, GrB_INP0_TYPE_STRING) ; \ + info3 = GrB_BinaryOp_get_String (op, name, GrB_INP0_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz1 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz1 == 1) ; } \ + info2 = GrB_BinaryOp_get_SIZE (op, &siz2, GrB_INP1_TYPE_STRING) ; \ + info3 = GrB_BinaryOp_get_String (op, name, GrB_INP1_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz2 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz2 == 1) ; } \ + info2 = GrB_BinaryOp_get_SIZE (op, &siz3, GrB_OUTP_TYPE_STRING) ; \ + info3 = GrB_BinaryOp_get_String (op, name, GrB_OUTP_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz3 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz3 == 1) ; } \ +} + +#define GETNAME(op) \ +{ \ + GETOP (op, #op) ; \ +/* OK (GxB_BinaryOp_fprint (op, "binop", 3, NULL)) ; */ \ +} + +#define GETNAM2(op,alias) \ +{ \ + GETOP (op,alias) ; \ +/* OK (GxB_BinaryOp_fprint (op, "binop", 3, NULL)) ; */ \ +} + +void myfunc (float *z, const float *x, const float *y) ; +void myfunc (float *z, const float *x, const float *y) { (*z) = (*x)+(*y) ; } +#define MYFUNC_DEFN \ +"void myfunc (float *z, const float *x, const float *y) { (*z) = (*x)+(*y) ; }" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_BinaryOp binop = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char cname [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GrB_BinaryOp get name + //-------------------------------------------------------------------------- + + GETNAME (GrB_FIRST_BOOL) ; + GETNAME (GrB_FIRST_INT8) ; + GETNAME (GrB_FIRST_INT16) ; + GETNAME (GrB_FIRST_INT32) ; + GETNAME (GrB_FIRST_INT64) ; + GETNAME (GrB_FIRST_UINT8) ; + GETNAME (GrB_FIRST_UINT16) ; + GETNAME (GrB_FIRST_UINT32) ; + GETNAME (GrB_FIRST_UINT64) ; + GETNAME (GrB_FIRST_FP32) ; + GETNAME (GrB_FIRST_FP64) ; + GETNAME (GxB_FIRST_FC32) ; + GETNAME (GxB_FIRST_FC64) ; + + GETNAME (GrB_SECOND_BOOL) ; + GETNAME (GrB_SECOND_INT8) ; + GETNAME (GrB_SECOND_INT16) ; + GETNAME (GrB_SECOND_INT32) ; + GETNAME (GrB_SECOND_INT64) ; + GETNAME (GrB_SECOND_UINT8) ; + GETNAME (GrB_SECOND_UINT16) ; + GETNAME (GrB_SECOND_UINT32) ; + GETNAME (GrB_SECOND_UINT64) ; + GETNAME (GrB_SECOND_FP32) ; + GETNAME (GrB_SECOND_FP64) ; + GETNAME (GxB_SECOND_FC32) ; + GETNAME (GxB_SECOND_FC64) ; + + GETNAME (GrB_ONEB_BOOL) ; + GETNAME (GrB_ONEB_INT8) ; + GETNAME (GrB_ONEB_INT16) ; + GETNAME (GrB_ONEB_INT32) ; + GETNAME (GrB_ONEB_INT64) ; + GETNAME (GrB_ONEB_UINT8) ; + GETNAME (GrB_ONEB_UINT16) ; + GETNAME (GrB_ONEB_UINT32) ; + GETNAME (GrB_ONEB_UINT64) ; + GETNAME (GrB_ONEB_FP32) ; + GETNAME (GrB_ONEB_FP64) ; + GETNAME (GxB_ONEB_FC32) ; + GETNAME (GxB_ONEB_FC64) ; + + GETNAME (GxB_POW_BOOL) ; + GETNAME (GxB_POW_INT8) ; + GETNAME (GxB_POW_INT16) ; + GETNAME (GxB_POW_INT32) ; + GETNAME (GxB_POW_INT64) ; + GETNAME (GxB_POW_UINT8) ; + GETNAME (GxB_POW_UINT16) ; + GETNAME (GxB_POW_UINT32) ; + GETNAME (GxB_POW_UINT64) ; + GETNAME (GxB_POW_FP32) ; + GETNAME (GxB_POW_FP64) ; + GETNAME (GxB_POW_FC32) ; + GETNAME (GxB_POW_FC64) ; + + GETNAME (GrB_PLUS_BOOL) ; + GETNAME (GrB_PLUS_INT8) ; + GETNAME (GrB_PLUS_INT16) ; + GETNAME (GrB_PLUS_INT32) ; + GETNAME (GrB_PLUS_INT64) ; + GETNAME (GrB_PLUS_UINT8) ; + GETNAME (GrB_PLUS_UINT16) ; + GETNAME (GrB_PLUS_UINT32) ; + GETNAME (GrB_PLUS_UINT64) ; + GETNAME (GrB_PLUS_FP32) ; + GETNAME (GrB_PLUS_FP64) ; + GETNAME (GxB_PLUS_FC32) ; + GETNAME (GxB_PLUS_FC64) ; + + GETNAME (GrB_MINUS_BOOL) ; + GETNAME (GrB_MINUS_INT8) ; + GETNAME (GrB_MINUS_INT16) ; + GETNAME (GrB_MINUS_INT32) ; + GETNAME (GrB_MINUS_INT64) ; + GETNAME (GrB_MINUS_UINT8) ; + GETNAME (GrB_MINUS_UINT16) ; + GETNAME (GrB_MINUS_UINT32) ; + GETNAME (GrB_MINUS_UINT64) ; + GETNAME (GrB_MINUS_FP32) ; + GETNAME (GrB_MINUS_FP64) ; + GETNAME (GxB_MINUS_FC32) ; + GETNAME (GxB_MINUS_FC64) ; + + GETNAME (GrB_TIMES_BOOL) ; + GETNAME (GrB_TIMES_INT8) ; + GETNAME (GrB_TIMES_INT16) ; + GETNAME (GrB_TIMES_INT32) ; + GETNAME (GrB_TIMES_INT64) ; + GETNAME (GrB_TIMES_UINT8) ; + GETNAME (GrB_TIMES_UINT16) ; + GETNAME (GrB_TIMES_UINT32) ; + GETNAME (GrB_TIMES_UINT64) ; + GETNAME (GrB_TIMES_FP32) ; + GETNAME (GrB_TIMES_FP64) ; + GETNAME (GxB_TIMES_FC32) ; + GETNAME (GxB_TIMES_FC64) ; + + GETNAME (GrB_DIV_BOOL) ; + GETNAME (GrB_DIV_INT8) ; + GETNAME (GrB_DIV_INT16) ; + GETNAME (GrB_DIV_INT32) ; + GETNAME (GrB_DIV_INT64) ; + GETNAME (GrB_DIV_UINT8) ; + GETNAME (GrB_DIV_UINT16) ; + GETNAME (GrB_DIV_UINT32) ; + GETNAME (GrB_DIV_UINT64) ; + GETNAME (GrB_DIV_FP32) ; + GETNAME (GrB_DIV_FP64) ; + GETNAME (GxB_DIV_FC32) ; + GETNAME (GxB_DIV_FC64) ; + + GETNAME (GxB_RMINUS_BOOL) ; + GETNAME (GxB_RMINUS_INT8) ; + GETNAME (GxB_RMINUS_INT16) ; + GETNAME (GxB_RMINUS_INT32) ; + GETNAME (GxB_RMINUS_INT64) ; + GETNAME (GxB_RMINUS_UINT8) ; + GETNAME (GxB_RMINUS_UINT16) ; + GETNAME (GxB_RMINUS_UINT32) ; + GETNAME (GxB_RMINUS_UINT64) ; + GETNAME (GxB_RMINUS_FP32) ; + GETNAME (GxB_RMINUS_FP64) ; + GETNAME (GxB_RMINUS_FC32) ; + GETNAME (GxB_RMINUS_FC64) ; + + GETNAME (GxB_RDIV_BOOL) ; + GETNAME (GxB_RDIV_INT8) ; + GETNAME (GxB_RDIV_INT16) ; + GETNAME (GxB_RDIV_INT32) ; + GETNAME (GxB_RDIV_INT64) ; + GETNAME (GxB_RDIV_UINT8) ; + GETNAME (GxB_RDIV_UINT16) ; + GETNAME (GxB_RDIV_UINT32) ; + GETNAME (GxB_RDIV_UINT64) ; + GETNAME (GxB_RDIV_FP32) ; + GETNAME (GxB_RDIV_FP64) ; + GETNAME (GxB_RDIV_FC32) ; + GETNAME (GxB_RDIV_FC64) ; + + GETNAM2 (GxB_PAIR_BOOL, "GrB_ONEB_BOOL") ; + GETNAM2 (GxB_PAIR_INT8, "GrB_ONEB_INT8") ; + GETNAM2 (GxB_PAIR_INT16, "GrB_ONEB_INT16") ; + GETNAM2 (GxB_PAIR_INT32, "GrB_ONEB_INT32") ; + GETNAM2 (GxB_PAIR_INT64, "GrB_ONEB_INT64") ; + GETNAM2 (GxB_PAIR_UINT8, "GrB_ONEB_UINT8") ; + GETNAM2 (GxB_PAIR_UINT16, "GrB_ONEB_UINT16") ; + GETNAM2 (GxB_PAIR_UINT32, "GrB_ONEB_UINT32") ; + GETNAM2 (GxB_PAIR_UINT64, "GrB_ONEB_UINT64") ; + GETNAM2 (GxB_PAIR_FP32, "GrB_ONEB_FP32") ; + GETNAM2 (GxB_PAIR_FP64, "GrB_ONEB_FP64") ; + GETNAM2 (GxB_PAIR_FC32, "GxB_ONEB_FC32") ; + GETNAM2 (GxB_PAIR_FC64, "GxB_ONEB_FC64") ; + + GETNAME (GxB_ANY_BOOL) ; + GETNAME (GxB_ANY_INT8) ; + GETNAME (GxB_ANY_INT16) ; + GETNAME (GxB_ANY_INT32) ; + GETNAME (GxB_ANY_INT64) ; + GETNAME (GxB_ANY_UINT8) ; + GETNAME (GxB_ANY_UINT16) ; + GETNAME (GxB_ANY_UINT32) ; + GETNAME (GxB_ANY_UINT64) ; + GETNAME (GxB_ANY_FP32) ; + GETNAME (GxB_ANY_FP64) ; + GETNAME (GxB_ANY_FC32) ; + GETNAME (GxB_ANY_FC64) ; + + GETNAME (GxB_ISEQ_BOOL) ; + GETNAME (GxB_ISEQ_INT8) ; + GETNAME (GxB_ISEQ_INT16) ; + GETNAME (GxB_ISEQ_INT32) ; + GETNAME (GxB_ISEQ_INT64) ; + GETNAME (GxB_ISEQ_UINT8) ; + GETNAME (GxB_ISEQ_UINT16) ; + GETNAME (GxB_ISEQ_UINT32) ; + GETNAME (GxB_ISEQ_UINT64) ; + GETNAME (GxB_ISEQ_FP32) ; + GETNAME (GxB_ISEQ_FP64) ; + GETNAME (GxB_ISEQ_FC32) ; + GETNAME (GxB_ISEQ_FC64) ; + + GETNAME (GxB_ISNE_BOOL) ; + GETNAME (GxB_ISNE_INT8) ; + GETNAME (GxB_ISNE_INT16) ; + GETNAME (GxB_ISNE_INT32) ; + GETNAME (GxB_ISNE_INT64) ; + GETNAME (GxB_ISNE_UINT8) ; + GETNAME (GxB_ISNE_UINT16) ; + GETNAME (GxB_ISNE_UINT32) ; + GETNAME (GxB_ISNE_UINT64) ; + GETNAME (GxB_ISNE_FP32) ; + GETNAME (GxB_ISNE_FP64) ; + GETNAME (GxB_ISNE_FC32) ; + GETNAME (GxB_ISNE_FC64) ; + + GETNAME (GxB_ISGT_BOOL) ; + GETNAME (GxB_ISGT_INT8) ; + GETNAME (GxB_ISGT_INT16) ; + GETNAME (GxB_ISGT_INT32) ; + GETNAME (GxB_ISGT_INT64) ; + GETNAME (GxB_ISGT_UINT8) ; + GETNAME (GxB_ISGT_UINT16) ; + GETNAME (GxB_ISGT_UINT32) ; + GETNAME (GxB_ISGT_UINT64) ; + GETNAME (GxB_ISGT_FP32) ; + GETNAME (GxB_ISGT_FP64) ; + + GETNAME (GxB_ISLT_BOOL) ; + GETNAME (GxB_ISLT_INT8) ; + GETNAME (GxB_ISLT_INT16) ; + GETNAME (GxB_ISLT_INT32) ; + GETNAME (GxB_ISLT_INT64) ; + GETNAME (GxB_ISLT_UINT8) ; + GETNAME (GxB_ISLT_UINT16) ; + GETNAME (GxB_ISLT_UINT32) ; + GETNAME (GxB_ISLT_UINT64) ; + GETNAME (GxB_ISLT_FP32) ; + GETNAME (GxB_ISLT_FP64) ; + + GETNAME (GxB_ISGE_BOOL) ; + GETNAME (GxB_ISGE_INT8) ; + GETNAME (GxB_ISGE_INT16) ; + GETNAME (GxB_ISGE_INT32) ; + GETNAME (GxB_ISGE_INT64) ; + GETNAME (GxB_ISGE_UINT8) ; + GETNAME (GxB_ISGE_UINT16) ; + GETNAME (GxB_ISGE_UINT32) ; + GETNAME (GxB_ISGE_UINT64) ; + GETNAME (GxB_ISGE_FP32) ; + GETNAME (GxB_ISGE_FP64) ; + + GETNAME (GxB_ISLE_BOOL) ; + GETNAME (GxB_ISLE_INT8) ; + GETNAME (GxB_ISLE_INT16) ; + GETNAME (GxB_ISLE_INT32) ; + GETNAME (GxB_ISLE_INT64) ; + GETNAME (GxB_ISLE_UINT8) ; + GETNAME (GxB_ISLE_UINT16) ; + GETNAME (GxB_ISLE_UINT32) ; + GETNAME (GxB_ISLE_UINT64) ; + GETNAME (GxB_ISLE_FP32) ; + GETNAME (GxB_ISLE_FP64) ; + + GETNAME (GrB_MIN_BOOL) ; + GETNAME (GrB_MIN_INT8) ; + GETNAME (GrB_MIN_INT16) ; + GETNAME (GrB_MIN_INT32) ; + GETNAME (GrB_MIN_INT64) ; + GETNAME (GrB_MIN_UINT8) ; + GETNAME (GrB_MIN_UINT16) ; + GETNAME (GrB_MIN_UINT32) ; + GETNAME (GrB_MIN_UINT64) ; + GETNAME (GrB_MIN_FP32) ; + GETNAME (GrB_MIN_FP64) ; + + GETNAME (GrB_MAX_BOOL) ; + GETNAME (GrB_MAX_INT8) ; + GETNAME (GrB_MAX_INT16) ; + GETNAME (GrB_MAX_INT32) ; + GETNAME (GrB_MAX_INT64) ; + GETNAME (GrB_MAX_UINT8) ; + GETNAME (GrB_MAX_UINT16) ; + GETNAME (GrB_MAX_UINT32) ; + GETNAME (GrB_MAX_UINT64) ; + GETNAME (GrB_MAX_FP32) ; + GETNAME (GrB_MAX_FP64) ; + + GETNAME (GrB_LOR) ; + GETNAM2 (GxB_LOR_BOOL, "GrB_LOR") ; + GETNAME (GxB_LOR_INT8) ; + GETNAME (GxB_LOR_INT16) ; + GETNAME (GxB_LOR_INT32) ; + GETNAME (GxB_LOR_INT64) ; + GETNAME (GxB_LOR_UINT8) ; + GETNAME (GxB_LOR_UINT16) ; + GETNAME (GxB_LOR_UINT32) ; + GETNAME (GxB_LOR_UINT64) ; + GETNAME (GxB_LOR_FP32) ; + GETNAME (GxB_LOR_FP64) ; + + GETNAME (GrB_LAND) ; + GETNAM2 (GxB_LAND_BOOL, "GrB_LAND") ; + GETNAME (GxB_LAND_INT8) ; + GETNAME (GxB_LAND_INT16) ; + GETNAME (GxB_LAND_INT32) ; + GETNAME (GxB_LAND_INT64) ; + GETNAME (GxB_LAND_UINT8) ; + GETNAME (GxB_LAND_UINT16) ; + GETNAME (GxB_LAND_UINT32) ; + GETNAME (GxB_LAND_UINT64) ; + GETNAME (GxB_LAND_FP32) ; + GETNAME (GxB_LAND_FP64) ; + + GETNAME (GrB_LXOR) ; + GETNAM2 (GxB_LXOR_BOOL, "GrB_LXOR") ; + GETNAME (GxB_LXOR_INT8) ; + GETNAME (GxB_LXOR_INT16) ; + GETNAME (GxB_LXOR_INT32) ; + GETNAME (GxB_LXOR_INT64) ; + GETNAME (GxB_LXOR_UINT8) ; + GETNAME (GxB_LXOR_UINT16) ; + GETNAME (GxB_LXOR_UINT32) ; + GETNAME (GxB_LXOR_UINT64) ; + GETNAME (GxB_LXOR_FP32) ; + GETNAME (GxB_LXOR_FP64) ; + + GETNAME (GrB_LXNOR) ; + + GETNAME (GxB_ATAN2_FP32) ; + GETNAME (GxB_ATAN2_FP64) ; + + GETNAME (GxB_HYPOT_FP32) ; + GETNAME (GxB_HYPOT_FP64) ; + + GETNAME (GxB_FMOD_FP32) ; + GETNAME (GxB_FMOD_FP64) ; + + GETNAME (GxB_REMAINDER_FP32) ; + GETNAME (GxB_REMAINDER_FP64) ; + + GETNAME (GxB_LDEXP_FP32) ; + GETNAME (GxB_LDEXP_FP64) ; + + GETNAME (GxB_COPYSIGN_FP32) ; + GETNAME (GxB_COPYSIGN_FP64) ; + + GETNAME (GrB_BOR_INT8) ; + GETNAME (GrB_BOR_INT16) ; + GETNAME (GrB_BOR_INT32) ; + GETNAME (GrB_BOR_INT64) ; + GETNAME (GrB_BOR_UINT8) ; + GETNAME (GrB_BOR_UINT16) ; + GETNAME (GrB_BOR_UINT32) ; + GETNAME (GrB_BOR_UINT64) ; + + GETNAME (GrB_BAND_INT8) ; + GETNAME (GrB_BAND_INT16) ; + GETNAME (GrB_BAND_INT32) ; + GETNAME (GrB_BAND_INT64) ; + GETNAME (GrB_BAND_UINT8) ; + GETNAME (GrB_BAND_UINT16) ; + GETNAME (GrB_BAND_UINT32) ; + GETNAME (GrB_BAND_UINT64) ; + + GETNAME (GrB_BXOR_INT8) ; + GETNAME (GrB_BXOR_INT16) ; + GETNAME (GrB_BXOR_INT32) ; + GETNAME (GrB_BXOR_INT64) ; + GETNAME (GrB_BXOR_UINT8) ; + GETNAME (GrB_BXOR_UINT16) ; + GETNAME (GrB_BXOR_UINT32) ; + GETNAME (GrB_BXOR_UINT64) ; + + GETNAME (GrB_BXNOR_INT8) ; + GETNAME (GrB_BXNOR_INT16) ; + GETNAME (GrB_BXNOR_INT32) ; + GETNAME (GrB_BXNOR_INT64) ; + GETNAME (GrB_BXNOR_UINT8) ; + GETNAME (GrB_BXNOR_UINT16) ; + GETNAME (GrB_BXNOR_UINT32) ; + GETNAME (GrB_BXNOR_UINT64) ; + + GETNAME (GxB_BGET_INT8) ; + GETNAME (GxB_BGET_INT16) ; + GETNAME (GxB_BGET_INT32) ; + GETNAME (GxB_BGET_INT64) ; + GETNAME (GxB_BGET_UINT8) ; + GETNAME (GxB_BGET_UINT16) ; + GETNAME (GxB_BGET_UINT32) ; + GETNAME (GxB_BGET_UINT64) ; + + GETNAME (GxB_BSET_INT8) ; + GETNAME (GxB_BSET_INT16) ; + GETNAME (GxB_BSET_INT32) ; + GETNAME (GxB_BSET_INT64) ; + GETNAME (GxB_BSET_UINT8) ; + GETNAME (GxB_BSET_UINT16) ; + GETNAME (GxB_BSET_UINT32) ; + GETNAME (GxB_BSET_UINT64) ; + + GETNAME (GxB_BCLR_INT8) ; + GETNAME (GxB_BCLR_INT16) ; + GETNAME (GxB_BCLR_INT32) ; + GETNAME (GxB_BCLR_INT64) ; + GETNAME (GxB_BCLR_UINT8) ; + GETNAME (GxB_BCLR_UINT16) ; + GETNAME (GxB_BCLR_UINT32) ; + GETNAME (GxB_BCLR_UINT64) ; + + GETNAME (GxB_BSHIFT_INT8) ; + GETNAME (GxB_BSHIFT_INT16) ; + GETNAME (GxB_BSHIFT_INT32) ; + GETNAME (GxB_BSHIFT_INT64) ; + GETNAME (GxB_BSHIFT_UINT8) ; + GETNAME (GxB_BSHIFT_UINT16) ; + GETNAME (GxB_BSHIFT_UINT32) ; + GETNAME (GxB_BSHIFT_UINT64) ; + + GETNAM2 (GrB_EQ_BOOL, "GrB_LXNOR") ; + GETNAME (GrB_EQ_INT8) ; + GETNAME (GrB_EQ_INT16) ; + GETNAME (GrB_EQ_INT32) ; + GETNAME (GrB_EQ_INT64) ; + GETNAME (GrB_EQ_UINT8) ; + GETNAME (GrB_EQ_UINT16) ; + GETNAME (GrB_EQ_UINT32) ; + GETNAME (GrB_EQ_UINT64) ; + GETNAME (GrB_EQ_FP32) ; + GETNAME (GrB_EQ_FP64) ; + GETNAME (GxB_EQ_FC32) ; + GETNAME (GxB_EQ_FC64) ; + + GETNAME (GrB_NE_BOOL) ; + GETNAME (GrB_NE_INT8) ; + GETNAME (GrB_NE_INT16) ; + GETNAME (GrB_NE_INT32) ; + GETNAME (GrB_NE_INT64) ; + GETNAME (GrB_NE_UINT8) ; + GETNAME (GrB_NE_UINT16) ; + GETNAME (GrB_NE_UINT32) ; + GETNAME (GrB_NE_UINT64) ; + GETNAME (GrB_NE_FP32) ; + GETNAME (GrB_NE_FP64) ; + GETNAME (GxB_NE_FC32) ; + GETNAME (GxB_NE_FC64) ; + + GETNAME (GrB_GT_BOOL) ; + GETNAME (GrB_GT_INT8) ; + GETNAME (GrB_GT_INT16) ; + GETNAME (GrB_GT_INT32) ; + GETNAME (GrB_GT_INT64) ; + GETNAME (GrB_GT_UINT8) ; + GETNAME (GrB_GT_UINT16) ; + GETNAME (GrB_GT_UINT32) ; + GETNAME (GrB_GT_UINT64) ; + GETNAME (GrB_GT_FP32) ; + GETNAME (GrB_GT_FP64) ; + + GETNAME (GrB_LT_BOOL) ; + GETNAME (GrB_LT_INT8) ; + GETNAME (GrB_LT_INT16) ; + GETNAME (GrB_LT_INT32) ; + GETNAME (GrB_LT_INT64) ; + GETNAME (GrB_LT_UINT8) ; + GETNAME (GrB_LT_UINT16) ; + GETNAME (GrB_LT_UINT32) ; + GETNAME (GrB_LT_UINT64) ; + GETNAME (GrB_LT_FP32) ; + GETNAME (GrB_LT_FP64) ; + + GETNAME (GrB_GE_BOOL) ; + GETNAME (GrB_GE_INT8) ; + GETNAME (GrB_GE_INT16) ; + GETNAME (GrB_GE_INT32) ; + GETNAME (GrB_GE_INT64) ; + GETNAME (GrB_GE_UINT8) ; + GETNAME (GrB_GE_UINT16) ; + GETNAME (GrB_GE_UINT32) ; + GETNAME (GrB_GE_UINT64) ; + GETNAME (GrB_GE_FP32) ; + GETNAME (GrB_GE_FP64) ; + + GETNAME (GrB_LE_BOOL) ; + GETNAME (GrB_LE_INT8) ; + GETNAME (GrB_LE_INT16) ; + GETNAME (GrB_LE_INT32) ; + GETNAME (GrB_LE_INT64) ; + GETNAME (GrB_LE_UINT8) ; + GETNAME (GrB_LE_UINT16) ; + GETNAME (GrB_LE_UINT32) ; + GETNAME (GrB_LE_UINT64) ; + GETNAME (GrB_LE_FP32) ; + GETNAME (GrB_LE_FP64) ; + + GETNAME (GxB_CMPLX_FP32) ; + GETNAME (GxB_CMPLX_FP64) ; + + GETNAME (GxB_FIRSTI_INT32) ; GETNAME (GxB_FIRSTI_INT64) ; + GETNAME (GxB_FIRSTI1_INT32) ; GETNAME (GxB_FIRSTI1_INT64) ; + GETNAME (GxB_FIRSTJ_INT32) ; GETNAME (GxB_FIRSTJ_INT64) ; + GETNAME (GxB_FIRSTJ1_INT32) ; GETNAME (GxB_FIRSTJ1_INT64) ; + GETNAME (GxB_SECONDI_INT32) ; GETNAME (GxB_SECONDI_INT64) ; + GETNAME (GxB_SECONDI1_INT32) ; GETNAME (GxB_SECONDI1_INT64) ; + GETNAME (GxB_SECONDJ_INT32) ; GETNAME (GxB_SECONDJ_INT64) ; + GETNAME (GxB_SECONDJ1_INT32) ; GETNAME (GxB_SECONDJ1_INT64) ; + + GETNAME (GxB_IGNORE_DUP) ; + + //-------------------------------------------------------------------------- + // other get/set methods for GrB_BinaryOp + //-------------------------------------------------------------------------- + + OK (GrB_BinaryOp_get_INT32_(GrB_MAX_FP32, &code, GrB_INP0_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_BinaryOp_get_SIZE_(GrB_MAX_FP32, &size, GrB_INP0_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + + OK (GrB_BinaryOp_get_String_(GrB_MAX_FP32, name, GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_BinaryOp_get_SIZE_(GrB_MAX_INT32, &size, GrB_INP1_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_INT32") + 1) ; + + OK (GrB_BinaryOp_get_String_(GrB_MAX_INT32, name, GrB_INP1_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_INT32")) ; + + OK (GrB_BinaryOp_get_INT32_(GrB_MAX_FP64, &code, GrB_OUTP_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_BinaryOp_get_SIZE_(GrB_MAX_FP64, &size, GrB_OUTP_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP64") + 1) ; + + OK (GrB_BinaryOp_get_String_(GrB_MAX_FP64, name, GrB_OUTP_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP64")) ; + + OK (GrB_BinaryOp_get_Scalar_(GrB_MAX_FP32, s_int32, GrB_INP0_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_BinaryOp_get_Scalar_(GrB_LAND, s_int32, GrB_OUTP_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + OK (GrB_BinaryOp_get_INT32_(GrB_PLUS_FP64, &code, GrB_INP1_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_BinaryOp_get_Scalar_(GrB_LAND, s_int32, GrB_INP1_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_BinaryOp_get_INT32_(GrB_LAND, &code, GrB_NAME)) ; + ERR (GrB_BinaryOp_get_String_(GrB_MAX_INT32, name, 999)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_BinaryOp_get_VOID_(GrB_LAND, nothing, 0)) ; + + OK (GrB_BinaryOp_new (&binop, myfunc, GrB_FP32, GrB_FP32, GrB_FP32)) ; + OK (GrB_BinaryOp_get_SIZE_(binop, &size, GrB_NAME)) ; + CHECK (size == 1) ; + OK (GrB_BinaryOp_get_SIZE_(binop, &size, GxB_JIT_C_NAME)) ; + CHECK (size == 1) ; + OK (GrB_BinaryOp_get_SIZE_(binop, &size, GxB_JIT_C_DEFINITION)) ; + CHECK (size == 1) ; + OK (GrB_BinaryOp_set_String_(binop, "myfunc", GxB_JIT_C_NAME)) ; + OK (GrB_BinaryOp_get_String_(binop, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "myfunc")) ; + CHECK (binop->hash == UINT64_MAX) ; + METHOD (GrB_BinaryOp_set_String (binop, MYFUNC_DEFN, GxB_JIT_C_DEFINITION)) ; + OK (GrB_BinaryOp_get_String_(binop, defn, GxB_JIT_C_DEFINITION)) ; + CHECK (MATCH (defn, MYFUNC_DEFN)) ; + CHECK (binop->hash != UINT64_MAX) ; + OK (GxB_print (binop, 3)) ; + + OK (GrB_BinaryOp_set_String_(binop, "user name for myfunc", GrB_NAME)) ; + OK (GrB_BinaryOp_get_String_(binop, name, GrB_NAME)) ; + CHECK (MATCH (name, "user name for myfunc")) ; + expected = GrB_ALREADY_SET ; + ERR (GrB_BinaryOp_set_String_(binop, "another user name", GrB_NAME)) ; + printf (" test GrB_ALREADY_SET: ok\n") ; + + OK (GrB_BinaryOp_get_INT32_(binop, &code, GrB_INP1_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_BinaryOp_set_Scalar_(binop, s_int32, 0)) ; + ERR (GrB_BinaryOp_set_INT32_(binop, 0, 0)) ; + ERR (GrB_BinaryOp_set_VOID_(binop, nothing, 0, 0)) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&binop) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test28: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test29.c b/GraphBLAS/Test/GB_mex_test29.c new file mode 100644 index 0000000000..0ec8a45325 --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test29.c @@ -0,0 +1,462 @@ +//------------------------------------------------------------------------------ +// GB_mex_test29: test GrB_get and GrB_set (global) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test29" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +int myprintf (const char *restrict format, ...) ; + +int myprintf (const char *restrict format, ...) +{ + printf ("[[myprintf:") ; + va_list ap ; + va_start (ap, format) ; + vprintf (format, ap) ; + va_end (ap) ; + printf ("]]") ; + return (1) ; +} + +int myflush (void) ; + +int myflush (void) +{ + printf ("myflush\n") ; + fflush (stdout) ; + return (0) ; +} + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Matrix A = NULL ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char defn [2048], defn2 [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // global set/get + //-------------------------------------------------------------------------- + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_LIBRARY_VER_MAJOR)) ; + CHECK (i == GxB_IMPLEMENTATION_MAJOR) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_LIBRARY_VER_MINOR)) ; + CHECK (i == GxB_IMPLEMENTATION_MINOR) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_LIBRARY_VER_PATCH)) ; + CHECK (i == GxB_IMPLEMENTATION_SUB) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_API_VER_MAJOR)) ; + CHECK (i == GxB_SPEC_MAJOR) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_API_VER_MINOR)) ; + CHECK (i == GxB_SPEC_MINOR) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_API_VER_PATCH)) ; + CHECK (i == GxB_SPEC_SUB) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_BLOCKING_MODE)) ; + CHECK (i == GrB_NONBLOCKING) ; + + i = -1 ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_MODE)) ; + CHECK (i == GrB_NONBLOCKING) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, GrB_ROWMAJOR, + GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, + GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_ROWMAJOR) ; + + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, GrB_COLMAJOR, + GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, + GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, GrB_BOTH, + GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, + GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_ROWMAJOR) ; + + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, GrB_COLMAJOR, + GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, + GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, GrB_UNKNOWN, + GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, + GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_ROWMAJOR) ; + + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, GrB_COLMAJOR, + GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, + GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_COLMAJOR) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Global_set_INT32_ (GrB_GLOBAL, 999, + GrB_STORAGE_ORIENTATION_HINT)) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_FORMAT)) ; + ERR (GrB_Global_set_INT32_ (GrB_GLOBAL, 999, GxB_FORMAT)) ; + CHECK (i == GxB_BY_COL) ; + + int32_t nth ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &nth, GxB_GLOBAL_NTHREADS)) ; + printf ("nthreads: %d\n", nth) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, 2, GxB_GLOBAL_NTHREADS)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_GLOBAL_NTHREADS)) ; + CHECK (i == 2) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, nth, GxB_GLOBAL_NTHREADS)) ; + + int32_t gpu ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &gpu, GxB_GLOBAL_GPU_ID)) ; + printf ("gpu id: %d\n", gpu) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, 2, GxB_GLOBAL_GPU_ID)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_GLOBAL_GPU_ID)) ; + CHECK (i == -1) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, gpu, GxB_GLOBAL_GPU_ID)) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_BURBLE)) ; + printf ("burble: %d\n", i) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, 1, GxB_BURBLE)) ; + OK (GrB_Matrix_new (&A, GrB_FP32, 3, 3)) ; + OK (GrB_assign (A, NULL, NULL, 3, GrB_ALL, 3, GrB_ALL, 3, NULL)) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, 0, GxB_BURBLE)) ; + OK (GrB_assign (A, NULL, NULL, 4, GrB_ALL, 3, GrB_ALL, 3, NULL)) ; + OK (GxB_print (A, 2)) ; + + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_LIBRARY_OPENMP)) ; + CHECK (i == 1) ; + + int32_t onebase ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &onebase, GxB_PRINT_1BASED)) ; + printf ("1based: %d\n", i) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, 1, GxB_PRINT_1BASED)) ; + OK (GxB_print (A, 2)) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, onebase, GxB_PRINT_1BASED)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_PRINT_1BASED)) ; + CHECK (i == onebase) ; + + int32_t control ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &control, GxB_JIT_C_CONTROL)) ; + printf ("jit ctrl: %d\n", control) ; + for (int c = 0 ; c <= GxB_JIT_ON ; c++) + { + int32_t b ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, c, GxB_JIT_C_CONTROL)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &b, GxB_JIT_C_CONTROL)) ; + CHECK (c == b) ; + } + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, control, GxB_JIT_C_CONTROL)) ; + + int32_t use_cmake ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &use_cmake, GxB_JIT_USE_CMAKE)) ; + printf ("jit cmake %d\n", use_cmake) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, 1, GxB_JIT_USE_CMAKE)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_JIT_USE_CMAKE)) ; + CHECK (i == 1) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, use_cmake, GxB_JIT_USE_CMAKE)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Global_set_INT32_ (GrB_GLOBAL, 1, GrB_BLOCKING_MODE)) ; + expected = GrB_EMPTY_OBJECT ; + ERR (GrB_Global_set_Scalar_ (GrB_GLOBAL, s_int32, + GrB_STORAGE_ORIENTATION_HINT)) ; + expected = GrB_INVALID_VALUE ; + OK (GrB_Scalar_setElement_INT32 (s_int32, 1)) ; + ERR (GrB_Global_set_Scalar_ (GrB_GLOBAL, s_int32, GrB_BLOCKING_MODE)) ; + + OK (GrB_Global_set_Scalar_ (GrB_GLOBAL, s_int32, GxB_JIT_C_CONTROL)) ; + OK (GrB_Scalar_setElement_INT32 (s_int32, 2)) ; + OK (GrB_Global_get_Scalar_ (GrB_GLOBAL, s_int32, GxB_JIT_C_CONTROL)) ; + OK (GrB_Scalar_extractElement (&i, s_int32)) ; + CHECK (i == 1) ; + OK (GrB_Global_set_INT32_ (GrB_GLOBAL, control, GxB_JIT_C_CONTROL)) ; + OK (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GxB_JIT_C_CONTROL)) ; + CHECK (i == control) ; + + OK (GrB_Global_get_Scalar_ (GrB_GLOBAL, s_fp64, GxB_HYPER_SWITCH)) ; + OK (GrB_Scalar_extractElement (&dvalue, s_fp64)) ; + printf ("hyper switch: %g\n", dvalue) ; + OK (GrB_Scalar_setElement (s_fp64, 0.75)) ; + OK (GrB_Global_set_Scalar_ (GrB_GLOBAL, s_fp64, GxB_HYPER_SWITCH)) ; + OK (GrB_Scalar_clear (s_fp64)) ; + OK (GrB_Global_get_Scalar_ (GrB_GLOBAL, s_fp64, GxB_HYPER_SWITCH)) ; + OK (GrB_Scalar_extractElement (&dvalue, s_fp64)) ; + CHECK (dvalue == 0.75) ; + + OK (GrB_Scalar_setElement_FP64 (s_fp64, 0.75)) ; + OK (GrB_Global_set_Scalar_ (GrB_GLOBAL, s_fp64, GxB_HYPER_SWITCH)) ; + OK (GrB_Scalar_clear (s_fp64)) ; + + OK (GrB_Global_get_Scalar_ (GrB_GLOBAL, s_fp64, GxB_CHUNK)) ; + OK (GrB_Scalar_extractElement (&dvalue, s_fp64)) ; + printf ("chunk: %g\n", dvalue) ; + OK (GrB_Scalar_setElement (s_fp64, 8901)) ; + OK (GrB_Global_set_Scalar_ (GrB_GLOBAL, s_fp64, GxB_CHUNK)) ; + OK (GrB_Scalar_clear (s_fp64)) ; + OK (GrB_Global_get_Scalar_ (GrB_GLOBAL, s_fp64, GxB_CHUNK)) ; + OK (GrB_Scalar_extractElement (&dvalue, s_fp64)) ; + CHECK (dvalue == 8901) ; + + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Global_get_Scalar_ (GrB_GLOBAL, s_fp64, GrB_EL_TYPE_CODE)) ; + ERR (GrB_Global_get_INT32_ (GrB_GLOBAL, &i, GrB_EL_TYPE_CODE)) ; + ERR (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GrB_EL_TYPE_CODE)) ; + ERR (GrB_Global_get_String_ (GrB_GLOBAL, name, GrB_EL_TYPE_CODE)) ; + ERR (GrB_Global_get_VOID_ (GrB_GLOBAL, nothing, GrB_EL_TYPE_CODE)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GrB_NAME)) ; + printf ("library name: [%s]\n", name) ; + CHECK (MATCH (name, GxB_IMPLEMENTATION_NAME)) ; + + name [0] = 0 ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_LIBRARY_NAME)) ; + printf ("library name: [%s]\n", name) ; + CHECK (MATCH (name, GxB_IMPLEMENTATION_NAME)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_LIBRARY_DATE)) ; + printf ("library date: [%s]\n", name) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_LIBRARY_ABOUT)) ; + printf ("library about: [%s]\n", defn) ; + CHECK (MATCH (defn, GxB_IMPLEMENTATION_ABOUT)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_LIBRARY_LICENSE)) ; + printf ("library license: [%s]\n", defn) ; + CHECK (MATCH (defn, GxB_IMPLEMENTATION_LICENSE)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_LIBRARY_COMPILE_DATE)) ; + printf ("library compile date: [%s]\n", name) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_LIBRARY_COMPILE_TIME)) ; + printf ("library compile time: [%s]\n", name) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_LIBRARY_URL)) ; + printf ("library url: [%s]\n", name) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_API_DATE)) ; + printf ("api date: [%s]\n", name) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_API_ABOUT)) ; + printf ("api about: [%s]\n", defn) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, name, GxB_API_URL)) ; + printf ("api url: [%s]\n", name) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_COMPILER_NAME)) ; + printf ("compiler: [%s]\n", defn) ; + + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_C_COMPILER_NAME)) ; + printf ("JIT C compiler: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "cc", GxB_JIT_C_COMPILER_NAME)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_COMPILER_NAME)) ; + CHECK (MATCH (defn2, "cc")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_C_COMPILER_NAME)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_COMPILER_NAME)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_C_COMPILER_FLAGS)) ; + printf ("JIT C compiler flags: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "-O", GxB_JIT_C_COMPILER_FLAGS)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_COMPILER_FLAGS)) ; + CHECK (MATCH (defn2, "-O")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_C_COMPILER_FLAGS)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_COMPILER_FLAGS)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_C_LINKER_FLAGS)) ; + printf ("JIT C link flags: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "-stuff", GxB_JIT_C_LINKER_FLAGS)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_LINKER_FLAGS)) ; + CHECK (MATCH (defn2, "-stuff")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_C_LINKER_FLAGS)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_LINKER_FLAGS)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_C_LIBRARIES)) ; + printf ("JIT C libraries: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "-lm", GxB_JIT_C_LIBRARIES)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_LIBRARIES)) ; + CHECK (MATCH (defn2, "-lm")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_C_LIBRARIES)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_LIBRARIES)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_C_CMAKE_LIBS)) ; + printf ("JIT C cmake libs: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "m;dl", GxB_JIT_C_CMAKE_LIBS)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_CMAKE_LIBS)) ; + CHECK (MATCH (defn2, "m;dl")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_C_CMAKE_LIBS)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_CMAKE_LIBS)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_C_PREFACE)) ; + printf ("JIT C preface: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "// stuff", GxB_JIT_C_PREFACE)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_PREFACE)) ; + CHECK (MATCH (defn2, "// stuff")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_C_PREFACE)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_C_PREFACE)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_ERROR_LOG)) ; + printf ("JIT error log: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "errlog.txt", GxB_JIT_ERROR_LOG)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_ERROR_LOG)) ; + CHECK (MATCH (defn2, "errlog.txt")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_ERROR_LOG)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_ERROR_LOG)) ; + CHECK (MATCH (defn2, defn)) ; + + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn, GxB_JIT_CACHE_PATH)) ; + printf ("JIT cache: [%s]\n", defn) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, "/tmp/stuff", GxB_JIT_CACHE_PATH)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_CACHE_PATH)) ; + CHECK (MATCH (defn2, "/tmp/stuff")) ; + OK (GrB_Global_set_String_ (GrB_GLOBAL, defn, GxB_JIT_CACHE_PATH)) ; + OK (GrB_Global_get_String_ (GrB_GLOBAL, defn2, GxB_JIT_CACHE_PATH)) ; + CHECK (MATCH (defn2, defn)) ; + system ("ls /tmp/stuff ; rm -rf /tmp/stuff") ; + + ERR (GrB_Global_set_String_ (GrB_GLOBAL, defn, GrB_NAME)) ; + + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_JIT_CACHE_PATH)) ; + CHECK (size == strlen (defn) + 1) ; + + double sw [GxB_NBITMAP_SWITCH] ; + double s2 [GxB_NBITMAP_SWITCH] ; + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_BITMAP_SWITCH)) ; + CHECK (size == sizeof (double) * GxB_NBITMAP_SWITCH) ; + OK (GrB_Global_get_VOID_ (GrB_GLOBAL, (void *) sw, GxB_BITMAP_SWITCH)) ; + OK (GrB_Global_get_VOID_ (GrB_GLOBAL, (void *) s2, GxB_BITMAP_SWITCH)) ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + printf ("bitmap switch [%d] = %g\n", k, sw [k]) ; + sw [k] = ((double) k) / 8. ; + } + + OK (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) sw, GxB_BITMAP_SWITCH, + size)) ; + memset (sw, 0, size) ; + OK (GrB_Global_get_VOID_ (GrB_GLOBAL, (void *) sw, GxB_BITMAP_SWITCH)) ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + CHECK (sw [k] == ((double) k) / 8.) ; + } + + OK (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) NULL, GxB_BITMAP_SWITCH, + 0)) ; + OK (GrB_Global_get_VOID_ (GrB_GLOBAL, (void *) sw, GxB_BITMAP_SWITCH)) ; + for (int k = 0 ; k < GxB_NBITMAP_SWITCH ; k++) + { + CHECK (sw [k] == s2 [k]) ; + } + + ERR (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) s2, GxB_BITMAP_SWITCH, + 1)) ; + + ERR (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) NULL, 0, 0)) ; + + ERR (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) NULL, GxB_PRINTF, 0)) ; + ERR (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) NULL, GxB_FLUSH, 0)) ; + OK (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) myprintf, GxB_PRINTF, + sizeof (GB_printf_function_t))) ; + OK (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) myflush, GxB_FLUSH, + sizeof (GB_flush_function_t))) ; + OK (GxB_print (s_int32, 3)) ; + OK (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) mexPrintf, GxB_PRINTF, + sizeof (GB_printf_function_t))) ; + OK (GrB_Global_set_VOID_ (GrB_GLOBAL, (void *) NULL, GxB_FLUSH, + sizeof (GB_flush_function_t))) ; + OK (GxB_print (s_int32, 3)) ; + + int32_t cv [3] ; + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_COMPILER_VERSION)) ; + CHECK (size == sizeof (int32_t) * 3) ; + OK (GrB_Global_get_VOID_ (GrB_GLOBAL, (void *) cv, + GxB_COMPILER_VERSION)) ; + + for (int k = 0 ; k < 3 ; k++) + { + printf ("compiler version [%d] = %d\n", k, cv [k]) ; + } + + void *f = NULL ; + OK (GrB_Global_get_VOID_(GrB_GLOBAL, (void *) &f, GxB_MALLOC_FUNCTION)) ; + CHECK (f == mxMalloc) ; + OK (GrB_Global_get_VOID_(GrB_GLOBAL, (void *) &f, GxB_REALLOC_FUNCTION)) ; + CHECK (f == mxRealloc) ; + OK (GrB_Global_get_VOID (GrB_GLOBAL, (void *) &f, GxB_CALLOC_FUNCTION)) ; + CHECK (f == mxCalloc) ; + OK (GrB_Global_get_VOID (GrB_GLOBAL, (void *) &f, GxB_FREE_FUNCTION)) ; + CHECK (f == mxFree) ; + + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_MALLOC_FUNCTION)) ; + CHECK (size == sizeof (void *)) ; + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_REALLOC_FUNCTION)) ; + CHECK (size == sizeof (void *)) ; + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_CALLOC_FUNCTION)) ; + CHECK (size == sizeof (void *)) ; + OK (GrB_Global_get_SIZE_ (GrB_GLOBAL, &size, GxB_FREE_FUNCTION)) ; + CHECK (size == sizeof (void *)) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&A) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test29: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test30.c b/GraphBLAS/Test/GB_mex_test30.c new file mode 100644 index 0000000000..2ca9209a69 --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test30.c @@ -0,0 +1,286 @@ +//------------------------------------------------------------------------------ +// GB_mex_test30: test GrB_get and GrB_set (index unary ops) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test30" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +#define GETOP(op,opname) \ +{ \ + size_t siz1, siz2, siz3 ; \ + OK (GrB_IndexUnaryOp_get_String (op, name, GrB_NAME)) ; \ + CHECK (MATCH (name, opname)) ; \ + OK (GrB_IndexUnaryOp_get_String (op, cname, GxB_JIT_C_NAME)) ; \ + printf ("%s: %s\n", name, cname) ; \ + OK (GrB_IndexUnaryOp_get_SIZE (op, &size, GrB_NAME)) ; \ + CHECK (size == strlen (name) + 1) ; \ + GrB_Info info2, info3 ; \ + info2 = GrB_IndexUnaryOp_get_SIZE (op, &siz1, GrB_INP0_TYPE_STRING) ; \ + info3 = GrB_IndexUnaryOp_get_String (op, name, GrB_INP0_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz1 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz1 == 1) ; } \ + info2 = GrB_IndexUnaryOp_get_SIZE (op, &siz2, GrB_INP1_TYPE_STRING) ; \ + info3 = GrB_IndexUnaryOp_get_String (op, name, GrB_INP1_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz2 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz2 == 1) ; } \ + info2 = GrB_IndexUnaryOp_get_SIZE (op, &siz3, GrB_OUTP_TYPE_STRING) ; \ + info3 = GrB_IndexUnaryOp_get_String (op, name, GrB_OUTP_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz3 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz3 == 1) ; } \ +} + +#define GETNAME(op) \ +{ \ + GETOP (op, #op) ; \ +/* OK (GxB_IndexUnaryOp_fprint (op, "idxop", 3, NULL)) ; */\ +} + +void myfunc (bool *z, const float *x, GrB_Index i, GrB_Index j, + const float *y) ; +void myfunc (bool *z, const float *x, GrB_Index i, GrB_Index j, + const float *y) +{ + (*z) = (*x) > 2 ; +} + +#define MYFUNC_DEFN \ +"void myfunc (bool *z, const float *x, GrB_Index i, GrB_Index j, \n" \ +" const float *y) \n" \ +"{ \n" \ +" (*z) = (*x) > 2 ; \n" \ +"}" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_IndexUnaryOp op = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char cname [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GrB_IndexUnaryOp get name + //-------------------------------------------------------------------------- + + GETNAME (GrB_ROWINDEX_INT32) ; + GETNAME (GrB_ROWINDEX_INT64) ; + GETNAME (GrB_COLINDEX_INT32) ; + GETNAME (GrB_COLINDEX_INT64) ; + GETNAME (GrB_DIAGINDEX_INT32) ; + GETNAME (GrB_DIAGINDEX_INT64) ; + + GETNAME (GxB_FLIPDIAGINDEX_INT32) ; + GETNAME (GxB_FLIPDIAGINDEX_INT64) ; + + GETNAME (GrB_TRIL) ; + GETNAME (GrB_TRIU) ; + GETNAME (GrB_DIAG) ; + GETNAME (GrB_OFFDIAG) ; + + GETNAME (GrB_COLLE) ; + GETNAME (GrB_COLGT) ; + GETNAME (GrB_ROWLE) ; + GETNAME (GrB_ROWGT) ; + + GETNAME (GrB_VALUEEQ_BOOL) ; + GETNAME (GrB_VALUEEQ_INT8) ; + GETNAME (GrB_VALUEEQ_INT16) ; + GETNAME (GrB_VALUEEQ_INT32) ; + GETNAME (GrB_VALUEEQ_INT64) ; + GETNAME (GrB_VALUEEQ_UINT8) ; + GETNAME (GrB_VALUEEQ_UINT16) ; + GETNAME (GrB_VALUEEQ_UINT32) ; + GETNAME (GrB_VALUEEQ_UINT64) ; + GETNAME (GrB_VALUEEQ_FP32) ; + GETNAME (GrB_VALUEEQ_FP64) ; + GETNAME (GxB_VALUEEQ_FC32) ; + GETNAME (GxB_VALUEEQ_FC64) ; + + GETNAME (GrB_VALUENE_BOOL) ; + GETNAME (GrB_VALUENE_INT8) ; + GETNAME (GrB_VALUENE_INT16) ; + GETNAME (GrB_VALUENE_INT32) ; + GETNAME (GrB_VALUENE_INT64) ; + GETNAME (GrB_VALUENE_UINT8) ; + GETNAME (GrB_VALUENE_UINT16) ; + GETNAME (GrB_VALUENE_UINT32) ; + GETNAME (GrB_VALUENE_UINT64) ; + GETNAME (GrB_VALUENE_FP32) ; + GETNAME (GrB_VALUENE_FP64) ; + GETNAME (GxB_VALUENE_FC32) ; + GETNAME (GxB_VALUENE_FC64) ; + + GETNAME (GrB_VALUELT_BOOL) ; + GETNAME (GrB_VALUELT_INT8) ; + GETNAME (GrB_VALUELT_INT16) ; + GETNAME (GrB_VALUELT_INT32) ; + GETNAME (GrB_VALUELT_INT64) ; + GETNAME (GrB_VALUELT_UINT8) ; + GETNAME (GrB_VALUELT_UINT16) ; + GETNAME (GrB_VALUELT_UINT32) ; + GETNAME (GrB_VALUELT_UINT64) ; + GETNAME (GrB_VALUELT_FP32) ; + GETNAME (GrB_VALUELT_FP64) ; + + GETNAME (GrB_VALUELE_BOOL) ; + GETNAME (GrB_VALUELE_INT8) ; + GETNAME (GrB_VALUELE_INT16) ; + GETNAME (GrB_VALUELE_INT32) ; + GETNAME (GrB_VALUELE_INT64) ; + GETNAME (GrB_VALUELE_UINT8) ; + GETNAME (GrB_VALUELE_UINT16) ; + GETNAME (GrB_VALUELE_UINT32) ; + GETNAME (GrB_VALUELE_UINT64) ; + GETNAME (GrB_VALUELE_FP32) ; + GETNAME (GrB_VALUELE_FP64) ; + + GETNAME (GrB_VALUEGT_BOOL) ; + GETNAME (GrB_VALUEGT_INT8) ; + GETNAME (GrB_VALUEGT_INT16) ; + GETNAME (GrB_VALUEGT_INT32) ; + GETNAME (GrB_VALUEGT_INT64) ; + GETNAME (GrB_VALUEGT_UINT8) ; + GETNAME (GrB_VALUEGT_UINT16) ; + GETNAME (GrB_VALUEGT_UINT32) ; + GETNAME (GrB_VALUEGT_UINT64) ; + GETNAME (GrB_VALUEGT_FP32) ; + GETNAME (GrB_VALUEGT_FP64) ; + + GETNAME (GrB_VALUEGE_BOOL) ; + GETNAME (GrB_VALUEGE_INT8) ; + GETNAME (GrB_VALUEGE_INT16) ; + GETNAME (GrB_VALUEGE_INT32) ; + GETNAME (GrB_VALUEGE_INT64) ; + GETNAME (GrB_VALUEGE_UINT8) ; + GETNAME (GrB_VALUEGE_UINT16) ; + GETNAME (GrB_VALUEGE_UINT32) ; + GETNAME (GrB_VALUEGE_UINT64) ; + GETNAME (GrB_VALUEGE_FP32) ; + GETNAME (GrB_VALUEGE_FP64) ; + + GETNAME (GxB_NONZOMBIE) ; + + //-------------------------------------------------------------------------- + // other get/set methods for GrB_IndexUnaryOp + //-------------------------------------------------------------------------- + + OK (GrB_IndexUnaryOp_get_INT32_(GrB_VALUEGE_FP32, &code, GrB_INP0_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_IndexUnaryOp_get_String_(GrB_VALUEGE_FP32, name, GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_IndexUnaryOp_get_INT32_(GrB_VALUEGE_FP64, &code, GrB_OUTP_TYPE_CODE)) ; + CHECK (code == GrB_BOOL_CODE) ; + + OK (GrB_IndexUnaryOp_get_String_(GrB_VALUEGE_FP64, name, GrB_OUTP_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_BOOL")) ; + + OK (GrB_IndexUnaryOp_get_Scalar_(GrB_VALUEGE_FP32, s_int32, GrB_INP0_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_IndexUnaryOp_get_Scalar_(GrB_VALUEGE_FP32, s_int32, GrB_OUTP_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + expected = GrB_NO_VALUE ; + ERR (GrB_IndexUnaryOp_get_INT32_(GrB_TRIL, &code, GrB_INP0_TYPE_CODE)) ; + ERR (GrB_IndexUnaryOp_get_Scalar_(GrB_TRIL, s_int32, GrB_INP0_TYPE_CODE)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_IndexUnaryOp_get_INT32_(GrB_TRIL, &code, GrB_NAME)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_IndexUnaryOp_get_VOID_(GrB_TRIL, nothing, 0)) ; + + OK (GrB_IndexUnaryOp_new (&op, myfunc, GrB_BOOL, GrB_FP32, GrB_FP32)) ; + OK (GrB_IndexUnaryOp_get_SIZE_(op, &size, GrB_NAME)) ; + CHECK (size == 1) ; + OK (GrB_IndexUnaryOp_get_SIZE_(op, &size, GxB_JIT_C_NAME)) ; + printf ("size %lu\n", size) ; + CHECK (size == 1) ; + OK (GrB_IndexUnaryOp_get_SIZE_(op, &size, GxB_JIT_C_DEFINITION)) ; + CHECK (size == 1) ; + + expected = GrB_INVALID_VALUE ; + OK (GrB_IndexUnaryOp_set_String_(op, "myfunc", GxB_JIT_C_NAME)) ; + OK (GrB_IndexUnaryOp_get_String_(op, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "myfunc")) ; + CHECK (op->hash == UINT64_MAX) ; + METHOD (GrB_IndexUnaryOp_set_String (op, MYFUNC_DEFN, GxB_JIT_C_DEFINITION)) ; + OK (GrB_IndexUnaryOp_get_String_(op, defn, GxB_JIT_C_DEFINITION)) ; + CHECK (MATCH (defn, MYFUNC_DEFN)) ; + CHECK (op->hash != UINT64_MAX) ; + OK (GxB_print (op, 3)) ; + + OK (GrB_IndexUnaryOp_set_String_(op, "user name for myfunc", GrB_NAME)) ; + OK (GrB_IndexUnaryOp_get_String_(op, name, GrB_NAME)) ; + CHECK (MATCH (name, "user name for myfunc")) ; + expected = GrB_ALREADY_SET ; + ERR (GrB_IndexUnaryOp_set_String_(op, "another user name", GrB_NAME)) ; + printf (" test GrB_ALREADY_SET: ok\n") ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_IndexUnaryOp_set_String_(op, "another_name", 999)) ; + ERR (GrB_IndexUnaryOp_get_SIZE(op, &size, 999)) ; + + expected = GrB_ALREADY_SET ; + ERR (GrB_IndexUnaryOp_set_String_(op, "another_name", GxB_JIT_C_NAME)) ; + ERR (GrB_IndexUnaryOp_set_String_(op, "another_defn", GxB_JIT_C_DEFINITION)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_IndexUnaryOp_set_String_(GrB_LNOT, "newname", GxB_JIT_C_NAME)) ; + ERR (GrB_IndexUnaryOp_set_Scalar_(op, s_int32, 0)) ; + ERR (GrB_IndexUnaryOp_set_INT32_(op, 0, 0)) ; + ERR (GrB_IndexUnaryOp_set_VOID_(op, nothing, 0, 0)) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&op) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test30: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test31.c b/GraphBLAS/Test/GB_mex_test31.c new file mode 100644 index 0000000000..53754b679c --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test31.c @@ -0,0 +1,381 @@ +//------------------------------------------------------------------------------ +// GB_mex_test31: test GrB_get and GrB_set (monoids) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test31" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +#define GETOP(op,opname) \ +{ \ + size_t siz1, siz2, siz3 ; \ + OK (GrB_Monoid_get_String (op, name, GrB_NAME)) ; \ + CHECK (MATCH (name, opname)) ; \ + OK (GrB_Monoid_get_SIZE (op, &size, GrB_NAME)) ; \ + CHECK (size == strlen (name) + 1) ; \ + GrB_Info info2, info3 ; \ + info2 = GrB_Monoid_get_SIZE (op, &siz1, GrB_INP0_TYPE_STRING) ; \ + info3 = GrB_Monoid_get_String (op, name, GrB_INP0_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz1 == strlen (name) + 1) ; \ + CHECK (info2 == GrB_SUCCESS) ; \ + info2 = GrB_Monoid_get_SIZE (op, &siz2, GrB_INP1_TYPE_STRING) ; \ + info3 = GrB_Monoid_get_String (op, name, GrB_INP1_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz2 == strlen (name) + 1) ; \ + CHECK (info2 == GrB_SUCCESS) ; \ + info2 = GrB_Monoid_get_SIZE (op, &siz3, GrB_OUTP_TYPE_STRING) ; \ + info3 = GrB_Monoid_get_String (op, name, GrB_OUTP_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz3 == strlen (name) + 1) ; \ + CHECK (info2 == GrB_SUCCESS) ; \ +} + +#define GETNAME(op) \ +{ \ + GETOP (op, #op) ; \ +/* OK (GxB_Monoid_fprint (op, "binop", 3, NULL)) ; */ \ +} + +#define GETNAM2(op,alias) \ +{ \ + GETOP (op,alias) ; \ +/* OK (GxB_Monoid_fprint (op, "binop", 3, NULL)) ; */ \ +} + +void myfunc (float *z, const float *x, const float *y) ; +void myfunc (float *z, const float *x, const float *y) { (*z) = (*x)+(*y) ; } +#define MYFUNC_DEFN \ +"void myfunc (float *z, const float *x, const float *y) { (*z) = (*x)+(*y) ; }" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_BinaryOp binop = NULL, op = NULL ; + GrB_Monoid monoid = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + GrB_Index nvals = 999 ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GrB_Monoid get name + //-------------------------------------------------------------------------- + + GETNAM2 (GxB_MIN_INT8_MONOID, "GrB_MIN_MONOID_INT8") ; + GETNAM2 (GxB_MIN_INT16_MONOID, "GrB_MIN_MONOID_INT16") ; + GETNAM2 (GxB_MIN_INT32_MONOID, "GrB_MIN_MONOID_INT32") ; + GETNAM2 (GxB_MIN_INT64_MONOID, "GrB_MIN_MONOID_INT64") ; + GETNAM2 (GxB_MIN_UINT8_MONOID, "GrB_MIN_MONOID_UINT8") ; + GETNAM2 (GxB_MIN_UINT16_MONOID, "GrB_MIN_MONOID_UINT16") ; + GETNAM2 (GxB_MIN_UINT32_MONOID, "GrB_MIN_MONOID_UINT32") ; + GETNAM2 (GxB_MIN_UINT64_MONOID, "GrB_MIN_MONOID_UINT64") ; + GETNAM2 (GxB_MIN_FP32_MONOID, "GrB_MIN_MONOID_FP32") ; + GETNAM2 (GxB_MIN_FP64_MONOID, "GrB_MIN_MONOID_FP64") ; + + GETNAME (GrB_MIN_MONOID_INT8) ; + GETNAME (GrB_MIN_MONOID_INT16) ; + GETNAME (GrB_MIN_MONOID_INT32) ; + GETNAME (GrB_MIN_MONOID_INT64) ; + GETNAME (GrB_MIN_MONOID_UINT8) ; + GETNAME (GrB_MIN_MONOID_UINT16) ; + GETNAME (GrB_MIN_MONOID_UINT32) ; + GETNAME (GrB_MIN_MONOID_UINT64) ; + GETNAME (GrB_MIN_MONOID_FP32) ; + GETNAME (GrB_MIN_MONOID_FP64) ; + + GETNAM2 (GxB_MAX_INT8_MONOID, "GrB_MAX_MONOID_INT8") ; + GETNAM2 (GxB_MAX_INT16_MONOID, "GrB_MAX_MONOID_INT16") ; + GETNAM2 (GxB_MAX_INT32_MONOID, "GrB_MAX_MONOID_INT32") ; + GETNAM2 (GxB_MAX_INT64_MONOID, "GrB_MAX_MONOID_INT64") ; + GETNAM2 (GxB_MAX_UINT8_MONOID, "GrB_MAX_MONOID_UINT8") ; + GETNAM2 (GxB_MAX_UINT16_MONOID, "GrB_MAX_MONOID_UINT16") ; + GETNAM2 (GxB_MAX_UINT32_MONOID, "GrB_MAX_MONOID_UINT32") ; + GETNAM2 (GxB_MAX_UINT64_MONOID, "GrB_MAX_MONOID_UINT64") ; + GETNAM2 (GxB_MAX_FP32_MONOID, "GrB_MAX_MONOID_FP32") ; + GETNAM2 (GxB_MAX_FP64_MONOID, "GrB_MAX_MONOID_FP64") ; + + GETNAME (GrB_MAX_MONOID_INT8) ; + GETNAME (GrB_MAX_MONOID_INT16) ; + GETNAME (GrB_MAX_MONOID_INT32) ; + GETNAME (GrB_MAX_MONOID_INT64) ; + GETNAME (GrB_MAX_MONOID_UINT8) ; + GETNAME (GrB_MAX_MONOID_UINT16) ; + GETNAME (GrB_MAX_MONOID_UINT32) ; + GETNAME (GrB_MAX_MONOID_UINT64) ; + GETNAME (GrB_MAX_MONOID_FP32) ; + GETNAME (GrB_MAX_MONOID_FP64) ; + + GETNAM2 (GxB_PLUS_INT8_MONOID, "GrB_PLUS_MONOID_INT8") ; + GETNAM2 (GxB_PLUS_INT16_MONOID, "GrB_PLUS_MONOID_INT16") ; + GETNAM2 (GxB_PLUS_INT32_MONOID, "GrB_PLUS_MONOID_INT32") ; + GETNAM2 (GxB_PLUS_INT64_MONOID, "GrB_PLUS_MONOID_INT64") ; + GETNAM2 (GxB_PLUS_UINT8_MONOID, "GrB_PLUS_MONOID_UINT8") ; + GETNAM2 (GxB_PLUS_UINT16_MONOID, "GrB_PLUS_MONOID_UINT16") ; + GETNAM2 (GxB_PLUS_UINT32_MONOID, "GrB_PLUS_MONOID_UINT32") ; + GETNAM2 (GxB_PLUS_UINT64_MONOID, "GrB_PLUS_MONOID_UINT64") ; + GETNAM2 (GxB_PLUS_FP32_MONOID, "GrB_PLUS_MONOID_FP32") ; + GETNAM2 (GxB_PLUS_FP64_MONOID, "GrB_PLUS_MONOID_FP64") ; + GETNAME (GxB_PLUS_FC32_MONOID) ; + GETNAME (GxB_PLUS_FC64_MONOID) ; + + GETNAME (GrB_PLUS_MONOID_INT8) ; + GETNAME (GrB_PLUS_MONOID_INT16) ; + GETNAME (GrB_PLUS_MONOID_INT32) ; + GETNAME (GrB_PLUS_MONOID_INT64) ; + GETNAME (GrB_PLUS_MONOID_UINT8) ; + GETNAME (GrB_PLUS_MONOID_UINT16) ; + GETNAME (GrB_PLUS_MONOID_UINT32) ; + GETNAME (GrB_PLUS_MONOID_UINT64) ; + GETNAME (GrB_PLUS_MONOID_FP32) ; + GETNAME (GrB_PLUS_MONOID_FP64) ; + + GETNAM2 (GxB_TIMES_INT8_MONOID, "GrB_TIMES_MONOID_INT8") ; + GETNAM2 (GxB_TIMES_INT16_MONOID, "GrB_TIMES_MONOID_INT16") ; + GETNAM2 (GxB_TIMES_INT32_MONOID, "GrB_TIMES_MONOID_INT32") ; + GETNAM2 (GxB_TIMES_INT64_MONOID, "GrB_TIMES_MONOID_INT64") ; + GETNAM2 (GxB_TIMES_UINT8_MONOID, "GrB_TIMES_MONOID_UINT8") ; + GETNAM2 (GxB_TIMES_UINT16_MONOID, "GrB_TIMES_MONOID_UINT16") ; + GETNAM2 (GxB_TIMES_UINT32_MONOID, "GrB_TIMES_MONOID_UINT32") ; + GETNAM2 (GxB_TIMES_UINT64_MONOID, "GrB_TIMES_MONOID_UINT64") ; + GETNAM2 (GxB_TIMES_FP32_MONOID, "GrB_TIMES_MONOID_FP32") ; + GETNAM2 (GxB_TIMES_FP64_MONOID, "GrB_TIMES_MONOID_FP64") ; + GETNAME (GxB_TIMES_FC32_MONOID) ; + GETNAME (GxB_TIMES_FC64_MONOID) ; + + GETNAME (GrB_TIMES_MONOID_INT8) ; + GETNAME (GrB_TIMES_MONOID_INT16) ; + GETNAME (GrB_TIMES_MONOID_INT32) ; + GETNAME (GrB_TIMES_MONOID_INT64) ; + GETNAME (GrB_TIMES_MONOID_UINT8) ; + GETNAME (GrB_TIMES_MONOID_UINT16) ; + GETNAME (GrB_TIMES_MONOID_UINT32) ; + GETNAME (GrB_TIMES_MONOID_UINT64) ; + GETNAME (GrB_TIMES_MONOID_FP32) ; + GETNAME (GrB_TIMES_MONOID_FP64) ; + + GETNAME (GxB_ANY_BOOL_MONOID) ; + GETNAME (GxB_ANY_INT8_MONOID) ; + GETNAME (GxB_ANY_INT16_MONOID) ; + GETNAME (GxB_ANY_INT32_MONOID) ; + GETNAME (GxB_ANY_INT64_MONOID) ; + GETNAME (GxB_ANY_UINT8_MONOID) ; + GETNAME (GxB_ANY_UINT16_MONOID) ; + GETNAME (GxB_ANY_UINT32_MONOID) ; + GETNAME (GxB_ANY_UINT64_MONOID) ; + GETNAME (GxB_ANY_FP32_MONOID) ; + GETNAME (GxB_ANY_FP64_MONOID) ; + GETNAME (GxB_ANY_FC32_MONOID) ; + GETNAME (GxB_ANY_FC64_MONOID) ; + + GETNAM2 (GxB_LOR_BOOL_MONOID, "GrB_LOR_MONOID_BOOL") ; + GETNAM2 (GxB_LAND_BOOL_MONOID, "GrB_LAND_MONOID_BOOL") ; + GETNAM2 (GxB_LXOR_BOOL_MONOID, "GrB_LXOR_MONOID_BOOL") ; + GETNAM2 (GxB_LXNOR_BOOL_MONOID, "GrB_LXNOR_MONOID_BOOL") ; + GETNAM2 (GxB_EQ_BOOL_MONOID, "GrB_LXNOR_MONOID_BOOL") ; + + GETNAME (GrB_LOR_MONOID_BOOL) ; + GETNAME (GrB_LAND_MONOID_BOOL) ; + GETNAME (GrB_LXOR_MONOID_BOOL) ; + GETNAME (GrB_LXNOR_MONOID_BOOL) ; + + GETNAME (GxB_BOR_UINT8_MONOID) ; + GETNAME (GxB_BOR_UINT16_MONOID) ; + GETNAME (GxB_BOR_UINT32_MONOID) ; + GETNAME (GxB_BOR_UINT64_MONOID) ; + + GETNAME (GxB_BAND_UINT8_MONOID) ; + GETNAME (GxB_BAND_UINT16_MONOID) ; + GETNAME (GxB_BAND_UINT32_MONOID) ; + GETNAME (GxB_BAND_UINT64_MONOID) ; + + GETNAME (GxB_BXOR_UINT8_MONOID) ; + GETNAME (GxB_BXOR_UINT16_MONOID) ; + GETNAME (GxB_BXOR_UINT32_MONOID) ; + GETNAME (GxB_BXOR_UINT64_MONOID) ; + + GETNAME (GxB_BXNOR_UINT8_MONOID) ; + GETNAME (GxB_BXNOR_UINT16_MONOID) ; + GETNAME (GxB_BXNOR_UINT32_MONOID) ; + GETNAME (GxB_BXNOR_UINT64_MONOID) ; + + //-------------------------------------------------------------------------- + // other get/set methods for GrB_Monoid + //-------------------------------------------------------------------------- + + OK (GrB_Monoid_get_INT32_(GrB_MAX_MONOID_FP32, &code, GrB_INP0_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_Monoid_get_String_(GrB_MAX_MONOID_FP32, name, + GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Monoid_get_String_(GrB_MAX_MONOID_INT32, name, + GrB_INP1_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_INT32")) ; + + OK (GrB_Monoid_get_INT32_(GrB_MAX_MONOID_FP64, &code, GrB_OUTP_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_Monoid_get_String_(GrB_MAX_MONOID_FP64, name, + GrB_OUTP_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP64")) ; + + OK (GrB_Monoid_get_Scalar_(GrB_MAX_MONOID_FP32, s_int32, + GrB_INP0_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_Monoid_get_Scalar_(GrB_LAND_MONOID_BOOL, s_int32, + GrB_OUTP_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + OK (GrB_Monoid_get_INT32_(GrB_PLUS_MONOID_FP64, &code, + GrB_INP1_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_Monoid_get_Scalar_(GrB_LAND_MONOID_BOOL, s_int32, + GrB_INP1_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Monoid_get_INT32_(GrB_LAND_MONOID_BOOL, &code, GrB_NAME)) ; + ERR (GrB_Monoid_get_String_(GrB_MAX_MONOID_INT32, name, 999)) ; + ERR (GrB_Monoid_get_VOID_(GrB_LAND_MONOID_BOOL, nothing, 0)) ; + + OK (GrB_BinaryOp_new (&binop, myfunc, GrB_FP32, GrB_FP32, GrB_FP32)) ; + OK (GrB_BinaryOp_set_String_(binop, "myfunc", GrB_NAME)) ; + METHOD (GrB_BinaryOp_set_String (binop, MYFUNC_DEFN, GxB_JIT_C_DEFINITION)) ; + + OK (GrB_Monoid_new_FP32 (&monoid, binop, (float) 0.0)) ; + OK (GrB_Monoid_get_SIZE_(monoid, &size, GrB_NAME)) ; + OK (GrB_Monoid_get_String_(monoid, name, GrB_NAME)) ; + printf ("\nuser monoid: [%s]\n", name) ; + CHECK (MATCH (name, "")) ; + CHECK (size == 1) ; + OK (GxB_print (monoid, 3)) ; + + OK (GrB_Monoid_get_String_(monoid, name, GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Monoid_get_SIZE_(monoid, &size, GrB_INP0_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Monoid_get_SIZE_(monoid, &size, GrB_INP0_TYPE_CODE)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Monoid_set_Scalar_(monoid, s_int32, 0)) ; + ERR (GrB_Monoid_set_INT32_(monoid, 0, 0)) ; + ERR (GrB_Monoid_set_VOID_(monoid, nothing, 0, 0)) ; + + OK (GrB_Monoid_set_String_(monoid, "monoid_stuff", GrB_NAME)) ; + OK (GrB_Monoid_get_String_(monoid, name, GrB_NAME)) ; + printf ("\nuser monoid: [%s]\n", name) ; + CHECK (MATCH (name, "monoid_stuff")) ; + OK (GrB_Monoid_get_SIZE_(monoid, &size, GrB_NAME)) ; + CHECK (size == strlen (name) + 1) ; + + expected = GrB_ALREADY_SET ; + ERR (GrB_Monoid_set_String_(monoid, "another user name", GrB_NAME)) ; + printf (" test GrB_ALREADY_SET: ok\n") ; + + printf ("\nterminal monoid:\n") ; + int32_t id_int32 ; + OK (GxB_print (GrB_MAX_MONOID_INT32, 3)) ; + OK (GrB_Monoid_get_Scalar_ (GrB_MAX_MONOID_INT32, s_int32, + GxB_MONOID_IDENTITY)) ; + OK (GrB_Scalar_nvals (&nvals, s_int32)) ; + CHECK (nvals == 1) ; + OK (GrB_Scalar_extractElement_INT32_(&id_int32, s_int32)) ; + CHECK (id_int32 == INT32_MIN) ; + + int32_t term_int32 ; + OK (GrB_Monoid_get_Scalar_ (GrB_MAX_MONOID_INT32, s_int32, + GxB_MONOID_TERMINAL)) ; + OK (GrB_Scalar_extractElement_INT32_(&term_int32, s_int32)) ; + CHECK (term_int32 == INT32_MAX) ; + + printf ("\nmon-terminal monoid:\n") ; + OK (GxB_print (GrB_PLUS_MONOID_INT32, 3)) ; + OK (GrB_Monoid_get_Scalar_ (GrB_PLUS_MONOID_INT32, s_int32, + GxB_MONOID_TERMINAL)) ; + OK (GrB_Scalar_nvals (&nvals, s_int32)) ; + CHECK (nvals == 0) ; + + OK (GrB_Monoid_get_Scalar_ (GrB_PLUS_MONOID_INT32, s_int32, + GxB_MONOID_IDENTITY)) ; + OK (GrB_Scalar_extractElement_INT32_(&id_int32, s_int32)) ; + CHECK (id_int32 == 0) ; + + expected = GrB_DOMAIN_MISMATCH ; + ERR (GrB_Monoid_get_Scalar_ (GrB_PLUS_MONOID_INT32, s_fp64, + GxB_MONOID_IDENTITY)) ; + ERR (GrB_Monoid_get_Scalar_ (GrB_PLUS_MONOID_INT32, s_fp64, + GxB_MONOID_TERMINAL)) ; + ERR (GrB_Monoid_get_Scalar_ (GrB_MAX_MONOID_INT32, s_fp64, + GxB_MONOID_IDENTITY)) ; + ERR (GrB_Monoid_get_Scalar_ (GrB_MAX_MONOID_INT32, s_fp64, + GxB_MONOID_TERMINAL)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Monoid_get_Scalar_ (GrB_MAX_MONOID_INT32, s_fp64, + GrB_OUTP_FIELD)) ; + ERR (GrB_Monoid_set_String_(GrB_MAX_MONOID_INT32, "newname", GrB_NAME)) ; + + op = NULL ; + OK (GrB_Monoid_get_SIZE_ (monoid, &size, GxB_MONOID_OPERATOR)) ; + CHECK (size == sizeof (GrB_BinaryOp)) ; + OK (GrB_Monoid_get_VOID (monoid, (void *) (&op), GxB_MONOID_OPERATOR)) ; + CHECK (op == binop) ; + OK (GrB_Monoid_get_VOID_ (GrB_PLUS_MONOID_INT32, (void *) &op, + GxB_MONOID_OPERATOR)) ; + CHECK (op == GrB_PLUS_INT32) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&binop) ; + GrB_free (&monoid) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test31: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test32.c b/GraphBLAS/Test/GB_mex_test32.c new file mode 100644 index 0000000000..c35963840b --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test32.c @@ -0,0 +1,2271 @@ +//------------------------------------------------------------------------------ +// GB_mex_test32: test GrB_get and GrB_set (semirings) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test32" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +#define GETOP(op,opname) \ +{ \ + size_t siz1, siz2, siz3 ; \ + OK (GrB_Semiring_get_String (op, name, GrB_NAME)) ; \ + CHECK (MATCH (name, opname)) ; \ + OK (GrB_Semiring_get_SIZE (op, &size, GrB_NAME)) ; \ + CHECK (size == strlen (name) + 1) ; \ + GrB_Info info2, info3 ; \ + info2 = GrB_Semiring_get_SIZE (op, &siz1, GrB_INP0_TYPE_STRING) ; \ + info3 = GrB_Semiring_get_String (op, name, GrB_INP0_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz1 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz1 == 1) ; } \ + info2 = GrB_Semiring_get_SIZE (op, &siz2, GrB_INP1_TYPE_STRING) ; \ + info3 = GrB_Semiring_get_String (op, name, GrB_INP1_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz2 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz1 == 1) ; } \ + info2 = GrB_Semiring_get_SIZE (op, &siz3, GrB_OUTP_TYPE_STRING) ; \ + info3 = GrB_Semiring_get_String (op, name, GrB_OUTP_TYPE_STRING) ; \ + CHECK (info2 == info3) ; \ + CHECK (siz3 == strlen (name) + 1) ; \ + if (info2 == GrB_NO_VALUE) { CHECK (siz1 == 1) ; } \ +} + +#define GETNAME(op) \ +{ \ + GETOP (op, #op) ; \ +/* OK (GxB_Semiring_fprint (sm, "semiring", 3, NULL)) ; */ \ +} + +#define GETNAM2(op,alias) \ +{ \ + GETOP (op,alias) ; \ +/* OK (GxB_Semiring_fprint (sm, "semiring", 3, NULL)) ; */ \ +} + +void mytimes (float *z, const float *x, const float *y) ; +void mytimes (float *z, const float *x, const float *y) { (*z) = (*x)*(*y) ; } +#define MYTIMES_DEFN \ +"void mytimes (float *z, const float *x, const float *y) { (*z) = (*x)*(*y) ; }" + +void myadd (float *z, const float *x, const float *y) ; +void myadd (float *z, const float *x, const float *y) { (*z) = (*x)+(*y) ; } +#define MYADD_DEFN \ +"void myadd (float *z, const float *x, const float *y) { (*z) = (*x)+(*y) ; }" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_BinaryOp times = NULL, add = NULL, op = NULL ; + GrB_Monoid monoid = NULL, mon = NULL ; + GrB_Semiring semiring = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [1024] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + GrB_Index nvals = 999 ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GrB_Semiring get name + //-------------------------------------------------------------------------- + + //-------------------------------------------------------------------------- + // *_FIRST + //-------------------------------------------------------------------------- + + GETNAME (GrB_MIN_FIRST_SEMIRING_INT8) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_INT16) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_INT32) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_INT64) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_UINT8) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_UINT16) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_UINT32) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_UINT64) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_FP32) ; + GETNAME (GrB_MIN_FIRST_SEMIRING_FP64) ; + + GETNAM2 (GxB_MIN_FIRST_INT8, "GrB_MIN_FIRST_SEMIRING_INT8") ; + GETNAM2 (GxB_MIN_FIRST_INT16, "GrB_MIN_FIRST_SEMIRING_INT16") ; + GETNAM2 (GxB_MIN_FIRST_INT32, "GrB_MIN_FIRST_SEMIRING_INT32") ; + GETNAM2 (GxB_MIN_FIRST_INT64, "GrB_MIN_FIRST_SEMIRING_INT64") ; + GETNAM2 (GxB_MIN_FIRST_UINT8, "GrB_MIN_FIRST_SEMIRING_UINT8") ; + GETNAM2 (GxB_MIN_FIRST_UINT16, "GrB_MIN_FIRST_SEMIRING_UINT16") ; + GETNAM2 (GxB_MIN_FIRST_UINT32, "GrB_MIN_FIRST_SEMIRING_UINT32") ; + GETNAM2 (GxB_MIN_FIRST_UINT64, "GrB_MIN_FIRST_SEMIRING_UINT64") ; + GETNAM2 (GxB_MIN_FIRST_FP32, "GrB_MIN_FIRST_SEMIRING_FP32") ; + GETNAM2 (GxB_MIN_FIRST_FP64, "GrB_MIN_FIRST_SEMIRING_FP64") ; + + GETNAME (GrB_MAX_FIRST_SEMIRING_INT8) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_INT16) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_INT32) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_INT64) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_UINT8) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_UINT16) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_UINT32) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_UINT64) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_FP32) ; + GETNAME (GrB_MAX_FIRST_SEMIRING_FP64) ; + + GETNAM2 (GxB_MAX_FIRST_INT8, "GrB_MAX_FIRST_SEMIRING_INT8") ; + GETNAM2 (GxB_MAX_FIRST_INT16, "GrB_MAX_FIRST_SEMIRING_INT16") ; + GETNAM2 (GxB_MAX_FIRST_INT32, "GrB_MAX_FIRST_SEMIRING_INT32") ; + GETNAM2 (GxB_MAX_FIRST_INT64, "GrB_MAX_FIRST_SEMIRING_INT64") ; + GETNAM2 (GxB_MAX_FIRST_UINT8, "GrB_MAX_FIRST_SEMIRING_UINT8") ; + GETNAM2 (GxB_MAX_FIRST_UINT16, "GrB_MAX_FIRST_SEMIRING_UINT16") ; + GETNAM2 (GxB_MAX_FIRST_UINT32, "GrB_MAX_FIRST_SEMIRING_UINT32") ; + GETNAM2 (GxB_MAX_FIRST_UINT64, "GrB_MAX_FIRST_SEMIRING_UINT64") ; + GETNAM2 (GxB_MAX_FIRST_FP32, "GrB_MAX_FIRST_SEMIRING_FP32") ; + GETNAM2 (GxB_MAX_FIRST_FP64, "GrB_MAX_FIRST_SEMIRING_FP64") ; + + GETNAME (GxB_PLUS_FIRST_INT8) ; + GETNAME (GxB_PLUS_FIRST_INT16) ; + GETNAME (GxB_PLUS_FIRST_INT32) ; + GETNAME (GxB_PLUS_FIRST_INT64) ; + GETNAME (GxB_PLUS_FIRST_UINT8) ; + GETNAME (GxB_PLUS_FIRST_UINT16) ; + GETNAME (GxB_PLUS_FIRST_UINT32) ; + GETNAME (GxB_PLUS_FIRST_UINT64) ; + GETNAME (GxB_PLUS_FIRST_FP32) ; + GETNAME (GxB_PLUS_FIRST_FP64) ; + GETNAME (GxB_PLUS_FIRST_FC32) ; + GETNAME (GxB_PLUS_FIRST_FC64) ; + + GETNAME (GxB_TIMES_FIRST_INT8) ; + GETNAME (GxB_TIMES_FIRST_INT16) ; + GETNAME (GxB_TIMES_FIRST_INT32) ; + GETNAME (GxB_TIMES_FIRST_INT64) ; + GETNAME (GxB_TIMES_FIRST_UINT8) ; + GETNAME (GxB_TIMES_FIRST_UINT16) ; + GETNAME (GxB_TIMES_FIRST_UINT32) ; + GETNAME (GxB_TIMES_FIRST_UINT64) ; + GETNAME (GxB_TIMES_FIRST_FP32) ; + GETNAME (GxB_TIMES_FIRST_FP64) ; + GETNAME (GxB_TIMES_FIRST_FC32) ; + GETNAME (GxB_TIMES_FIRST_FC64) ; + + GETNAME (GxB_ANY_FIRST_INT8) ; + GETNAME (GxB_ANY_FIRST_INT16) ; + GETNAME (GxB_ANY_FIRST_INT32) ; + GETNAME (GxB_ANY_FIRST_INT64) ; + GETNAME (GxB_ANY_FIRST_UINT8) ; + GETNAME (GxB_ANY_FIRST_UINT16) ; + GETNAME (GxB_ANY_FIRST_UINT32) ; + GETNAME (GxB_ANY_FIRST_UINT64) ; + GETNAME (GxB_ANY_FIRST_FP32) ; + GETNAME (GxB_ANY_FIRST_FP64) ; + GETNAME (GxB_ANY_FIRST_FC32) ; + GETNAME (GxB_ANY_FIRST_FC64) ; + + GETNAME (GxB_LOR_FIRST_BOOL) ; + GETNAME (GxB_LAND_FIRST_BOOL) ; + GETNAME (GxB_LXOR_FIRST_BOOL) ; + GETNAME (GxB_EQ_FIRST_BOOL) ; + GETNAME (GxB_ANY_FIRST_BOOL) ; + + //-------------------------------------------------------------------------- + // *_SECOND + //-------------------------------------------------------------------------- + + GETNAME (GrB_MIN_SECOND_SEMIRING_INT8) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_INT16) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_INT32) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_INT64) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_UINT8) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_UINT16) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_UINT32) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_UINT64) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_FP32) ; + GETNAME (GrB_MIN_SECOND_SEMIRING_FP64) ; + + GETNAM2 (GxB_MIN_SECOND_INT8, "GrB_MIN_SECOND_SEMIRING_INT8") ; + GETNAM2 (GxB_MIN_SECOND_INT16, "GrB_MIN_SECOND_SEMIRING_INT16") ; + GETNAM2 (GxB_MIN_SECOND_INT32, "GrB_MIN_SECOND_SEMIRING_INT32") ; + GETNAM2 (GxB_MIN_SECOND_INT64, "GrB_MIN_SECOND_SEMIRING_INT64") ; + GETNAM2 (GxB_MIN_SECOND_UINT8, "GrB_MIN_SECOND_SEMIRING_UINT8") ; + GETNAM2 (GxB_MIN_SECOND_UINT16, "GrB_MIN_SECOND_SEMIRING_UINT16") ; + GETNAM2 (GxB_MIN_SECOND_UINT32, "GrB_MIN_SECOND_SEMIRING_UINT32") ; + GETNAM2 (GxB_MIN_SECOND_UINT64, "GrB_MIN_SECOND_SEMIRING_UINT64") ; + GETNAM2 (GxB_MIN_SECOND_FP32, "GrB_MIN_SECOND_SEMIRING_FP32") ; + GETNAM2 (GxB_MIN_SECOND_FP64, "GrB_MIN_SECOND_SEMIRING_FP64") ; + + GETNAME (GrB_MAX_SECOND_SEMIRING_INT8) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_INT16) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_INT32) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_INT64) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_UINT8) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_UINT16) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_UINT32) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_UINT64) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_FP32) ; + GETNAME (GrB_MAX_SECOND_SEMIRING_FP64) ; + + GETNAM2 (GxB_MAX_SECOND_INT8, "GrB_MAX_SECOND_SEMIRING_INT8") ; + GETNAM2 (GxB_MAX_SECOND_INT16, "GrB_MAX_SECOND_SEMIRING_INT16") ; + GETNAM2 (GxB_MAX_SECOND_INT32, "GrB_MAX_SECOND_SEMIRING_INT32") ; + GETNAM2 (GxB_MAX_SECOND_INT64, "GrB_MAX_SECOND_SEMIRING_INT64") ; + GETNAM2 (GxB_MAX_SECOND_UINT8, "GrB_MAX_SECOND_SEMIRING_UINT8") ; + GETNAM2 (GxB_MAX_SECOND_UINT16, "GrB_MAX_SECOND_SEMIRING_UINT16") ; + GETNAM2 (GxB_MAX_SECOND_UINT32, "GrB_MAX_SECOND_SEMIRING_UINT32") ; + GETNAM2 (GxB_MAX_SECOND_UINT64, "GrB_MAX_SECOND_SEMIRING_UINT64") ; + GETNAM2 (GxB_MAX_SECOND_FP32, "GrB_MAX_SECOND_SEMIRING_FP32") ; + GETNAM2 (GxB_MAX_SECOND_FP64, "GrB_MAX_SECOND_SEMIRING_FP64") ; + + GETNAME (GxB_PLUS_SECOND_INT8) ; + GETNAME (GxB_PLUS_SECOND_INT16) ; + GETNAME (GxB_PLUS_SECOND_INT32) ; + GETNAME (GxB_PLUS_SECOND_INT64) ; + GETNAME (GxB_PLUS_SECOND_UINT8) ; + GETNAME (GxB_PLUS_SECOND_UINT16) ; + GETNAME (GxB_PLUS_SECOND_UINT32) ; + GETNAME (GxB_PLUS_SECOND_UINT64) ; + GETNAME (GxB_PLUS_SECOND_FP32) ; + GETNAME (GxB_PLUS_SECOND_FP64) ; + GETNAME (GxB_PLUS_SECOND_FC32) ; + GETNAME (GxB_PLUS_SECOND_FC64) ; + + GETNAME (GxB_TIMES_SECOND_INT8) ; + GETNAME (GxB_TIMES_SECOND_INT16) ; + GETNAME (GxB_TIMES_SECOND_INT32) ; + GETNAME (GxB_TIMES_SECOND_INT64) ; + GETNAME (GxB_TIMES_SECOND_UINT8) ; + GETNAME (GxB_TIMES_SECOND_UINT16) ; + GETNAME (GxB_TIMES_SECOND_UINT32) ; + GETNAME (GxB_TIMES_SECOND_UINT64) ; + GETNAME (GxB_TIMES_SECOND_FP32) ; + GETNAME (GxB_TIMES_SECOND_FP64) ; + GETNAME (GxB_TIMES_SECOND_FC32) ; + GETNAME (GxB_TIMES_SECOND_FC64) ; + + GETNAME (GxB_ANY_SECOND_INT8) ; + GETNAME (GxB_ANY_SECOND_INT16) ; + GETNAME (GxB_ANY_SECOND_INT32) ; + GETNAME (GxB_ANY_SECOND_INT64) ; + GETNAME (GxB_ANY_SECOND_UINT8) ; + GETNAME (GxB_ANY_SECOND_UINT16) ; + GETNAME (GxB_ANY_SECOND_UINT32) ; + GETNAME (GxB_ANY_SECOND_UINT64) ; + GETNAME (GxB_ANY_SECOND_FP32) ; + GETNAME (GxB_ANY_SECOND_FP64) ; + GETNAME (GxB_ANY_SECOND_FC32) ; + GETNAME (GxB_ANY_SECOND_FC64) ; + + GETNAME (GxB_LOR_SECOND_BOOL) ; + GETNAME (GxB_LAND_SECOND_BOOL) ; + GETNAME (GxB_LXOR_SECOND_BOOL) ; + GETNAME (GxB_EQ_SECOND_BOOL) ; + GETNAME (GxB_ANY_SECOND_BOOL) ; + + //-------------------------------------------------------------------------- + // *_PAIR + //-------------------------------------------------------------------------- + + GETNAM2 (GxB_MIN_PAIR_INT8, "GxB_ANY_PAIR_INT8") ; + GETNAM2 (GxB_MIN_PAIR_INT16, "GxB_ANY_PAIR_INT16") ; + GETNAM2 (GxB_MIN_PAIR_INT32, "GxB_ANY_PAIR_INT32") ; + GETNAM2 (GxB_MIN_PAIR_INT64, "GxB_ANY_PAIR_INT64") ; + GETNAM2 (GxB_MIN_PAIR_UINT8, "GxB_ANY_PAIR_UINT8") ; + GETNAM2 (GxB_MIN_PAIR_UINT16, "GxB_ANY_PAIR_UINT16") ; + GETNAM2 (GxB_MIN_PAIR_UINT32, "GxB_ANY_PAIR_UINT32") ; + GETNAM2 (GxB_MIN_PAIR_UINT64, "GxB_ANY_PAIR_UINT64") ; + GETNAM2 (GxB_MIN_PAIR_FP32, "GxB_ANY_PAIR_FP32") ; + GETNAM2 (GxB_MIN_PAIR_FP64, "GxB_ANY_PAIR_FP64") ; + + GETNAM2 (GxB_MAX_PAIR_INT8, "GxB_ANY_PAIR_INT8") ; + GETNAM2 (GxB_MAX_PAIR_INT16, "GxB_ANY_PAIR_INT16") ; + GETNAM2 (GxB_MAX_PAIR_INT32, "GxB_ANY_PAIR_INT32") ; + GETNAM2 (GxB_MAX_PAIR_INT64, "GxB_ANY_PAIR_INT64") ; + GETNAM2 (GxB_MAX_PAIR_UINT8, "GxB_ANY_PAIR_UINT8") ; + GETNAM2 (GxB_MAX_PAIR_UINT16, "GxB_ANY_PAIR_UINT16") ; + GETNAM2 (GxB_MAX_PAIR_UINT32, "GxB_ANY_PAIR_UINT32") ; + GETNAM2 (GxB_MAX_PAIR_UINT64, "GxB_ANY_PAIR_UINT64") ; + GETNAM2 (GxB_MAX_PAIR_FP32, "GxB_ANY_PAIR_FP32") ; + GETNAM2 (GxB_MAX_PAIR_FP64, "GxB_ANY_PAIR_FP64") ; + + GETNAME (GxB_PLUS_PAIR_INT8) ; + GETNAME (GxB_PLUS_PAIR_INT16) ; + GETNAME (GxB_PLUS_PAIR_INT32) ; + GETNAME (GxB_PLUS_PAIR_INT64) ; + GETNAME (GxB_PLUS_PAIR_UINT8) ; + GETNAME (GxB_PLUS_PAIR_UINT16) ; + GETNAME (GxB_PLUS_PAIR_UINT32) ; + GETNAME (GxB_PLUS_PAIR_UINT64) ; + GETNAME (GxB_PLUS_PAIR_FP32) ; + GETNAME (GxB_PLUS_PAIR_FP64) ; + GETNAME (GxB_PLUS_PAIR_FC32) ; + GETNAME (GxB_PLUS_PAIR_FC64) ; + + GETNAM2 (GxB_TIMES_PAIR_INT8, "GxB_ANY_PAIR_INT8") ; + GETNAM2 (GxB_TIMES_PAIR_INT16, "GxB_ANY_PAIR_INT16") ; + GETNAM2 (GxB_TIMES_PAIR_INT32, "GxB_ANY_PAIR_INT32") ; + GETNAM2 (GxB_TIMES_PAIR_INT64, "GxB_ANY_PAIR_INT64") ; + GETNAM2 (GxB_TIMES_PAIR_UINT8, "GxB_ANY_PAIR_UINT8") ; + GETNAM2 (GxB_TIMES_PAIR_UINT16, "GxB_ANY_PAIR_UINT16") ; + GETNAM2 (GxB_TIMES_PAIR_UINT32, "GxB_ANY_PAIR_UINT32") ; + GETNAM2 (GxB_TIMES_PAIR_UINT64, "GxB_ANY_PAIR_UINT64") ; + GETNAM2 (GxB_TIMES_PAIR_FP32, "GxB_ANY_PAIR_FP32") ; + GETNAM2 (GxB_TIMES_PAIR_FP64, "GxB_ANY_PAIR_FP64") ; + GETNAM2 (GxB_TIMES_PAIR_FC32, "GxB_ANY_PAIR_FC32") ; + GETNAM2 (GxB_TIMES_PAIR_FC64, "GxB_ANY_PAIR_FC64") ; + + GETNAME (GxB_ANY_PAIR_INT8) ; + GETNAME (GxB_ANY_PAIR_INT16) ; + GETNAME (GxB_ANY_PAIR_INT32) ; + GETNAME (GxB_ANY_PAIR_INT64) ; + GETNAME (GxB_ANY_PAIR_UINT8) ; + GETNAME (GxB_ANY_PAIR_UINT16) ; + GETNAME (GxB_ANY_PAIR_UINT32) ; + GETNAME (GxB_ANY_PAIR_UINT64) ; + GETNAME (GxB_ANY_PAIR_FP32) ; + GETNAME (GxB_ANY_PAIR_FP64) ; + GETNAME (GxB_ANY_PAIR_FC32) ; + GETNAME (GxB_ANY_PAIR_FC64) ; + + GETNAM2 (GxB_LOR_PAIR_BOOL, "GxB_ANY_PAIR_BOOL") ; + GETNAM2 (GxB_LAND_PAIR_BOOL, "GxB_ANY_PAIR_BOOL") ; + GETNAME (GxB_LXOR_PAIR_BOOL) ; + GETNAM2 (GxB_EQ_PAIR_BOOL, "GxB_ANY_PAIR_BOOL") ; + GETNAME (GxB_ANY_PAIR_BOOL) ; + + //-------------------------------------------------------------------------- + // *_MIN + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_MIN_INT8) ; + GETNAME (GxB_MIN_MIN_INT16) ; + GETNAME (GxB_MIN_MIN_INT32) ; + GETNAME (GxB_MIN_MIN_INT64) ; + GETNAME (GxB_MIN_MIN_UINT8) ; + GETNAME (GxB_MIN_MIN_UINT16) ; + GETNAME (GxB_MIN_MIN_UINT32) ; + GETNAME (GxB_MIN_MIN_UINT64) ; + GETNAME (GxB_MIN_MIN_FP32) ; + GETNAME (GxB_MIN_MIN_FP64) ; + + GETNAME (GrB_MAX_MIN_SEMIRING_INT8) ; + GETNAME (GrB_MAX_MIN_SEMIRING_INT16) ; + GETNAME (GrB_MAX_MIN_SEMIRING_INT32) ; + GETNAME (GrB_MAX_MIN_SEMIRING_INT64) ; + GETNAME (GrB_MAX_MIN_SEMIRING_UINT8) ; + GETNAME (GrB_MAX_MIN_SEMIRING_UINT16) ; + GETNAME (GrB_MAX_MIN_SEMIRING_UINT32) ; + GETNAME (GrB_MAX_MIN_SEMIRING_UINT64) ; + GETNAME (GrB_MAX_MIN_SEMIRING_FP32) ; + GETNAME (GrB_MAX_MIN_SEMIRING_FP64) ; + + GETNAM2 (GxB_MAX_MIN_INT8, "GrB_MAX_MIN_SEMIRING_INT8") ; + GETNAM2 (GxB_MAX_MIN_INT16, "GrB_MAX_MIN_SEMIRING_INT16") ; + GETNAM2 (GxB_MAX_MIN_INT32, "GrB_MAX_MIN_SEMIRING_INT32") ; + GETNAM2 (GxB_MAX_MIN_INT64, "GrB_MAX_MIN_SEMIRING_INT64") ; + GETNAM2 (GxB_MAX_MIN_UINT8, "GrB_MAX_MIN_SEMIRING_UINT8") ; + GETNAM2 (GxB_MAX_MIN_UINT16, "GrB_MAX_MIN_SEMIRING_UINT16") ; + GETNAM2 (GxB_MAX_MIN_UINT32, "GrB_MAX_MIN_SEMIRING_UINT32") ; + GETNAM2 (GxB_MAX_MIN_UINT64, "GrB_MAX_MIN_SEMIRING_UINT64") ; + GETNAM2 (GxB_MAX_MIN_FP32, "GrB_MAX_MIN_SEMIRING_FP32") ; + GETNAM2 (GxB_MAX_MIN_FP64, "GrB_MAX_MIN_SEMIRING_FP64") ; + + GETNAME (GrB_PLUS_MIN_SEMIRING_INT8) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_INT16) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_INT32) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_INT64) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_UINT8) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_UINT16) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_UINT32) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_UINT64) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_FP32) ; + GETNAME (GrB_PLUS_MIN_SEMIRING_FP64) ; + + GETNAM2 (GxB_PLUS_MIN_INT8, "GrB_PLUS_MIN_SEMIRING_INT8") ; + GETNAM2 (GxB_PLUS_MIN_INT16, "GrB_PLUS_MIN_SEMIRING_INT16") ; + GETNAM2 (GxB_PLUS_MIN_INT32, "GrB_PLUS_MIN_SEMIRING_INT32") ; + GETNAM2 (GxB_PLUS_MIN_INT64, "GrB_PLUS_MIN_SEMIRING_INT64") ; + GETNAM2 (GxB_PLUS_MIN_UINT8, "GrB_PLUS_MIN_SEMIRING_UINT8") ; + GETNAM2 (GxB_PLUS_MIN_UINT16, "GrB_PLUS_MIN_SEMIRING_UINT16") ; + GETNAM2 (GxB_PLUS_MIN_UINT32, "GrB_PLUS_MIN_SEMIRING_UINT32") ; + GETNAM2 (GxB_PLUS_MIN_UINT64, "GrB_PLUS_MIN_SEMIRING_UINT64") ; + GETNAM2 (GxB_PLUS_MIN_FP32, "GrB_PLUS_MIN_SEMIRING_FP32") ; + GETNAM2 (GxB_PLUS_MIN_FP64, "GrB_PLUS_MIN_SEMIRING_FP64") ; + + GETNAME (GxB_TIMES_MIN_INT8) ; + GETNAME (GxB_TIMES_MIN_INT16) ; + GETNAME (GxB_TIMES_MIN_INT32) ; + GETNAME (GxB_TIMES_MIN_INT64) ; + GETNAME (GxB_TIMES_MIN_UINT8) ; + GETNAME (GxB_TIMES_MIN_UINT16) ; + GETNAME (GxB_TIMES_MIN_UINT32) ; + GETNAME (GxB_TIMES_MIN_UINT64) ; + GETNAME (GxB_TIMES_MIN_FP32) ; + GETNAME (GxB_TIMES_MIN_FP64) ; + + GETNAME (GxB_ANY_MIN_INT8) ; + GETNAME (GxB_ANY_MIN_INT16) ; + GETNAME (GxB_ANY_MIN_INT32) ; + GETNAME (GxB_ANY_MIN_INT64) ; + GETNAME (GxB_ANY_MIN_UINT8) ; + GETNAME (GxB_ANY_MIN_UINT16) ; + GETNAME (GxB_ANY_MIN_UINT32) ; + GETNAME (GxB_ANY_MIN_UINT64) ; + GETNAME (GxB_ANY_MIN_FP32) ; + GETNAME (GxB_ANY_MIN_FP64) ; + + //-------------------------------------------------------------------------- + // *_MAX + //-------------------------------------------------------------------------- + + GETNAME (GxB_MAX_MAX_INT8) ; + GETNAME (GxB_MAX_MAX_INT16) ; + GETNAME (GxB_MAX_MAX_INT32) ; + GETNAME (GxB_MAX_MAX_INT64) ; + GETNAME (GxB_MAX_MAX_UINT8) ; + GETNAME (GxB_MAX_MAX_UINT16) ; + GETNAME (GxB_MAX_MAX_UINT32) ; + GETNAME (GxB_MAX_MAX_UINT64) ; + GETNAME (GxB_MAX_MAX_FP32) ; + GETNAME (GxB_MAX_MAX_FP64) ; + + GETNAME (GrB_MIN_MAX_SEMIRING_INT8) ; + GETNAME (GrB_MIN_MAX_SEMIRING_INT16) ; + GETNAME (GrB_MIN_MAX_SEMIRING_INT32) ; + GETNAME (GrB_MIN_MAX_SEMIRING_INT64) ; + GETNAME (GrB_MIN_MAX_SEMIRING_UINT8) ; + GETNAME (GrB_MIN_MAX_SEMIRING_UINT16) ; + GETNAME (GrB_MIN_MAX_SEMIRING_UINT32) ; + GETNAME (GrB_MIN_MAX_SEMIRING_UINT64) ; + GETNAME (GrB_MIN_MAX_SEMIRING_FP32) ; + GETNAME (GrB_MIN_MAX_SEMIRING_FP64) ; + + GETNAM2 (GxB_MIN_MAX_INT8, "GrB_MIN_MAX_SEMIRING_INT8") ; + GETNAM2 (GxB_MIN_MAX_INT16, "GrB_MIN_MAX_SEMIRING_INT16") ; + GETNAM2 (GxB_MIN_MAX_INT32, "GrB_MIN_MAX_SEMIRING_INT32") ; + GETNAM2 (GxB_MIN_MAX_INT64, "GrB_MIN_MAX_SEMIRING_INT64") ; + GETNAM2 (GxB_MIN_MAX_UINT8, "GrB_MIN_MAX_SEMIRING_UINT8") ; + GETNAM2 (GxB_MIN_MAX_UINT16, "GrB_MIN_MAX_SEMIRING_UINT16") ; + GETNAM2 (GxB_MIN_MAX_UINT32, "GrB_MIN_MAX_SEMIRING_UINT32") ; + GETNAM2 (GxB_MIN_MAX_UINT64, "GrB_MIN_MAX_SEMIRING_UINT64") ; + GETNAM2 (GxB_MIN_MAX_FP32, "GrB_MIN_MAX_SEMIRING_FP32") ; + GETNAM2 (GxB_MIN_MAX_FP64, "GrB_MIN_MAX_SEMIRING_FP64") ; + + GETNAME (GxB_PLUS_MAX_INT8) ; + GETNAME (GxB_PLUS_MAX_INT16) ; + GETNAME (GxB_PLUS_MAX_INT32) ; + GETNAME (GxB_PLUS_MAX_INT64) ; + GETNAME (GxB_PLUS_MAX_UINT8) ; + GETNAME (GxB_PLUS_MAX_UINT16) ; + GETNAME (GxB_PLUS_MAX_UINT32) ; + GETNAME (GxB_PLUS_MAX_UINT64) ; + GETNAME (GxB_PLUS_MAX_FP32) ; + GETNAME (GxB_PLUS_MAX_FP64) ; + + GETNAME (GxB_TIMES_MAX_INT8) ; + GETNAME (GxB_TIMES_MAX_INT16) ; + GETNAME (GxB_TIMES_MAX_INT32) ; + GETNAME (GxB_TIMES_MAX_INT64) ; + GETNAME (GxB_TIMES_MAX_UINT8) ; + GETNAME (GxB_TIMES_MAX_UINT16) ; + GETNAME (GxB_TIMES_MAX_UINT32) ; + GETNAME (GxB_TIMES_MAX_UINT64) ; + GETNAME (GxB_TIMES_MAX_FP32) ; + GETNAME (GxB_TIMES_MAX_FP64) ; + + GETNAME (GxB_ANY_MAX_INT8) ; + GETNAME (GxB_ANY_MAX_INT16) ; + GETNAME (GxB_ANY_MAX_INT32) ; + GETNAME (GxB_ANY_MAX_INT64) ; + GETNAME (GxB_ANY_MAX_UINT8) ; + GETNAME (GxB_ANY_MAX_UINT16) ; + GETNAME (GxB_ANY_MAX_UINT32) ; + GETNAME (GxB_ANY_MAX_UINT64) ; + GETNAME (GxB_ANY_MAX_FP32) ; + GETNAME (GxB_ANY_MAX_FP64) ; + + //-------------------------------------------------------------------------- + // *_PLUS + //-------------------------------------------------------------------------- + + GETNAME (GrB_MIN_PLUS_SEMIRING_INT8) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_INT16) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_INT32) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_INT64) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_UINT8) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_UINT16) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_UINT32) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_UINT64) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_FP32) ; + GETNAME (GrB_MIN_PLUS_SEMIRING_FP64) ; + + GETNAM2 (GxB_MIN_PLUS_INT8, "GrB_MIN_PLUS_SEMIRING_INT8") ; + GETNAM2 (GxB_MIN_PLUS_INT16, "GrB_MIN_PLUS_SEMIRING_INT16") ; + GETNAM2 (GxB_MIN_PLUS_INT32, "GrB_MIN_PLUS_SEMIRING_INT32") ; + GETNAM2 (GxB_MIN_PLUS_INT64, "GrB_MIN_PLUS_SEMIRING_INT64") ; + GETNAM2 (GxB_MIN_PLUS_UINT8, "GrB_MIN_PLUS_SEMIRING_UINT8") ; + GETNAM2 (GxB_MIN_PLUS_UINT16, "GrB_MIN_PLUS_SEMIRING_UINT16") ; + GETNAM2 (GxB_MIN_PLUS_UINT32, "GrB_MIN_PLUS_SEMIRING_UINT32") ; + GETNAM2 (GxB_MIN_PLUS_UINT64, "GrB_MIN_PLUS_SEMIRING_UINT64") ; + GETNAM2 (GxB_MIN_PLUS_FP32, "GrB_MIN_PLUS_SEMIRING_FP32") ; + GETNAM2 (GxB_MIN_PLUS_FP64, "GrB_MIN_PLUS_SEMIRING_FP64") ; + + GETNAME (GrB_MAX_PLUS_SEMIRING_INT8) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_INT16) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_INT32) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_INT64) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_UINT8) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_UINT16) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_UINT32) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_UINT64) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_FP32) ; + GETNAME (GrB_MAX_PLUS_SEMIRING_FP64) ; + + GETNAM2 (GxB_MAX_PLUS_INT8, "GrB_MAX_PLUS_SEMIRING_INT8") ; + GETNAM2 (GxB_MAX_PLUS_INT16, "GrB_MAX_PLUS_SEMIRING_INT16") ; + GETNAM2 (GxB_MAX_PLUS_INT32, "GrB_MAX_PLUS_SEMIRING_INT32") ; + GETNAM2 (GxB_MAX_PLUS_INT64, "GrB_MAX_PLUS_SEMIRING_INT64") ; + GETNAM2 (GxB_MAX_PLUS_UINT8, "GrB_MAX_PLUS_SEMIRING_UINT8") ; + GETNAM2 (GxB_MAX_PLUS_UINT16, "GrB_MAX_PLUS_SEMIRING_UINT16") ; + GETNAM2 (GxB_MAX_PLUS_UINT32, "GrB_MAX_PLUS_SEMIRING_UINT32") ; + GETNAM2 (GxB_MAX_PLUS_UINT64, "GrB_MAX_PLUS_SEMIRING_UINT64") ; + GETNAM2 (GxB_MAX_PLUS_FP32, "GrB_MAX_PLUS_SEMIRING_FP32") ; + GETNAM2 (GxB_MAX_PLUS_FP64, "GrB_MAX_PLUS_SEMIRING_FP64") ; + + GETNAME (GxB_PLUS_PLUS_INT8) ; + GETNAME (GxB_PLUS_PLUS_INT16) ; + GETNAME (GxB_PLUS_PLUS_INT32) ; + GETNAME (GxB_PLUS_PLUS_INT64) ; + GETNAME (GxB_PLUS_PLUS_UINT8) ; + GETNAME (GxB_PLUS_PLUS_UINT16) ; + GETNAME (GxB_PLUS_PLUS_UINT32) ; + GETNAME (GxB_PLUS_PLUS_UINT64) ; + GETNAME (GxB_PLUS_PLUS_FP32) ; + GETNAME (GxB_PLUS_PLUS_FP64) ; + GETNAME (GxB_PLUS_PLUS_FC32) ; + GETNAME (GxB_PLUS_PLUS_FC64) ; + + GETNAME (GxB_TIMES_PLUS_INT8) ; + GETNAME (GxB_TIMES_PLUS_INT16) ; + GETNAME (GxB_TIMES_PLUS_INT32) ; + GETNAME (GxB_TIMES_PLUS_INT64) ; + GETNAME (GxB_TIMES_PLUS_UINT8) ; + GETNAME (GxB_TIMES_PLUS_UINT16) ; + GETNAME (GxB_TIMES_PLUS_UINT32) ; + GETNAME (GxB_TIMES_PLUS_UINT64) ; + GETNAME (GxB_TIMES_PLUS_FP32) ; + GETNAME (GxB_TIMES_PLUS_FP64) ; + GETNAME (GxB_TIMES_PLUS_FC32) ; + GETNAME (GxB_TIMES_PLUS_FC64) ; + + GETNAME (GxB_ANY_PLUS_INT8) ; + GETNAME (GxB_ANY_PLUS_INT16) ; + GETNAME (GxB_ANY_PLUS_INT32) ; + GETNAME (GxB_ANY_PLUS_INT64) ; + GETNAME (GxB_ANY_PLUS_UINT8) ; + GETNAME (GxB_ANY_PLUS_UINT16) ; + GETNAME (GxB_ANY_PLUS_UINT32) ; + GETNAME (GxB_ANY_PLUS_UINT64) ; + GETNAME (GxB_ANY_PLUS_FP32) ; + GETNAME (GxB_ANY_PLUS_FP64) ; + GETNAME (GxB_ANY_PLUS_FC32) ; + GETNAME (GxB_ANY_PLUS_FC64) ; + + //-------------------------------------------------------------------------- + // *_MINUS + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_MINUS_INT8) ; + GETNAME (GxB_MIN_MINUS_INT16) ; + GETNAME (GxB_MIN_MINUS_INT32) ; + GETNAME (GxB_MIN_MINUS_INT64) ; + GETNAME (GxB_MIN_MINUS_UINT8) ; + GETNAME (GxB_MIN_MINUS_UINT16) ; + GETNAME (GxB_MIN_MINUS_UINT32) ; + GETNAME (GxB_MIN_MINUS_UINT64) ; + GETNAME (GxB_MIN_MINUS_FP32) ; + GETNAME (GxB_MIN_MINUS_FP64) ; + + GETNAME (GxB_MAX_MINUS_INT8) ; + GETNAME (GxB_MAX_MINUS_INT16) ; + GETNAME (GxB_MAX_MINUS_INT32) ; + GETNAME (GxB_MAX_MINUS_INT64) ; + GETNAME (GxB_MAX_MINUS_UINT8) ; + GETNAME (GxB_MAX_MINUS_UINT16) ; + GETNAME (GxB_MAX_MINUS_UINT32) ; + GETNAME (GxB_MAX_MINUS_UINT64) ; + GETNAME (GxB_MAX_MINUS_FP32) ; + GETNAME (GxB_MAX_MINUS_FP64) ; + + GETNAME (GxB_PLUS_MINUS_INT8) ; + GETNAME (GxB_PLUS_MINUS_INT16) ; + GETNAME (GxB_PLUS_MINUS_INT32) ; + GETNAME (GxB_PLUS_MINUS_INT64) ; + GETNAME (GxB_PLUS_MINUS_UINT8) ; + GETNAME (GxB_PLUS_MINUS_UINT16) ; + GETNAME (GxB_PLUS_MINUS_UINT32) ; + GETNAME (GxB_PLUS_MINUS_UINT64) ; + GETNAME (GxB_PLUS_MINUS_FP32) ; + GETNAME (GxB_PLUS_MINUS_FP64) ; + GETNAME (GxB_PLUS_MINUS_FC32) ; + GETNAME (GxB_PLUS_MINUS_FC64) ; + + GETNAME (GxB_TIMES_MINUS_INT8) ; + GETNAME (GxB_TIMES_MINUS_INT16) ; + GETNAME (GxB_TIMES_MINUS_INT32) ; + GETNAME (GxB_TIMES_MINUS_INT64) ; + GETNAME (GxB_TIMES_MINUS_UINT8) ; + GETNAME (GxB_TIMES_MINUS_UINT16) ; + GETNAME (GxB_TIMES_MINUS_UINT32) ; + GETNAME (GxB_TIMES_MINUS_UINT64) ; + GETNAME (GxB_TIMES_MINUS_FP32) ; + GETNAME (GxB_TIMES_MINUS_FP64) ; + GETNAME (GxB_TIMES_MINUS_FC32) ; + GETNAME (GxB_TIMES_MINUS_FC64) ; + + GETNAME (GxB_ANY_MINUS_INT8) ; + GETNAME (GxB_ANY_MINUS_INT16) ; + GETNAME (GxB_ANY_MINUS_INT32) ; + GETNAME (GxB_ANY_MINUS_INT64) ; + GETNAME (GxB_ANY_MINUS_UINT8) ; + GETNAME (GxB_ANY_MINUS_UINT16) ; + GETNAME (GxB_ANY_MINUS_UINT32) ; + GETNAME (GxB_ANY_MINUS_UINT64) ; + GETNAME (GxB_ANY_MINUS_FP32) ; + GETNAME (GxB_ANY_MINUS_FP64) ; + GETNAME (GxB_ANY_MINUS_FC32) ; + GETNAME (GxB_ANY_MINUS_FC64) ; + + //-------------------------------------------------------------------------- + // *_TIMES + //-------------------------------------------------------------------------- + + GETNAME (GrB_MIN_TIMES_SEMIRING_INT8) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_INT16) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_INT32) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_INT64) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_UINT8) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_UINT16) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_UINT32) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_UINT64) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_FP32) ; + GETNAME (GrB_MIN_TIMES_SEMIRING_FP64) ; + + GETNAM2 (GxB_MIN_TIMES_INT8, "GrB_MIN_TIMES_SEMIRING_INT8") ; + GETNAM2 (GxB_MIN_TIMES_INT16, "GrB_MIN_TIMES_SEMIRING_INT16") ; + GETNAM2 (GxB_MIN_TIMES_INT32, "GrB_MIN_TIMES_SEMIRING_INT32") ; + GETNAM2 (GxB_MIN_TIMES_INT64, "GrB_MIN_TIMES_SEMIRING_INT64") ; + GETNAM2 (GxB_MIN_TIMES_UINT8, "GrB_MIN_TIMES_SEMIRING_UINT8") ; + GETNAM2 (GxB_MIN_TIMES_UINT16, "GrB_MIN_TIMES_SEMIRING_UINT16") ; + GETNAM2 (GxB_MIN_TIMES_UINT32, "GrB_MIN_TIMES_SEMIRING_UINT32") ; + GETNAM2 (GxB_MIN_TIMES_UINT64, "GrB_MIN_TIMES_SEMIRING_UINT64") ; + GETNAM2 (GxB_MIN_TIMES_FP32, "GrB_MIN_TIMES_SEMIRING_FP32") ; + GETNAM2 (GxB_MIN_TIMES_FP64, "GrB_MIN_TIMES_SEMIRING_FP64") ; + + GETNAME (GrB_MAX_TIMES_SEMIRING_INT8) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_INT16) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_INT32) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_INT64) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_UINT8) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_UINT16) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_UINT32) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_UINT64) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_FP32) ; + GETNAME (GrB_MAX_TIMES_SEMIRING_FP64) ; + + GETNAM2 (GxB_MAX_TIMES_INT8, "GrB_MAX_TIMES_SEMIRING_INT8") ; + GETNAM2 (GxB_MAX_TIMES_INT16, "GrB_MAX_TIMES_SEMIRING_INT16") ; + GETNAM2 (GxB_MAX_TIMES_INT32, "GrB_MAX_TIMES_SEMIRING_INT32") ; + GETNAM2 (GxB_MAX_TIMES_INT64, "GrB_MAX_TIMES_SEMIRING_INT64") ; + GETNAM2 (GxB_MAX_TIMES_UINT8, "GrB_MAX_TIMES_SEMIRING_UINT8") ; + GETNAM2 (GxB_MAX_TIMES_UINT16, "GrB_MAX_TIMES_SEMIRING_UINT16") ; + GETNAM2 (GxB_MAX_TIMES_UINT32, "GrB_MAX_TIMES_SEMIRING_UINT32") ; + GETNAM2 (GxB_MAX_TIMES_UINT64, "GrB_MAX_TIMES_SEMIRING_UINT64") ; + GETNAM2 (GxB_MAX_TIMES_FP32, "GrB_MAX_TIMES_SEMIRING_FP32") ; + GETNAM2 (GxB_MAX_TIMES_FP64, "GrB_MAX_TIMES_SEMIRING_FP64") ; + + GETNAME (GrB_PLUS_TIMES_SEMIRING_INT8) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_INT16) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_INT32) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_INT64) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_UINT8) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_UINT16) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_UINT32) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_UINT64) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_FP32) ; + GETNAME (GrB_PLUS_TIMES_SEMIRING_FP64) ; + + GETNAM2 (GxB_PLUS_TIMES_INT8, "GrB_PLUS_TIMES_SEMIRING_INT8") ; + GETNAM2 (GxB_PLUS_TIMES_INT16, "GrB_PLUS_TIMES_SEMIRING_INT16") ; + GETNAM2 (GxB_PLUS_TIMES_INT32, "GrB_PLUS_TIMES_SEMIRING_INT32") ; + GETNAM2 (GxB_PLUS_TIMES_INT64, "GrB_PLUS_TIMES_SEMIRING_INT64") ; + GETNAM2 (GxB_PLUS_TIMES_UINT8, "GrB_PLUS_TIMES_SEMIRING_UINT8") ; + GETNAM2 (GxB_PLUS_TIMES_UINT16, "GrB_PLUS_TIMES_SEMIRING_UINT16") ; + GETNAM2 (GxB_PLUS_TIMES_UINT32, "GrB_PLUS_TIMES_SEMIRING_UINT32") ; + GETNAM2 (GxB_PLUS_TIMES_UINT64, "GrB_PLUS_TIMES_SEMIRING_UINT64") ; + GETNAM2 (GxB_PLUS_TIMES_FP32, "GrB_PLUS_TIMES_SEMIRING_FP32") ; + GETNAM2 (GxB_PLUS_TIMES_FP64, "GrB_PLUS_TIMES_SEMIRING_FP64") ; + GETNAME (GxB_PLUS_TIMES_FC32) ; + GETNAME (GxB_PLUS_TIMES_FC64) ; + + GETNAME (GxB_TIMES_TIMES_INT8) ; + GETNAME (GxB_TIMES_TIMES_INT16) ; + GETNAME (GxB_TIMES_TIMES_INT32) ; + GETNAME (GxB_TIMES_TIMES_INT64) ; + GETNAME (GxB_TIMES_TIMES_UINT8) ; + GETNAME (GxB_TIMES_TIMES_UINT16) ; + GETNAME (GxB_TIMES_TIMES_UINT32) ; + GETNAME (GxB_TIMES_TIMES_UINT64) ; + GETNAME (GxB_TIMES_TIMES_FP32) ; + GETNAME (GxB_TIMES_TIMES_FP64) ; + GETNAME (GxB_TIMES_TIMES_FC32) ; + GETNAME (GxB_TIMES_TIMES_FC64) ; + + GETNAME (GxB_ANY_TIMES_INT8) ; + GETNAME (GxB_ANY_TIMES_INT16) ; + GETNAME (GxB_ANY_TIMES_INT32) ; + GETNAME (GxB_ANY_TIMES_INT64) ; + GETNAME (GxB_ANY_TIMES_UINT8) ; + GETNAME (GxB_ANY_TIMES_UINT16) ; + GETNAME (GxB_ANY_TIMES_UINT32) ; + GETNAME (GxB_ANY_TIMES_UINT64) ; + GETNAME (GxB_ANY_TIMES_FP32) ; + GETNAME (GxB_ANY_TIMES_FP64) ; + GETNAME (GxB_ANY_TIMES_FC32) ; + GETNAME (GxB_ANY_TIMES_FC64) ; + + //-------------------------------------------------------------------------- + // *_DIV + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_DIV_INT8) ; + GETNAME (GxB_MIN_DIV_INT16) ; + GETNAME (GxB_MIN_DIV_INT32) ; + GETNAME (GxB_MIN_DIV_INT64) ; + GETNAME (GxB_MIN_DIV_UINT8) ; + GETNAME (GxB_MIN_DIV_UINT16) ; + GETNAME (GxB_MIN_DIV_UINT32) ; + GETNAME (GxB_MIN_DIV_UINT64) ; + GETNAME (GxB_MIN_DIV_FP32) ; + GETNAME (GxB_MIN_DIV_FP64) ; + + GETNAME (GxB_MAX_DIV_INT8) ; + GETNAME (GxB_MAX_DIV_INT16) ; + GETNAME (GxB_MAX_DIV_INT32) ; + GETNAME (GxB_MAX_DIV_INT64) ; + GETNAME (GxB_MAX_DIV_UINT8) ; + GETNAME (GxB_MAX_DIV_UINT16) ; + GETNAME (GxB_MAX_DIV_UINT32) ; + GETNAME (GxB_MAX_DIV_UINT64) ; + GETNAME (GxB_MAX_DIV_FP32) ; + GETNAME (GxB_MAX_DIV_FP64) ; + + GETNAME (GxB_PLUS_DIV_INT8) ; + GETNAME (GxB_PLUS_DIV_INT16) ; + GETNAME (GxB_PLUS_DIV_INT32) ; + GETNAME (GxB_PLUS_DIV_INT64) ; + GETNAME (GxB_PLUS_DIV_UINT8) ; + GETNAME (GxB_PLUS_DIV_UINT16) ; + GETNAME (GxB_PLUS_DIV_UINT32) ; + GETNAME (GxB_PLUS_DIV_UINT64) ; + GETNAME (GxB_PLUS_DIV_FP32) ; + GETNAME (GxB_PLUS_DIV_FP64) ; + GETNAME (GxB_PLUS_DIV_FC32) ; + GETNAME (GxB_PLUS_DIV_FC64) ; + + GETNAME (GxB_TIMES_DIV_INT8) ; + GETNAME (GxB_TIMES_DIV_INT16) ; + GETNAME (GxB_TIMES_DIV_INT32) ; + GETNAME (GxB_TIMES_DIV_INT64) ; + GETNAME (GxB_TIMES_DIV_UINT8) ; + GETNAME (GxB_TIMES_DIV_UINT16) ; + GETNAME (GxB_TIMES_DIV_UINT32) ; + GETNAME (GxB_TIMES_DIV_UINT64) ; + GETNAME (GxB_TIMES_DIV_FP32) ; + GETNAME (GxB_TIMES_DIV_FP64) ; + GETNAME (GxB_TIMES_DIV_FC32) ; + GETNAME (GxB_TIMES_DIV_FC64) ; + + GETNAME (GxB_ANY_DIV_INT8) ; + GETNAME (GxB_ANY_DIV_INT16) ; + GETNAME (GxB_ANY_DIV_INT32) ; + GETNAME (GxB_ANY_DIV_INT64) ; + GETNAME (GxB_ANY_DIV_UINT8) ; + GETNAME (GxB_ANY_DIV_UINT16) ; + GETNAME (GxB_ANY_DIV_UINT32) ; + GETNAME (GxB_ANY_DIV_UINT64) ; + GETNAME (GxB_ANY_DIV_FP32) ; + GETNAME (GxB_ANY_DIV_FP64) ; + GETNAME (GxB_ANY_DIV_FC32) ; + GETNAME (GxB_ANY_DIV_FC64) ; + + //-------------------------------------------------------------------------- + // *_RDIV + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_RDIV_INT8) ; + GETNAME (GxB_MIN_RDIV_INT16) ; + GETNAME (GxB_MIN_RDIV_INT32) ; + GETNAME (GxB_MIN_RDIV_INT64) ; + GETNAME (GxB_MIN_RDIV_UINT8) ; + GETNAME (GxB_MIN_RDIV_UINT16) ; + GETNAME (GxB_MIN_RDIV_UINT32) ; + GETNAME (GxB_MIN_RDIV_UINT64) ; + GETNAME (GxB_MIN_RDIV_FP32) ; + GETNAME (GxB_MIN_RDIV_FP64) ; + + GETNAME (GxB_MAX_RDIV_INT8) ; + GETNAME (GxB_MAX_RDIV_INT16) ; + GETNAME (GxB_MAX_RDIV_INT32) ; + GETNAME (GxB_MAX_RDIV_INT64) ; + GETNAME (GxB_MAX_RDIV_UINT8) ; + GETNAME (GxB_MAX_RDIV_UINT16) ; + GETNAME (GxB_MAX_RDIV_UINT32) ; + GETNAME (GxB_MAX_RDIV_UINT64) ; + GETNAME (GxB_MAX_RDIV_FP32) ; + GETNAME (GxB_MAX_RDIV_FP64) ; + + GETNAME (GxB_PLUS_RDIV_INT8) ; + GETNAME (GxB_PLUS_RDIV_INT16) ; + GETNAME (GxB_PLUS_RDIV_INT32) ; + GETNAME (GxB_PLUS_RDIV_INT64) ; + GETNAME (GxB_PLUS_RDIV_UINT8) ; + GETNAME (GxB_PLUS_RDIV_UINT16) ; + GETNAME (GxB_PLUS_RDIV_UINT32) ; + GETNAME (GxB_PLUS_RDIV_UINT64) ; + GETNAME (GxB_PLUS_RDIV_FP32) ; + GETNAME (GxB_PLUS_RDIV_FP64) ; + GETNAME (GxB_PLUS_RDIV_FC32) ; + GETNAME (GxB_PLUS_RDIV_FC64) ; + + GETNAME (GxB_TIMES_RDIV_INT8) ; + GETNAME (GxB_TIMES_RDIV_INT16) ; + GETNAME (GxB_TIMES_RDIV_INT32) ; + GETNAME (GxB_TIMES_RDIV_INT64) ; + GETNAME (GxB_TIMES_RDIV_UINT8) ; + GETNAME (GxB_TIMES_RDIV_UINT16) ; + GETNAME (GxB_TIMES_RDIV_UINT32) ; + GETNAME (GxB_TIMES_RDIV_UINT64) ; + GETNAME (GxB_TIMES_RDIV_FP32) ; + GETNAME (GxB_TIMES_RDIV_FP64) ; + GETNAME (GxB_TIMES_RDIV_FC32) ; + GETNAME (GxB_TIMES_RDIV_FC64) ; + + GETNAME (GxB_ANY_RDIV_INT8) ; + GETNAME (GxB_ANY_RDIV_INT16) ; + GETNAME (GxB_ANY_RDIV_INT32) ; + GETNAME (GxB_ANY_RDIV_INT64) ; + GETNAME (GxB_ANY_RDIV_UINT8) ; + GETNAME (GxB_ANY_RDIV_UINT16) ; + GETNAME (GxB_ANY_RDIV_UINT32) ; + GETNAME (GxB_ANY_RDIV_UINT64) ; + GETNAME (GxB_ANY_RDIV_FP32) ; + GETNAME (GxB_ANY_RDIV_FP64) ; + GETNAME (GxB_ANY_RDIV_FC32) ; + GETNAME (GxB_ANY_RDIV_FC64) ; + + //-------------------------------------------------------------------------- + // *_RMINUS + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_RMINUS_INT8) ; + GETNAME (GxB_MIN_RMINUS_INT16) ; + GETNAME (GxB_MIN_RMINUS_INT32) ; + GETNAME (GxB_MIN_RMINUS_INT64) ; + GETNAME (GxB_MIN_RMINUS_UINT8) ; + GETNAME (GxB_MIN_RMINUS_UINT16) ; + GETNAME (GxB_MIN_RMINUS_UINT32) ; + GETNAME (GxB_MIN_RMINUS_UINT64) ; + GETNAME (GxB_MIN_RMINUS_FP32) ; + GETNAME (GxB_MIN_RMINUS_FP64) ; + + GETNAME (GxB_MAX_RMINUS_INT8) ; + GETNAME (GxB_MAX_RMINUS_INT16) ; + GETNAME (GxB_MAX_RMINUS_INT32) ; + GETNAME (GxB_MAX_RMINUS_INT64) ; + GETNAME (GxB_MAX_RMINUS_UINT8) ; + GETNAME (GxB_MAX_RMINUS_UINT16) ; + GETNAME (GxB_MAX_RMINUS_UINT32) ; + GETNAME (GxB_MAX_RMINUS_UINT64) ; + GETNAME (GxB_MAX_RMINUS_FP32) ; + GETNAME (GxB_MAX_RMINUS_FP64) ; + + GETNAME (GxB_PLUS_RMINUS_INT8) ; + GETNAME (GxB_PLUS_RMINUS_INT16) ; + GETNAME (GxB_PLUS_RMINUS_INT32) ; + GETNAME (GxB_PLUS_RMINUS_INT64) ; + GETNAME (GxB_PLUS_RMINUS_UINT8) ; + GETNAME (GxB_PLUS_RMINUS_UINT16) ; + GETNAME (GxB_PLUS_RMINUS_UINT32) ; + GETNAME (GxB_PLUS_RMINUS_UINT64) ; + GETNAME (GxB_PLUS_RMINUS_FP32) ; + GETNAME (GxB_PLUS_RMINUS_FP64) ; + GETNAME (GxB_PLUS_RMINUS_FC32) ; + GETNAME (GxB_PLUS_RMINUS_FC64) ; + + GETNAME (GxB_TIMES_RMINUS_INT8) ; + GETNAME (GxB_TIMES_RMINUS_INT16) ; + GETNAME (GxB_TIMES_RMINUS_INT32) ; + GETNAME (GxB_TIMES_RMINUS_INT64) ; + GETNAME (GxB_TIMES_RMINUS_UINT8) ; + GETNAME (GxB_TIMES_RMINUS_UINT16) ; + GETNAME (GxB_TIMES_RMINUS_UINT32) ; + GETNAME (GxB_TIMES_RMINUS_UINT64) ; + GETNAME (GxB_TIMES_RMINUS_FP32) ; + GETNAME (GxB_TIMES_RMINUS_FP64) ; + GETNAME (GxB_TIMES_RMINUS_FC32) ; + GETNAME (GxB_TIMES_RMINUS_FC64) ; + + GETNAME (GxB_ANY_RMINUS_INT8) ; + GETNAME (GxB_ANY_RMINUS_INT16) ; + GETNAME (GxB_ANY_RMINUS_INT32) ; + GETNAME (GxB_ANY_RMINUS_INT64) ; + GETNAME (GxB_ANY_RMINUS_UINT8) ; + GETNAME (GxB_ANY_RMINUS_UINT16) ; + GETNAME (GxB_ANY_RMINUS_UINT32) ; + GETNAME (GxB_ANY_RMINUS_UINT64) ; + GETNAME (GxB_ANY_RMINUS_FP32) ; + GETNAME (GxB_ANY_RMINUS_FP64) ; + GETNAME (GxB_ANY_RMINUS_FC32) ; + GETNAME (GxB_ANY_RMINUS_FC64) ; + + //-------------------------------------------------------------------------- + // *_ISEQ + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_ISEQ_INT8) ; + GETNAME (GxB_MIN_ISEQ_INT16) ; + GETNAME (GxB_MIN_ISEQ_INT32) ; + GETNAME (GxB_MIN_ISEQ_INT64) ; + GETNAME (GxB_MIN_ISEQ_UINT8) ; + GETNAME (GxB_MIN_ISEQ_UINT16) ; + GETNAME (GxB_MIN_ISEQ_UINT32) ; + GETNAME (GxB_MIN_ISEQ_UINT64) ; + GETNAME (GxB_MIN_ISEQ_FP32) ; + GETNAME (GxB_MIN_ISEQ_FP64) ; + + GETNAME (GxB_MAX_ISEQ_INT8) ; + GETNAME (GxB_MAX_ISEQ_INT16) ; + GETNAME (GxB_MAX_ISEQ_INT32) ; + GETNAME (GxB_MAX_ISEQ_INT64) ; + GETNAME (GxB_MAX_ISEQ_UINT8) ; + GETNAME (GxB_MAX_ISEQ_UINT16) ; + GETNAME (GxB_MAX_ISEQ_UINT32) ; + GETNAME (GxB_MAX_ISEQ_UINT64) ; + GETNAME (GxB_MAX_ISEQ_FP32) ; + GETNAME (GxB_MAX_ISEQ_FP64) ; + + GETNAME (GxB_PLUS_ISEQ_INT8) ; + GETNAME (GxB_PLUS_ISEQ_INT16) ; + GETNAME (GxB_PLUS_ISEQ_INT32) ; + GETNAME (GxB_PLUS_ISEQ_INT64) ; + GETNAME (GxB_PLUS_ISEQ_UINT8) ; + GETNAME (GxB_PLUS_ISEQ_UINT16) ; + GETNAME (GxB_PLUS_ISEQ_UINT32) ; + GETNAME (GxB_PLUS_ISEQ_UINT64) ; + GETNAME (GxB_PLUS_ISEQ_FP32) ; + GETNAME (GxB_PLUS_ISEQ_FP64) ; + + GETNAME (GxB_TIMES_ISEQ_INT8) ; + GETNAME (GxB_TIMES_ISEQ_INT16) ; + GETNAME (GxB_TIMES_ISEQ_INT32) ; + GETNAME (GxB_TIMES_ISEQ_INT64) ; + GETNAME (GxB_TIMES_ISEQ_UINT8) ; + GETNAME (GxB_TIMES_ISEQ_UINT16) ; + GETNAME (GxB_TIMES_ISEQ_UINT32) ; + GETNAME (GxB_TIMES_ISEQ_UINT64) ; + GETNAME (GxB_TIMES_ISEQ_FP32) ; + GETNAME (GxB_TIMES_ISEQ_FP64) ; + + GETNAME (GxB_ANY_ISEQ_INT8) ; + GETNAME (GxB_ANY_ISEQ_INT16) ; + GETNAME (GxB_ANY_ISEQ_INT32) ; + GETNAME (GxB_ANY_ISEQ_INT64) ; + GETNAME (GxB_ANY_ISEQ_UINT8) ; + GETNAME (GxB_ANY_ISEQ_UINT16) ; + GETNAME (GxB_ANY_ISEQ_UINT32) ; + GETNAME (GxB_ANY_ISEQ_UINT64) ; + GETNAME (GxB_ANY_ISEQ_FP32) ; + GETNAME (GxB_ANY_ISEQ_FP64) ; + + //-------------------------------------------------------------------------- + // *_ISNE + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_ISNE_INT8) ; + GETNAME (GxB_MIN_ISNE_INT16) ; + GETNAME (GxB_MIN_ISNE_INT32) ; + GETNAME (GxB_MIN_ISNE_INT64) ; + GETNAME (GxB_MIN_ISNE_UINT8) ; + GETNAME (GxB_MIN_ISNE_UINT16) ; + GETNAME (GxB_MIN_ISNE_UINT32) ; + GETNAME (GxB_MIN_ISNE_UINT64) ; + GETNAME (GxB_MIN_ISNE_FP32) ; + GETNAME (GxB_MIN_ISNE_FP64) ; + + GETNAME (GxB_MAX_ISNE_INT8) ; + GETNAME (GxB_MAX_ISNE_INT16) ; + GETNAME (GxB_MAX_ISNE_INT32) ; + GETNAME (GxB_MAX_ISNE_INT64) ; + GETNAME (GxB_MAX_ISNE_UINT8) ; + GETNAME (GxB_MAX_ISNE_UINT16) ; + GETNAME (GxB_MAX_ISNE_UINT32) ; + GETNAME (GxB_MAX_ISNE_UINT64) ; + GETNAME (GxB_MAX_ISNE_FP32) ; + GETNAME (GxB_MAX_ISNE_FP64) ; + + GETNAME (GxB_PLUS_ISNE_INT8) ; + GETNAME (GxB_PLUS_ISNE_INT16) ; + GETNAME (GxB_PLUS_ISNE_INT32) ; + GETNAME (GxB_PLUS_ISNE_INT64) ; + GETNAME (GxB_PLUS_ISNE_UINT8) ; + GETNAME (GxB_PLUS_ISNE_UINT16) ; + GETNAME (GxB_PLUS_ISNE_UINT32) ; + GETNAME (GxB_PLUS_ISNE_UINT64) ; + GETNAME (GxB_PLUS_ISNE_FP32) ; + GETNAME (GxB_PLUS_ISNE_FP64) ; + + GETNAME (GxB_TIMES_ISNE_INT8) ; + GETNAME (GxB_TIMES_ISNE_INT16) ; + GETNAME (GxB_TIMES_ISNE_INT32) ; + GETNAME (GxB_TIMES_ISNE_INT64) ; + GETNAME (GxB_TIMES_ISNE_UINT8) ; + GETNAME (GxB_TIMES_ISNE_UINT16) ; + GETNAME (GxB_TIMES_ISNE_UINT32) ; + GETNAME (GxB_TIMES_ISNE_UINT64) ; + GETNAME (GxB_TIMES_ISNE_FP32) ; + GETNAME (GxB_TIMES_ISNE_FP64) ; + + GETNAME (GxB_ANY_ISNE_INT8) ; + GETNAME (GxB_ANY_ISNE_INT16) ; + GETNAME (GxB_ANY_ISNE_INT32) ; + GETNAME (GxB_ANY_ISNE_INT64) ; + GETNAME (GxB_ANY_ISNE_UINT8) ; + GETNAME (GxB_ANY_ISNE_UINT16) ; + GETNAME (GxB_ANY_ISNE_UINT32) ; + GETNAME (GxB_ANY_ISNE_UINT64) ; + GETNAME (GxB_ANY_ISNE_FP32) ; + GETNAME (GxB_ANY_ISNE_FP64) ; + + //-------------------------------------------------------------------------- + // *_ISGT + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_ISGT_INT8) ; + GETNAME (GxB_MIN_ISGT_INT16) ; + GETNAME (GxB_MIN_ISGT_INT32) ; + GETNAME (GxB_MIN_ISGT_INT64) ; + GETNAME (GxB_MIN_ISGT_UINT8) ; + GETNAME (GxB_MIN_ISGT_UINT16) ; + GETNAME (GxB_MIN_ISGT_UINT32) ; + GETNAME (GxB_MIN_ISGT_UINT64) ; + GETNAME (GxB_MIN_ISGT_FP32) ; + GETNAME (GxB_MIN_ISGT_FP64) ; + + GETNAME (GxB_MAX_ISGT_INT8) ; + GETNAME (GxB_MAX_ISGT_INT16) ; + GETNAME (GxB_MAX_ISGT_INT32) ; + GETNAME (GxB_MAX_ISGT_INT64) ; + GETNAME (GxB_MAX_ISGT_UINT8) ; + GETNAME (GxB_MAX_ISGT_UINT16) ; + GETNAME (GxB_MAX_ISGT_UINT32) ; + GETNAME (GxB_MAX_ISGT_UINT64) ; + GETNAME (GxB_MAX_ISGT_FP32) ; + GETNAME (GxB_MAX_ISGT_FP64) ; + + GETNAME (GxB_PLUS_ISGT_INT8) ; + GETNAME (GxB_PLUS_ISGT_INT16) ; + GETNAME (GxB_PLUS_ISGT_INT32) ; + GETNAME (GxB_PLUS_ISGT_INT64) ; + GETNAME (GxB_PLUS_ISGT_UINT8) ; + GETNAME (GxB_PLUS_ISGT_UINT16) ; + GETNAME (GxB_PLUS_ISGT_UINT32) ; + GETNAME (GxB_PLUS_ISGT_UINT64) ; + GETNAME (GxB_PLUS_ISGT_FP32) ; + GETNAME (GxB_PLUS_ISGT_FP64) ; + + GETNAME (GxB_TIMES_ISGT_INT8) ; + GETNAME (GxB_TIMES_ISGT_INT16) ; + GETNAME (GxB_TIMES_ISGT_INT32) ; + GETNAME (GxB_TIMES_ISGT_INT64) ; + GETNAME (GxB_TIMES_ISGT_UINT8) ; + GETNAME (GxB_TIMES_ISGT_UINT16) ; + GETNAME (GxB_TIMES_ISGT_UINT32) ; + GETNAME (GxB_TIMES_ISGT_UINT64) ; + GETNAME (GxB_TIMES_ISGT_FP32) ; + GETNAME (GxB_TIMES_ISGT_FP64) ; + + GETNAME (GxB_ANY_ISGT_INT8) ; + GETNAME (GxB_ANY_ISGT_INT16) ; + GETNAME (GxB_ANY_ISGT_INT32) ; + GETNAME (GxB_ANY_ISGT_INT64) ; + GETNAME (GxB_ANY_ISGT_UINT8) ; + GETNAME (GxB_ANY_ISGT_UINT16) ; + GETNAME (GxB_ANY_ISGT_UINT32) ; + GETNAME (GxB_ANY_ISGT_UINT64) ; + GETNAME (GxB_ANY_ISGT_FP32) ; + GETNAME (GxB_ANY_ISGT_FP64) ; + + //-------------------------------------------------------------------------- + // *_ISLT + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_ISLT_INT8) ; + GETNAME (GxB_MIN_ISLT_INT16) ; + GETNAME (GxB_MIN_ISLT_INT32) ; + GETNAME (GxB_MIN_ISLT_INT64) ; + GETNAME (GxB_MIN_ISLT_UINT8) ; + GETNAME (GxB_MIN_ISLT_UINT16) ; + GETNAME (GxB_MIN_ISLT_UINT32) ; + GETNAME (GxB_MIN_ISLT_UINT64) ; + GETNAME (GxB_MIN_ISLT_FP32) ; + GETNAME (GxB_MIN_ISLT_FP64) ; + + GETNAME (GxB_MAX_ISLT_INT8) ; + GETNAME (GxB_MAX_ISLT_INT16) ; + GETNAME (GxB_MAX_ISLT_INT32) ; + GETNAME (GxB_MAX_ISLT_INT64) ; + GETNAME (GxB_MAX_ISLT_UINT8) ; + GETNAME (GxB_MAX_ISLT_UINT16) ; + GETNAME (GxB_MAX_ISLT_UINT32) ; + GETNAME (GxB_MAX_ISLT_UINT64) ; + GETNAME (GxB_MAX_ISLT_FP32) ; + GETNAME (GxB_MAX_ISLT_FP64) ; + + GETNAME (GxB_PLUS_ISLT_INT8) ; + GETNAME (GxB_PLUS_ISLT_INT16) ; + GETNAME (GxB_PLUS_ISLT_INT32) ; + GETNAME (GxB_PLUS_ISLT_INT64) ; + GETNAME (GxB_PLUS_ISLT_UINT8) ; + GETNAME (GxB_PLUS_ISLT_UINT16) ; + GETNAME (GxB_PLUS_ISLT_UINT32) ; + GETNAME (GxB_PLUS_ISLT_UINT64) ; + GETNAME (GxB_PLUS_ISLT_FP32) ; + GETNAME (GxB_PLUS_ISLT_FP64) ; + + GETNAME (GxB_TIMES_ISLT_INT8) ; + GETNAME (GxB_TIMES_ISLT_INT16) ; + GETNAME (GxB_TIMES_ISLT_INT32) ; + GETNAME (GxB_TIMES_ISLT_INT64) ; + GETNAME (GxB_TIMES_ISLT_UINT8) ; + GETNAME (GxB_TIMES_ISLT_UINT16) ; + GETNAME (GxB_TIMES_ISLT_UINT32) ; + GETNAME (GxB_TIMES_ISLT_UINT64) ; + GETNAME (GxB_TIMES_ISLT_FP32) ; + GETNAME (GxB_TIMES_ISLT_FP64) ; + + GETNAME (GxB_ANY_ISLT_INT8) ; + GETNAME (GxB_ANY_ISLT_INT16) ; + GETNAME (GxB_ANY_ISLT_INT32) ; + GETNAME (GxB_ANY_ISLT_INT64) ; + GETNAME (GxB_ANY_ISLT_UINT8) ; + GETNAME (GxB_ANY_ISLT_UINT16) ; + GETNAME (GxB_ANY_ISLT_UINT32) ; + GETNAME (GxB_ANY_ISLT_UINT64) ; + GETNAME (GxB_ANY_ISLT_FP32) ; + GETNAME (GxB_ANY_ISLT_FP64) ; + + //-------------------------------------------------------------------------- + // *_ISGE + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_ISGE_INT8) ; + GETNAME (GxB_MIN_ISGE_INT16) ; + GETNAME (GxB_MIN_ISGE_INT32) ; + GETNAME (GxB_MIN_ISGE_INT64) ; + GETNAME (GxB_MIN_ISGE_UINT8) ; + GETNAME (GxB_MIN_ISGE_UINT16) ; + GETNAME (GxB_MIN_ISGE_UINT32) ; + GETNAME (GxB_MIN_ISGE_UINT64) ; + GETNAME (GxB_MIN_ISGE_FP32) ; + GETNAME (GxB_MIN_ISGE_FP64) ; + + GETNAME (GxB_MAX_ISGE_INT8) ; + GETNAME (GxB_MAX_ISGE_INT16) ; + GETNAME (GxB_MAX_ISGE_INT32) ; + GETNAME (GxB_MAX_ISGE_INT64) ; + GETNAME (GxB_MAX_ISGE_UINT8) ; + GETNAME (GxB_MAX_ISGE_UINT16) ; + GETNAME (GxB_MAX_ISGE_UINT32) ; + GETNAME (GxB_MAX_ISGE_UINT64) ; + GETNAME (GxB_MAX_ISGE_FP32) ; + GETNAME (GxB_MAX_ISGE_FP64) ; + + GETNAME (GxB_PLUS_ISGE_INT8) ; + GETNAME (GxB_PLUS_ISGE_INT16) ; + GETNAME (GxB_PLUS_ISGE_INT32) ; + GETNAME (GxB_PLUS_ISGE_INT64) ; + GETNAME (GxB_PLUS_ISGE_UINT8) ; + GETNAME (GxB_PLUS_ISGE_UINT16) ; + GETNAME (GxB_PLUS_ISGE_UINT32) ; + GETNAME (GxB_PLUS_ISGE_UINT64) ; + GETNAME (GxB_PLUS_ISGE_FP32) ; + GETNAME (GxB_PLUS_ISGE_FP64) ; + + GETNAME (GxB_TIMES_ISGE_INT8) ; + GETNAME (GxB_TIMES_ISGE_INT16) ; + GETNAME (GxB_TIMES_ISGE_INT32) ; + GETNAME (GxB_TIMES_ISGE_INT64) ; + GETNAME (GxB_TIMES_ISGE_UINT8) ; + GETNAME (GxB_TIMES_ISGE_UINT16) ; + GETNAME (GxB_TIMES_ISGE_UINT32) ; + GETNAME (GxB_TIMES_ISGE_UINT64) ; + GETNAME (GxB_TIMES_ISGE_FP32) ; + GETNAME (GxB_TIMES_ISGE_FP64) ; + + GETNAME (GxB_ANY_ISGE_INT8) ; + GETNAME (GxB_ANY_ISGE_INT16) ; + GETNAME (GxB_ANY_ISGE_INT32) ; + GETNAME (GxB_ANY_ISGE_INT64) ; + GETNAME (GxB_ANY_ISGE_UINT8) ; + GETNAME (GxB_ANY_ISGE_UINT16) ; + GETNAME (GxB_ANY_ISGE_UINT32) ; + GETNAME (GxB_ANY_ISGE_UINT64) ; + GETNAME (GxB_ANY_ISGE_FP32) ; + GETNAME (GxB_ANY_ISGE_FP64) ; + + //-------------------------------------------------------------------------- + // *_ISLE + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_ISLE_INT8) ; + GETNAME (GxB_MIN_ISLE_INT16) ; + GETNAME (GxB_MIN_ISLE_INT32) ; + GETNAME (GxB_MIN_ISLE_INT64) ; + GETNAME (GxB_MIN_ISLE_UINT8) ; + GETNAME (GxB_MIN_ISLE_UINT16) ; + GETNAME (GxB_MIN_ISLE_UINT32) ; + GETNAME (GxB_MIN_ISLE_UINT64) ; + GETNAME (GxB_MIN_ISLE_FP32) ; + GETNAME (GxB_MIN_ISLE_FP64) ; + + GETNAME (GxB_MAX_ISLE_INT8) ; + GETNAME (GxB_MAX_ISLE_INT16) ; + GETNAME (GxB_MAX_ISLE_INT32) ; + GETNAME (GxB_MAX_ISLE_INT64) ; + GETNAME (GxB_MAX_ISLE_UINT8) ; + GETNAME (GxB_MAX_ISLE_UINT16) ; + GETNAME (GxB_MAX_ISLE_UINT32) ; + GETNAME (GxB_MAX_ISLE_UINT64) ; + GETNAME (GxB_MAX_ISLE_FP32) ; + GETNAME (GxB_MAX_ISLE_FP64) ; + + GETNAME (GxB_PLUS_ISLE_INT8) ; + GETNAME (GxB_PLUS_ISLE_INT16) ; + GETNAME (GxB_PLUS_ISLE_INT32) ; + GETNAME (GxB_PLUS_ISLE_INT64) ; + GETNAME (GxB_PLUS_ISLE_UINT8) ; + GETNAME (GxB_PLUS_ISLE_UINT16) ; + GETNAME (GxB_PLUS_ISLE_UINT32) ; + GETNAME (GxB_PLUS_ISLE_UINT64) ; + GETNAME (GxB_PLUS_ISLE_FP32) ; + GETNAME (GxB_PLUS_ISLE_FP64) ; + + GETNAME (GxB_TIMES_ISLE_INT8) ; + GETNAME (GxB_TIMES_ISLE_INT16) ; + GETNAME (GxB_TIMES_ISLE_INT32) ; + GETNAME (GxB_TIMES_ISLE_INT64) ; + GETNAME (GxB_TIMES_ISLE_UINT8) ; + GETNAME (GxB_TIMES_ISLE_UINT16) ; + GETNAME (GxB_TIMES_ISLE_UINT32) ; + GETNAME (GxB_TIMES_ISLE_UINT64) ; + GETNAME (GxB_TIMES_ISLE_FP32) ; + GETNAME (GxB_TIMES_ISLE_FP64) ; + + GETNAME (GxB_ANY_ISLE_INT8) ; + GETNAME (GxB_ANY_ISLE_INT16) ; + GETNAME (GxB_ANY_ISLE_INT32) ; + GETNAME (GxB_ANY_ISLE_INT64) ; + GETNAME (GxB_ANY_ISLE_UINT8) ; + GETNAME (GxB_ANY_ISLE_UINT16) ; + GETNAME (GxB_ANY_ISLE_UINT32) ; + GETNAME (GxB_ANY_ISLE_UINT64) ; + GETNAME (GxB_ANY_ISLE_FP32) ; + GETNAME (GxB_ANY_ISLE_FP64) ; + + //-------------------------------------------------------------------------- + // *_LOR + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_LOR_INT8) ; + GETNAME (GxB_MIN_LOR_INT16) ; + GETNAME (GxB_MIN_LOR_INT32) ; + GETNAME (GxB_MIN_LOR_INT64) ; + GETNAME (GxB_MIN_LOR_UINT8) ; + GETNAME (GxB_MIN_LOR_UINT16) ; + GETNAME (GxB_MIN_LOR_UINT32) ; + GETNAME (GxB_MIN_LOR_UINT64) ; + GETNAME (GxB_MIN_LOR_FP32) ; + GETNAME (GxB_MIN_LOR_FP64) ; + + GETNAME (GxB_MAX_LOR_INT8) ; + GETNAME (GxB_MAX_LOR_INT16) ; + GETNAME (GxB_MAX_LOR_INT32) ; + GETNAME (GxB_MAX_LOR_INT64) ; + GETNAME (GxB_MAX_LOR_UINT8) ; + GETNAME (GxB_MAX_LOR_UINT16) ; + GETNAME (GxB_MAX_LOR_UINT32) ; + GETNAME (GxB_MAX_LOR_UINT64) ; + GETNAME (GxB_MAX_LOR_FP32) ; + GETNAME (GxB_MAX_LOR_FP64) ; + + GETNAME (GxB_PLUS_LOR_INT8) ; + GETNAME (GxB_PLUS_LOR_INT16) ; + GETNAME (GxB_PLUS_LOR_INT32) ; + GETNAME (GxB_PLUS_LOR_INT64) ; + GETNAME (GxB_PLUS_LOR_UINT8) ; + GETNAME (GxB_PLUS_LOR_UINT16) ; + GETNAME (GxB_PLUS_LOR_UINT32) ; + GETNAME (GxB_PLUS_LOR_UINT64) ; + GETNAME (GxB_PLUS_LOR_FP32) ; + GETNAME (GxB_PLUS_LOR_FP64) ; + + GETNAME (GxB_TIMES_LOR_INT8) ; + GETNAME (GxB_TIMES_LOR_INT16) ; + GETNAME (GxB_TIMES_LOR_INT32) ; + GETNAME (GxB_TIMES_LOR_INT64) ; + GETNAME (GxB_TIMES_LOR_UINT8) ; + GETNAME (GxB_TIMES_LOR_UINT16) ; + GETNAME (GxB_TIMES_LOR_UINT32) ; + GETNAME (GxB_TIMES_LOR_UINT64) ; + GETNAME (GxB_TIMES_LOR_FP32) ; + GETNAME (GxB_TIMES_LOR_FP64) ; + + GETNAME (GxB_ANY_LOR_INT8) ; + GETNAME (GxB_ANY_LOR_INT16) ; + GETNAME (GxB_ANY_LOR_INT32) ; + GETNAME (GxB_ANY_LOR_INT64) ; + GETNAME (GxB_ANY_LOR_UINT8) ; + GETNAME (GxB_ANY_LOR_UINT16) ; + GETNAME (GxB_ANY_LOR_UINT32) ; + GETNAME (GxB_ANY_LOR_UINT64) ; + GETNAME (GxB_ANY_LOR_FP32) ; + GETNAME (GxB_ANY_LOR_FP64) ; + + GETNAME (GxB_LOR_LOR_BOOL) ; + GETNAME (GxB_LXOR_LOR_BOOL) ; + GETNAME (GxB_ANY_LOR_BOOL) ; + + GETNAM2 (GxB_LAND_LOR_BOOL, "GrB_LAND_LOR_SEMIRING_BOOL") ; + GETNAME (GrB_LAND_LOR_SEMIRING_BOOL) ; + + GETNAM2 (GxB_EQ_LOR_BOOL, "GrB_LXNOR_LOR_SEMIRING_BOOL") ; + GETNAME (GrB_LXNOR_LOR_SEMIRING_BOOL) ; + + //-------------------------------------------------------------------------- + // *_LAND + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_LAND_INT8) ; + GETNAME (GxB_MIN_LAND_INT16) ; + GETNAME (GxB_MIN_LAND_INT32) ; + GETNAME (GxB_MIN_LAND_INT64) ; + GETNAME (GxB_MIN_LAND_UINT8) ; + GETNAME (GxB_MIN_LAND_UINT16) ; + GETNAME (GxB_MIN_LAND_UINT32) ; + GETNAME (GxB_MIN_LAND_UINT64) ; + GETNAME (GxB_MIN_LAND_FP32) ; + GETNAME (GxB_MIN_LAND_FP64) ; + + GETNAME (GxB_MAX_LAND_INT8) ; + GETNAME (GxB_MAX_LAND_INT16) ; + GETNAME (GxB_MAX_LAND_INT32) ; + GETNAME (GxB_MAX_LAND_INT64) ; + GETNAME (GxB_MAX_LAND_UINT8) ; + GETNAME (GxB_MAX_LAND_UINT16) ; + GETNAME (GxB_MAX_LAND_UINT32) ; + GETNAME (GxB_MAX_LAND_UINT64) ; + GETNAME (GxB_MAX_LAND_FP32) ; + GETNAME (GxB_MAX_LAND_FP64) ; + + GETNAME (GxB_PLUS_LAND_INT8) ; + GETNAME (GxB_PLUS_LAND_INT16) ; + GETNAME (GxB_PLUS_LAND_INT32) ; + GETNAME (GxB_PLUS_LAND_INT64) ; + GETNAME (GxB_PLUS_LAND_UINT8) ; + GETNAME (GxB_PLUS_LAND_UINT16) ; + GETNAME (GxB_PLUS_LAND_UINT32) ; + GETNAME (GxB_PLUS_LAND_UINT64) ; + GETNAME (GxB_PLUS_LAND_FP32) ; + GETNAME (GxB_PLUS_LAND_FP64) ; + + GETNAME (GxB_TIMES_LAND_INT8) ; + GETNAME (GxB_TIMES_LAND_INT16) ; + GETNAME (GxB_TIMES_LAND_INT32) ; + GETNAME (GxB_TIMES_LAND_INT64) ; + GETNAME (GxB_TIMES_LAND_UINT8) ; + GETNAME (GxB_TIMES_LAND_UINT16) ; + GETNAME (GxB_TIMES_LAND_UINT32) ; + GETNAME (GxB_TIMES_LAND_UINT64) ; + GETNAME (GxB_TIMES_LAND_FP32) ; + GETNAME (GxB_TIMES_LAND_FP64) ; + + GETNAME (GxB_ANY_LAND_INT8) ; + GETNAME (GxB_ANY_LAND_INT16) ; + GETNAME (GxB_ANY_LAND_INT32) ; + GETNAME (GxB_ANY_LAND_INT64) ; + GETNAME (GxB_ANY_LAND_UINT8) ; + GETNAME (GxB_ANY_LAND_UINT16) ; + GETNAME (GxB_ANY_LAND_UINT32) ; + GETNAME (GxB_ANY_LAND_UINT64) ; + GETNAME (GxB_ANY_LAND_FP32) ; + GETNAME (GxB_ANY_LAND_FP64) ; + + GETNAME (GxB_LAND_LAND_BOOL) ; + GETNAME (GxB_ANY_LAND_BOOL) ; + GETNAME (GxB_EQ_LAND_BOOL) ; + + GETNAM2 (GxB_LOR_LAND_BOOL, "GrB_LOR_LAND_SEMIRING_BOOL") ; + GETNAME (GrB_LOR_LAND_SEMIRING_BOOL) ; + + GETNAM2 (GxB_LXOR_LAND_BOOL, "GrB_LXOR_LAND_SEMIRING_BOOL") ; + GETNAME (GrB_LXOR_LAND_SEMIRING_BOOL) ; + + //-------------------------------------------------------------------------- + // *_LXOR + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_LXOR_INT8) ; + GETNAME (GxB_MIN_LXOR_INT16) ; + GETNAME (GxB_MIN_LXOR_INT32) ; + GETNAME (GxB_MIN_LXOR_INT64) ; + GETNAME (GxB_MIN_LXOR_UINT8) ; + GETNAME (GxB_MIN_LXOR_UINT16) ; + GETNAME (GxB_MIN_LXOR_UINT32) ; + GETNAME (GxB_MIN_LXOR_UINT64) ; + GETNAME (GxB_MIN_LXOR_FP32) ; + GETNAME (GxB_MIN_LXOR_FP64) ; + + GETNAME (GxB_MAX_LXOR_INT8) ; + GETNAME (GxB_MAX_LXOR_INT16) ; + GETNAME (GxB_MAX_LXOR_INT32) ; + GETNAME (GxB_MAX_LXOR_INT64) ; + GETNAME (GxB_MAX_LXOR_UINT8) ; + GETNAME (GxB_MAX_LXOR_UINT16) ; + GETNAME (GxB_MAX_LXOR_UINT32) ; + GETNAME (GxB_MAX_LXOR_UINT64) ; + GETNAME (GxB_MAX_LXOR_FP32) ; + GETNAME (GxB_MAX_LXOR_FP64) ; + + GETNAME (GxB_PLUS_LXOR_INT8) ; + GETNAME (GxB_PLUS_LXOR_INT16) ; + GETNAME (GxB_PLUS_LXOR_INT32) ; + GETNAME (GxB_PLUS_LXOR_INT64) ; + GETNAME (GxB_PLUS_LXOR_UINT8) ; + GETNAME (GxB_PLUS_LXOR_UINT16) ; + GETNAME (GxB_PLUS_LXOR_UINT32) ; + GETNAME (GxB_PLUS_LXOR_UINT64) ; + GETNAME (GxB_PLUS_LXOR_FP32) ; + GETNAME (GxB_PLUS_LXOR_FP64) ; + + GETNAME (GxB_TIMES_LXOR_INT8) ; + GETNAME (GxB_TIMES_LXOR_INT16) ; + GETNAME (GxB_TIMES_LXOR_INT32) ; + GETNAME (GxB_TIMES_LXOR_INT64) ; + GETNAME (GxB_TIMES_LXOR_UINT8) ; + GETNAME (GxB_TIMES_LXOR_UINT16) ; + GETNAME (GxB_TIMES_LXOR_UINT32) ; + GETNAME (GxB_TIMES_LXOR_UINT64) ; + GETNAME (GxB_TIMES_LXOR_FP32) ; + GETNAME (GxB_TIMES_LXOR_FP64) ; + + GETNAME (GxB_ANY_LXOR_INT8) ; + GETNAME (GxB_ANY_LXOR_INT16) ; + GETNAME (GxB_ANY_LXOR_INT32) ; + GETNAME (GxB_ANY_LXOR_INT64) ; + GETNAME (GxB_ANY_LXOR_UINT8) ; + GETNAME (GxB_ANY_LXOR_UINT16) ; + GETNAME (GxB_ANY_LXOR_UINT32) ; + GETNAME (GxB_ANY_LXOR_UINT64) ; + GETNAME (GxB_ANY_LXOR_FP32) ; + GETNAME (GxB_ANY_LXOR_FP64) ; + + GETNAME (GxB_LOR_LXOR_BOOL) ; + GETNAME (GxB_LAND_LXOR_BOOL) ; + GETNAME (GxB_LXOR_LXOR_BOOL) ; + GETNAME (GxB_EQ_LXOR_BOOL) ; + GETNAME (GxB_ANY_LXOR_BOOL) ; + + //-------------------------------------------------------------------------- + // *_EQ + //-------------------------------------------------------------------------- + + GETNAME (GxB_LOR_EQ_INT8) ; + GETNAME (GxB_LOR_EQ_INT16) ; + GETNAME (GxB_LOR_EQ_INT32) ; + GETNAME (GxB_LOR_EQ_INT64) ; + GETNAME (GxB_LOR_EQ_UINT8) ; + GETNAME (GxB_LOR_EQ_UINT16) ; + GETNAME (GxB_LOR_EQ_UINT32) ; + GETNAME (GxB_LOR_EQ_UINT64) ; + GETNAME (GxB_LOR_EQ_FP32) ; + GETNAME (GxB_LOR_EQ_FP64) ; + + GETNAME (GxB_LAND_EQ_INT8) ; + GETNAME (GxB_LAND_EQ_INT16) ; + GETNAME (GxB_LAND_EQ_INT32) ; + GETNAME (GxB_LAND_EQ_INT64) ; + GETNAME (GxB_LAND_EQ_UINT8) ; + GETNAME (GxB_LAND_EQ_UINT16) ; + GETNAME (GxB_LAND_EQ_UINT32) ; + GETNAME (GxB_LAND_EQ_UINT64) ; + GETNAME (GxB_LAND_EQ_FP32) ; + GETNAME (GxB_LAND_EQ_FP64) ; + + GETNAME (GxB_LXOR_EQ_INT8) ; + GETNAME (GxB_LXOR_EQ_INT16) ; + GETNAME (GxB_LXOR_EQ_INT32) ; + GETNAME (GxB_LXOR_EQ_INT64) ; + GETNAME (GxB_LXOR_EQ_UINT8) ; + GETNAME (GxB_LXOR_EQ_UINT16) ; + GETNAME (GxB_LXOR_EQ_UINT32) ; + GETNAME (GxB_LXOR_EQ_UINT64) ; + GETNAME (GxB_LXOR_EQ_FP32) ; + GETNAME (GxB_LXOR_EQ_FP64) ; + + GETNAME (GxB_EQ_EQ_INT8) ; + GETNAME (GxB_EQ_EQ_INT16) ; + GETNAME (GxB_EQ_EQ_INT32) ; + GETNAME (GxB_EQ_EQ_INT64) ; + GETNAME (GxB_EQ_EQ_UINT8) ; + GETNAME (GxB_EQ_EQ_UINT16) ; + GETNAME (GxB_EQ_EQ_UINT32) ; + GETNAME (GxB_EQ_EQ_UINT64) ; + GETNAME (GxB_EQ_EQ_FP32) ; + GETNAME (GxB_EQ_EQ_FP64) ; + + GETNAME (GxB_ANY_EQ_INT8) ; + GETNAME (GxB_ANY_EQ_INT16) ; + GETNAME (GxB_ANY_EQ_INT32) ; + GETNAME (GxB_ANY_EQ_INT64) ; + GETNAME (GxB_ANY_EQ_UINT8) ; + GETNAME (GxB_ANY_EQ_UINT16) ; + GETNAME (GxB_ANY_EQ_UINT32) ; + GETNAME (GxB_ANY_EQ_UINT64) ; + GETNAME (GxB_ANY_EQ_FP32) ; + GETNAME (GxB_ANY_EQ_FP64) ; + + GETNAME (GxB_LOR_EQ_BOOL) ; + GETNAME (GxB_LAND_EQ_BOOL) ; + GETNAME (GxB_LXOR_EQ_BOOL) ; + GETNAME (GxB_EQ_EQ_BOOL) ; + GETNAME (GxB_ANY_EQ_BOOL) ; + + //-------------------------------------------------------------------------- + // *_NE + //-------------------------------------------------------------------------- + + GETNAME (GxB_LOR_NE_INT8) ; + GETNAME (GxB_LOR_NE_INT16) ; + GETNAME (GxB_LOR_NE_INT32) ; + GETNAME (GxB_LOR_NE_INT64) ; + GETNAME (GxB_LOR_NE_UINT8) ; + GETNAME (GxB_LOR_NE_UINT16) ; + GETNAME (GxB_LOR_NE_UINT32) ; + GETNAME (GxB_LOR_NE_UINT64) ; + GETNAME (GxB_LOR_NE_FP32) ; + GETNAME (GxB_LOR_NE_FP64) ; + + GETNAME (GxB_LAND_NE_INT8) ; + GETNAME (GxB_LAND_NE_INT16) ; + GETNAME (GxB_LAND_NE_INT32) ; + GETNAME (GxB_LAND_NE_INT64) ; + GETNAME (GxB_LAND_NE_UINT8) ; + GETNAME (GxB_LAND_NE_UINT16) ; + GETNAME (GxB_LAND_NE_UINT32) ; + GETNAME (GxB_LAND_NE_UINT64) ; + GETNAME (GxB_LAND_NE_FP32) ; + GETNAME (GxB_LAND_NE_FP64) ; + + GETNAME (GxB_LXOR_NE_INT8) ; + GETNAME (GxB_LXOR_NE_INT16) ; + GETNAME (GxB_LXOR_NE_INT32) ; + GETNAME (GxB_LXOR_NE_INT64) ; + GETNAME (GxB_LXOR_NE_UINT8) ; + GETNAME (GxB_LXOR_NE_UINT16) ; + GETNAME (GxB_LXOR_NE_UINT32) ; + GETNAME (GxB_LXOR_NE_UINT64) ; + GETNAME (GxB_LXOR_NE_FP32) ; + GETNAME (GxB_LXOR_NE_FP64) ; + + GETNAME (GxB_EQ_NE_INT8) ; + GETNAME (GxB_EQ_NE_INT16) ; + GETNAME (GxB_EQ_NE_INT32) ; + GETNAME (GxB_EQ_NE_INT64) ; + GETNAME (GxB_EQ_NE_UINT8) ; + GETNAME (GxB_EQ_NE_UINT16) ; + GETNAME (GxB_EQ_NE_UINT32) ; + GETNAME (GxB_EQ_NE_UINT64) ; + GETNAME (GxB_EQ_NE_FP32) ; + GETNAME (GxB_EQ_NE_FP64) ; + + GETNAME (GxB_ANY_NE_INT8) ; + GETNAME (GxB_ANY_NE_INT16) ; + GETNAME (GxB_ANY_NE_INT32) ; + GETNAME (GxB_ANY_NE_INT64) ; + GETNAME (GxB_ANY_NE_UINT8) ; + GETNAME (GxB_ANY_NE_UINT16) ; + GETNAME (GxB_ANY_NE_UINT32) ; + GETNAME (GxB_ANY_NE_UINT64) ; + GETNAME (GxB_ANY_NE_FP32) ; + GETNAME (GxB_ANY_NE_FP64) ; + + //-------------------------------------------------------------------------- + // *_GT + //-------------------------------------------------------------------------- + + GETNAME (GxB_LOR_GT_INT8) ; + GETNAME (GxB_LOR_GT_INT16) ; + GETNAME (GxB_LOR_GT_INT32) ; + GETNAME (GxB_LOR_GT_INT64) ; + GETNAME (GxB_LOR_GT_UINT8) ; + GETNAME (GxB_LOR_GT_UINT16) ; + GETNAME (GxB_LOR_GT_UINT32) ; + GETNAME (GxB_LOR_GT_UINT64) ; + GETNAME (GxB_LOR_GT_FP32) ; + GETNAME (GxB_LOR_GT_FP64) ; + + GETNAME (GxB_LAND_GT_INT8) ; + GETNAME (GxB_LAND_GT_INT16) ; + GETNAME (GxB_LAND_GT_INT32) ; + GETNAME (GxB_LAND_GT_INT64) ; + GETNAME (GxB_LAND_GT_UINT8) ; + GETNAME (GxB_LAND_GT_UINT16) ; + GETNAME (GxB_LAND_GT_UINT32) ; + GETNAME (GxB_LAND_GT_UINT64) ; + GETNAME (GxB_LAND_GT_FP32) ; + GETNAME (GxB_LAND_GT_FP64) ; + + GETNAME (GxB_LXOR_GT_INT8) ; + GETNAME (GxB_LXOR_GT_INT16) ; + GETNAME (GxB_LXOR_GT_INT32) ; + GETNAME (GxB_LXOR_GT_INT64) ; + GETNAME (GxB_LXOR_GT_UINT8) ; + GETNAME (GxB_LXOR_GT_UINT16) ; + GETNAME (GxB_LXOR_GT_UINT32) ; + GETNAME (GxB_LXOR_GT_UINT64) ; + GETNAME (GxB_LXOR_GT_FP32) ; + GETNAME (GxB_LXOR_GT_FP64) ; + + GETNAME (GxB_EQ_GT_INT8) ; + GETNAME (GxB_EQ_GT_INT16) ; + GETNAME (GxB_EQ_GT_INT32) ; + GETNAME (GxB_EQ_GT_INT64) ; + GETNAME (GxB_EQ_GT_UINT8) ; + GETNAME (GxB_EQ_GT_UINT16) ; + GETNAME (GxB_EQ_GT_UINT32) ; + GETNAME (GxB_EQ_GT_UINT64) ; + GETNAME (GxB_EQ_GT_FP32) ; + GETNAME (GxB_EQ_GT_FP64) ; + + GETNAME (GxB_ANY_GT_INT8) ; + GETNAME (GxB_ANY_GT_INT16) ; + GETNAME (GxB_ANY_GT_INT32) ; + GETNAME (GxB_ANY_GT_INT64) ; + GETNAME (GxB_ANY_GT_UINT8) ; + GETNAME (GxB_ANY_GT_UINT16) ; + GETNAME (GxB_ANY_GT_UINT32) ; + GETNAME (GxB_ANY_GT_UINT64) ; + GETNAME (GxB_ANY_GT_FP32) ; + GETNAME (GxB_ANY_GT_FP64) ; + + GETNAME (GxB_LOR_GT_BOOL) ; + GETNAME (GxB_LAND_GT_BOOL) ; + GETNAME (GxB_LXOR_GT_BOOL) ; + GETNAME (GxB_EQ_GT_BOOL) ; + GETNAME (GxB_ANY_GT_BOOL) ; + + //-------------------------------------------------------------------------- + // *_LT + //-------------------------------------------------------------------------- + + GETNAME (GxB_LOR_LT_INT8) ; + GETNAME (GxB_LOR_LT_INT16) ; + GETNAME (GxB_LOR_LT_INT32) ; + GETNAME (GxB_LOR_LT_INT64) ; + GETNAME (GxB_LOR_LT_UINT8) ; + GETNAME (GxB_LOR_LT_UINT16) ; + GETNAME (GxB_LOR_LT_UINT32) ; + GETNAME (GxB_LOR_LT_UINT64) ; + GETNAME (GxB_LOR_LT_FP32) ; + GETNAME (GxB_LOR_LT_FP64) ; + + GETNAME (GxB_LAND_LT_INT8) ; + GETNAME (GxB_LAND_LT_INT16) ; + GETNAME (GxB_LAND_LT_INT32) ; + GETNAME (GxB_LAND_LT_INT64) ; + GETNAME (GxB_LAND_LT_UINT8) ; + GETNAME (GxB_LAND_LT_UINT16) ; + GETNAME (GxB_LAND_LT_UINT32) ; + GETNAME (GxB_LAND_LT_UINT64) ; + GETNAME (GxB_LAND_LT_FP32) ; + GETNAME (GxB_LAND_LT_FP64) ; + + GETNAME (GxB_LXOR_LT_INT8) ; + GETNAME (GxB_LXOR_LT_INT16) ; + GETNAME (GxB_LXOR_LT_INT32) ; + GETNAME (GxB_LXOR_LT_INT64) ; + GETNAME (GxB_LXOR_LT_UINT8) ; + GETNAME (GxB_LXOR_LT_UINT16) ; + GETNAME (GxB_LXOR_LT_UINT32) ; + GETNAME (GxB_LXOR_LT_UINT64) ; + GETNAME (GxB_LXOR_LT_FP32) ; + GETNAME (GxB_LXOR_LT_FP64) ; + + GETNAME (GxB_EQ_LT_INT8) ; + GETNAME (GxB_EQ_LT_INT16) ; + GETNAME (GxB_EQ_LT_INT32) ; + GETNAME (GxB_EQ_LT_INT64) ; + GETNAME (GxB_EQ_LT_UINT8) ; + GETNAME (GxB_EQ_LT_UINT16) ; + GETNAME (GxB_EQ_LT_UINT32) ; + GETNAME (GxB_EQ_LT_UINT64) ; + GETNAME (GxB_EQ_LT_FP32) ; + GETNAME (GxB_EQ_LT_FP64) ; + + GETNAME (GxB_ANY_LT_INT8) ; + GETNAME (GxB_ANY_LT_INT16) ; + GETNAME (GxB_ANY_LT_INT32) ; + GETNAME (GxB_ANY_LT_INT64) ; + GETNAME (GxB_ANY_LT_UINT8) ; + GETNAME (GxB_ANY_LT_UINT16) ; + GETNAME (GxB_ANY_LT_UINT32) ; + GETNAME (GxB_ANY_LT_UINT64) ; + GETNAME (GxB_ANY_LT_FP32) ; + GETNAME (GxB_ANY_LT_FP64) ; + + GETNAME (GxB_LOR_LT_BOOL) ; + GETNAME (GxB_LAND_LT_BOOL) ; + GETNAME (GxB_LXOR_LT_BOOL) ; + GETNAME (GxB_EQ_LT_BOOL) ; + GETNAME (GxB_ANY_LT_BOOL) ; + + //-------------------------------------------------------------------------- + // *_GE + //-------------------------------------------------------------------------- + + GETNAME (GxB_LOR_GE_INT8) ; + GETNAME (GxB_LOR_GE_INT16) ; + GETNAME (GxB_LOR_GE_INT32) ; + GETNAME (GxB_LOR_GE_INT64) ; + GETNAME (GxB_LOR_GE_UINT8) ; + GETNAME (GxB_LOR_GE_UINT16) ; + GETNAME (GxB_LOR_GE_UINT32) ; + GETNAME (GxB_LOR_GE_UINT64) ; + GETNAME (GxB_LOR_GE_FP32) ; + GETNAME (GxB_LOR_GE_FP64) ; + + GETNAME (GxB_LAND_GE_INT8) ; + GETNAME (GxB_LAND_GE_INT16) ; + GETNAME (GxB_LAND_GE_INT32) ; + GETNAME (GxB_LAND_GE_INT64) ; + GETNAME (GxB_LAND_GE_UINT8) ; + GETNAME (GxB_LAND_GE_UINT16) ; + GETNAME (GxB_LAND_GE_UINT32) ; + GETNAME (GxB_LAND_GE_UINT64) ; + GETNAME (GxB_LAND_GE_FP32) ; + GETNAME (GxB_LAND_GE_FP64) ; + + GETNAME (GxB_LXOR_GE_INT8) ; + GETNAME (GxB_LXOR_GE_INT16) ; + GETNAME (GxB_LXOR_GE_INT32) ; + GETNAME (GxB_LXOR_GE_INT64) ; + GETNAME (GxB_LXOR_GE_UINT8) ; + GETNAME (GxB_LXOR_GE_UINT16) ; + GETNAME (GxB_LXOR_GE_UINT32) ; + GETNAME (GxB_LXOR_GE_UINT64) ; + GETNAME (GxB_LXOR_GE_FP32) ; + GETNAME (GxB_LXOR_GE_FP64) ; + + GETNAME (GxB_EQ_GE_INT8) ; + GETNAME (GxB_EQ_GE_INT16) ; + GETNAME (GxB_EQ_GE_INT32) ; + GETNAME (GxB_EQ_GE_INT64) ; + GETNAME (GxB_EQ_GE_UINT8) ; + GETNAME (GxB_EQ_GE_UINT16) ; + GETNAME (GxB_EQ_GE_UINT32) ; + GETNAME (GxB_EQ_GE_UINT64) ; + GETNAME (GxB_EQ_GE_FP32) ; + GETNAME (GxB_EQ_GE_FP64) ; + + GETNAME (GxB_ANY_GE_INT8) ; + GETNAME (GxB_ANY_GE_INT16) ; + GETNAME (GxB_ANY_GE_INT32) ; + GETNAME (GxB_ANY_GE_INT64) ; + GETNAME (GxB_ANY_GE_UINT8) ; + GETNAME (GxB_ANY_GE_UINT16) ; + GETNAME (GxB_ANY_GE_UINT32) ; + GETNAME (GxB_ANY_GE_UINT64) ; + GETNAME (GxB_ANY_GE_FP32) ; + GETNAME (GxB_ANY_GE_FP64) ; + + GETNAME (GxB_LOR_GE_BOOL) ; + GETNAME (GxB_LAND_GE_BOOL) ; + GETNAME (GxB_LXOR_GE_BOOL) ; + GETNAME (GxB_EQ_GE_BOOL) ; + GETNAME (GxB_ANY_GE_BOOL) ; + + //-------------------------------------------------------------------------- + // *_LE + //-------------------------------------------------------------------------- + + GETNAME (GxB_LOR_LE_INT8) ; + GETNAME (GxB_LOR_LE_INT16) ; + GETNAME (GxB_LOR_LE_INT32) ; + GETNAME (GxB_LOR_LE_INT64) ; + GETNAME (GxB_LOR_LE_UINT8) ; + GETNAME (GxB_LOR_LE_UINT16) ; + GETNAME (GxB_LOR_LE_UINT32) ; + GETNAME (GxB_LOR_LE_UINT64) ; + GETNAME (GxB_LOR_LE_FP32) ; + GETNAME (GxB_LOR_LE_FP64) ; + + GETNAME (GxB_LAND_LE_INT8) ; + GETNAME (GxB_LAND_LE_INT16) ; + GETNAME (GxB_LAND_LE_INT32) ; + GETNAME (GxB_LAND_LE_INT64) ; + GETNAME (GxB_LAND_LE_UINT8) ; + GETNAME (GxB_LAND_LE_UINT16) ; + GETNAME (GxB_LAND_LE_UINT32) ; + GETNAME (GxB_LAND_LE_UINT64) ; + GETNAME (GxB_LAND_LE_FP32) ; + GETNAME (GxB_LAND_LE_FP64) ; + + GETNAME (GxB_LXOR_LE_INT8) ; + GETNAME (GxB_LXOR_LE_INT16) ; + GETNAME (GxB_LXOR_LE_INT32) ; + GETNAME (GxB_LXOR_LE_INT64) ; + GETNAME (GxB_LXOR_LE_UINT8) ; + GETNAME (GxB_LXOR_LE_UINT16) ; + GETNAME (GxB_LXOR_LE_UINT32) ; + GETNAME (GxB_LXOR_LE_UINT64) ; + GETNAME (GxB_LXOR_LE_FP32) ; + GETNAME (GxB_LXOR_LE_FP64) ; + + GETNAME (GxB_EQ_LE_INT8) ; + GETNAME (GxB_EQ_LE_INT16) ; + GETNAME (GxB_EQ_LE_INT32) ; + GETNAME (GxB_EQ_LE_INT64) ; + GETNAME (GxB_EQ_LE_UINT8) ; + GETNAME (GxB_EQ_LE_UINT16) ; + GETNAME (GxB_EQ_LE_UINT32) ; + GETNAME (GxB_EQ_LE_UINT64) ; + GETNAME (GxB_EQ_LE_FP32) ; + GETNAME (GxB_EQ_LE_FP64) ; + + GETNAME (GxB_ANY_LE_INT8) ; + GETNAME (GxB_ANY_LE_INT16) ; + GETNAME (GxB_ANY_LE_INT32) ; + GETNAME (GxB_ANY_LE_INT64) ; + GETNAME (GxB_ANY_LE_UINT8) ; + GETNAME (GxB_ANY_LE_UINT16) ; + GETNAME (GxB_ANY_LE_UINT32) ; + GETNAME (GxB_ANY_LE_UINT64) ; + GETNAME (GxB_ANY_LE_FP32) ; + GETNAME (GxB_ANY_LE_FP64) ; + + GETNAME (GxB_LOR_LE_BOOL) ; + GETNAME (GxB_LAND_LE_BOOL) ; + GETNAME (GxB_LXOR_LE_BOOL) ; + GETNAME (GxB_EQ_LE_BOOL) ; + GETNAME (GxB_ANY_LE_BOOL) ; + + + //-------------------------------------------------------------------------- + // bitwise + //-------------------------------------------------------------------------- + + GETNAME (GxB_BOR_BOR_UINT8) ; + GETNAME (GxB_BOR_BOR_UINT16) ; + GETNAME (GxB_BOR_BOR_UINT32) ; + GETNAME (GxB_BOR_BOR_UINT64) ; + + GETNAME (GxB_BOR_BAND_UINT8) ; + GETNAME (GxB_BOR_BAND_UINT16) ; + GETNAME (GxB_BOR_BAND_UINT32) ; + GETNAME (GxB_BOR_BAND_UINT64) ; + + GETNAME (GxB_BOR_BXOR_UINT8) ; + GETNAME (GxB_BOR_BXOR_UINT16) ; + GETNAME (GxB_BOR_BXOR_UINT32) ; + GETNAME (GxB_BOR_BXOR_UINT64) ; + + GETNAME (GxB_BOR_BXNOR_UINT8) ; + GETNAME (GxB_BOR_BXNOR_UINT16) ; + GETNAME (GxB_BOR_BXNOR_UINT32) ; + GETNAME (GxB_BOR_BXNOR_UINT64) ; + + GETNAME (GxB_BAND_BOR_UINT8) ; + GETNAME (GxB_BAND_BOR_UINT16) ; + GETNAME (GxB_BAND_BOR_UINT32) ; + GETNAME (GxB_BAND_BOR_UINT64) ; + + GETNAME (GxB_BAND_BAND_UINT8) ; + GETNAME (GxB_BAND_BAND_UINT16) ; + GETNAME (GxB_BAND_BAND_UINT32) ; + GETNAME (GxB_BAND_BAND_UINT64) ; + + GETNAME (GxB_BAND_BXOR_UINT8) ; + GETNAME (GxB_BAND_BXOR_UINT16) ; + GETNAME (GxB_BAND_BXOR_UINT32) ; + GETNAME (GxB_BAND_BXOR_UINT64) ; + + GETNAME (GxB_BAND_BXNOR_UINT8) ; + GETNAME (GxB_BAND_BXNOR_UINT16) ; + GETNAME (GxB_BAND_BXNOR_UINT32) ; + GETNAME (GxB_BAND_BXNOR_UINT64) ; + + GETNAME (GxB_BXOR_BOR_UINT8) ; + GETNAME (GxB_BXOR_BOR_UINT16) ; + GETNAME (GxB_BXOR_BOR_UINT32) ; + GETNAME (GxB_BXOR_BOR_UINT64) ; + + GETNAME (GxB_BXOR_BAND_UINT8) ; + GETNAME (GxB_BXOR_BAND_UINT16) ; + GETNAME (GxB_BXOR_BAND_UINT32) ; + GETNAME (GxB_BXOR_BAND_UINT64) ; + + GETNAME (GxB_BXOR_BXOR_UINT8) ; + GETNAME (GxB_BXOR_BXOR_UINT16) ; + GETNAME (GxB_BXOR_BXOR_UINT32) ; + GETNAME (GxB_BXOR_BXOR_UINT64) ; + + GETNAME (GxB_BXOR_BXNOR_UINT8) ; + GETNAME (GxB_BXOR_BXNOR_UINT16) ; + GETNAME (GxB_BXOR_BXNOR_UINT32) ; + GETNAME (GxB_BXOR_BXNOR_UINT64) ; + + + GETNAME (GxB_BXNOR_BOR_UINT8) ; + GETNAME (GxB_BXNOR_BOR_UINT16) ; + GETNAME (GxB_BXNOR_BOR_UINT32) ; + GETNAME (GxB_BXNOR_BOR_UINT64) ; + + GETNAME (GxB_BXNOR_BAND_UINT8) ; + GETNAME (GxB_BXNOR_BAND_UINT16) ; + GETNAME (GxB_BXNOR_BAND_UINT32) ; + GETNAME (GxB_BXNOR_BAND_UINT64) ; + + GETNAME (GxB_BXNOR_BXOR_UINT8) ; + GETNAME (GxB_BXNOR_BXOR_UINT16) ; + GETNAME (GxB_BXNOR_BXOR_UINT32) ; + GETNAME (GxB_BXNOR_BXOR_UINT64) ; + + GETNAME (GxB_BXNOR_BXNOR_UINT8) ; + GETNAME (GxB_BXNOR_BXNOR_UINT16) ; + GETNAME (GxB_BXNOR_BXNOR_UINT32) ; + GETNAME (GxB_BXNOR_BXNOR_UINT64) ; + + //-------------------------------------------------------------------------- + // positional semirings + //-------------------------------------------------------------------------- + + GETNAME (GxB_MIN_FIRSTI_INT32) ; + GETNAME (GxB_MIN_FIRSTI_INT64) ; + + GETNAME (GxB_MAX_FIRSTI_INT32) ; + GETNAME (GxB_MAX_FIRSTI_INT64) ; + + GETNAME (GxB_ANY_FIRSTI_INT32) ; + GETNAME (GxB_ANY_FIRSTI_INT64) ; + + GETNAME (GxB_PLUS_FIRSTI_INT32) ; + GETNAME (GxB_PLUS_FIRSTI_INT64) ; + + GETNAME (GxB_TIMES_FIRSTI_INT32) ; + GETNAME (GxB_TIMES_FIRSTI_INT64) ; + + GETNAME (GxB_MIN_FIRSTI1_INT32) ; + GETNAME (GxB_MIN_FIRSTI1_INT64) ; + + GETNAME (GxB_MAX_FIRSTI1_INT32) ; + GETNAME (GxB_MAX_FIRSTI1_INT64) ; + + GETNAME (GxB_ANY_FIRSTI1_INT32) ; + GETNAME (GxB_ANY_FIRSTI1_INT64) ; + + GETNAME (GxB_PLUS_FIRSTI1_INT32) ; + GETNAME (GxB_PLUS_FIRSTI1_INT64) ; + + GETNAME (GxB_TIMES_FIRSTI1_INT32) ; + GETNAME (GxB_TIMES_FIRSTI1_INT64) ; + + GETNAM2 (GxB_MIN_FIRSTJ_INT32, "GxB_MIN_SECONDI_INT32") ; + GETNAM2 (GxB_MIN_FIRSTJ_INT64, "GxB_MIN_SECONDI_INT64") ; + + GETNAM2 (GxB_MAX_FIRSTJ_INT32, "GxB_MAX_SECONDI_INT32") ; + GETNAM2 (GxB_MAX_FIRSTJ_INT64, "GxB_MAX_SECONDI_INT64") ; + + GETNAM2 (GxB_ANY_FIRSTJ_INT32, "GxB_ANY_SECONDI_INT32") ; + GETNAM2 (GxB_ANY_FIRSTJ_INT64, "GxB_ANY_SECONDI_INT64") ; + + GETNAM2 (GxB_PLUS_FIRSTJ_INT32, "GxB_PLUS_SECONDI_INT32") ; + GETNAM2 (GxB_PLUS_FIRSTJ_INT64, "GxB_PLUS_SECONDI_INT64") ; + + GETNAM2 (GxB_TIMES_FIRSTJ_INT32, "GxB_TIMES_SECONDI_INT32") ; + GETNAM2 (GxB_TIMES_FIRSTJ_INT64, "GxB_TIMES_SECONDI_INT64") ; + + GETNAM2 (GxB_MIN_FIRSTJ1_INT32, "GxB_MIN_SECONDI1_INT32") ; + GETNAM2 (GxB_MIN_FIRSTJ1_INT64, "GxB_MIN_SECONDI1_INT64") ; + + GETNAM2 (GxB_MAX_FIRSTJ1_INT32, "GxB_MAX_SECONDI1_INT32") ; + GETNAM2 (GxB_MAX_FIRSTJ1_INT64, "GxB_MAX_SECONDI1_INT64") ; + + GETNAM2 (GxB_ANY_FIRSTJ1_INT32, "GxB_ANY_SECONDI1_INT32") ; + GETNAM2 (GxB_ANY_FIRSTJ1_INT64, "GxB_ANY_SECONDI1_INT64") ; + + GETNAM2 (GxB_PLUS_FIRSTJ1_INT32, "GxB_PLUS_SECONDI1_INT32") ; + GETNAM2 (GxB_PLUS_FIRSTJ1_INT64, "GxB_PLUS_SECONDI1_INT64") ; + + GETNAM2 (GxB_TIMES_FIRSTJ1_INT32, "GxB_TIMES_SECONDI1_INT32") ; + GETNAM2 (GxB_TIMES_FIRSTJ1_INT64, "GxB_TIMES_SECONDI1_INT64") ; + + GETNAME (GxB_MIN_SECONDI_INT32) ; + GETNAME (GxB_MIN_SECONDI_INT64) ; + + GETNAME (GxB_MAX_SECONDI_INT32) ; + GETNAME (GxB_MAX_SECONDI_INT64) ; + + GETNAME (GxB_ANY_SECONDI_INT32) ; + GETNAME (GxB_ANY_SECONDI_INT64) ; + + GETNAME (GxB_PLUS_SECONDI_INT32) ; + GETNAME (GxB_PLUS_SECONDI_INT64) ; + + GETNAME (GxB_TIMES_SECONDI_INT32) ; + GETNAME (GxB_TIMES_SECONDI_INT64) ; + + GETNAME (GxB_MIN_SECONDI1_INT32) ; + GETNAME (GxB_MIN_SECONDI1_INT64) ; + + GETNAME (GxB_MAX_SECONDI1_INT32) ; + GETNAME (GxB_MAX_SECONDI1_INT64) ; + + GETNAME (GxB_ANY_SECONDI1_INT32) ; + GETNAME (GxB_ANY_SECONDI1_INT64) ; + + GETNAME (GxB_PLUS_SECONDI1_INT32) ; + GETNAME (GxB_PLUS_SECONDI1_INT64) ; + + GETNAME (GxB_TIMES_SECONDI1_INT32) ; + GETNAME (GxB_TIMES_SECONDI1_INT64) ; + + GETNAME (GxB_MIN_SECONDJ_INT32) ; + GETNAME (GxB_MIN_SECONDJ_INT64) ; + + GETNAME (GxB_MAX_SECONDJ_INT32) ; + GETNAME (GxB_MAX_SECONDJ_INT64) ; + + GETNAME (GxB_ANY_SECONDJ_INT32) ; + GETNAME (GxB_ANY_SECONDJ_INT64) ; + + GETNAME (GxB_PLUS_SECONDJ_INT32) ; + GETNAME (GxB_PLUS_SECONDJ_INT64) ; + + GETNAME (GxB_TIMES_SECONDJ_INT32) ; + GETNAME (GxB_TIMES_SECONDJ_INT64) ; + + GETNAME (GxB_MIN_SECONDJ1_INT32) ; + GETNAME (GxB_MIN_SECONDJ1_INT64) ; + + GETNAME (GxB_MAX_SECONDJ1_INT32) ; + GETNAME (GxB_MAX_SECONDJ1_INT64) ; + + GETNAME (GxB_ANY_SECONDJ1_INT32) ; + GETNAME (GxB_ANY_SECONDJ1_INT64) ; + + GETNAME (GxB_PLUS_SECONDJ1_INT32) ; + GETNAME (GxB_PLUS_SECONDJ1_INT64) ; + + GETNAME (GxB_TIMES_SECONDJ1_INT32) ; + GETNAME (GxB_TIMES_SECONDJ1_INT64) ; + + //-------------------------------------------------------------------------- + // other methods + //-------------------------------------------------------------------------- + + OK (GrB_Semiring_get_INT32_(GrB_PLUS_TIMES_SEMIRING_FP32, &code, + GrB_INP0_TYPE_CODE)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_Semiring_get_SIZE_(GrB_PLUS_TIMES_SEMIRING_FP32, &size, + GrB_INP0_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + + OK (GrB_Semiring_get_String_(GrB_PLUS_TIMES_SEMIRING_FP32, name, + GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GrB_Semiring_get_SIZE_(GrB_MAX_PLUS_SEMIRING_INT32, &size, + GrB_INP1_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_INT32") + 1) ; + + OK (GrB_Semiring_get_String_(GrB_MAX_PLUS_SEMIRING_INT32, name, + GrB_INP1_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_INT32")) ; + + OK (GrB_Semiring_get_INT32_(GrB_PLUS_TIMES_SEMIRING_FP64, &code, + GrB_OUTP_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_Semiring_get_SIZE_(GrB_PLUS_TIMES_SEMIRING_FP64, &size, + GrB_OUTP_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP64") + 1) ; + + OK (GrB_Semiring_get_String_(GrB_PLUS_TIMES_SEMIRING_FP64, name, + GrB_OUTP_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP64")) ; + + OK (GrB_Semiring_get_Scalar_(GrB_PLUS_TIMES_SEMIRING_FP32, s_int32, + GrB_INP0_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_FP32_CODE) ; + + OK (GrB_Semiring_get_Scalar_(GrB_LOR_LAND_SEMIRING_BOOL, s_int32, + GrB_OUTP_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + OK (GrB_Semiring_get_INT32_(GrB_PLUS_TIMES_SEMIRING_FP64, &code, + GrB_INP1_TYPE_CODE)) ; + CHECK (code == GrB_FP64_CODE) ; + + OK (GrB_Semiring_get_Scalar_(GrB_LOR_LAND_SEMIRING_BOOL, s_int32, + GrB_INP1_TYPE_CODE)) ; + OK (GrB_Scalar_extractElement_INT32_(&code, s_int32)) ; + CHECK (code == GrB_BOOL_CODE) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Semiring_get_INT32_(GrB_LOR_LAND_SEMIRING_BOOL, &code, + GrB_NAME)) ; + ERR (GrB_Semiring_get_String_(GrB_PLUS_TIMES_SEMIRING_INT32, name, + 999)) ; + + ERR (GrB_Semiring_get_VOID_(GrB_LOR_LAND_SEMIRING_BOOL, nothing, 0)) ; + + OK (GrB_BinaryOp_new (×, mytimes, GrB_FP32, GrB_FP32, GrB_FP32)) ; + OK (GrB_BinaryOp_set_String_(times, "mytimes", GrB_NAME)) ; + METHOD (GrB_BinaryOp_set_String (times, MYTIMES_DEFN, GxB_JIT_C_DEFINITION)) ; + + OK (GrB_BinaryOp_new (&add, myadd, GrB_FP32, GrB_FP32, GrB_FP32)) ; + OK (GrB_BinaryOp_set_String_(add, "myadd", GrB_NAME)) ; + METHOD (GrB_BinaryOp_set_String (add, MYADD_DEFN, GxB_JIT_C_DEFINITION)) ; + + OK (GrB_Monoid_new_FP32 (&monoid, add, (float) 0.0)) ; + OK (GrB_Monoid_get_SIZE_(monoid, &size, GrB_NAME)) ; + OK (GrB_Monoid_get_String_(monoid, name, GrB_NAME)) ; + printf ("\nuser monoid: [%s]:%d\n", name, size) ; + CHECK (MATCH (name, "")) ; + CHECK (size == 1) ; + OK (GxB_print (monoid, 3)) ; + + OK (GrB_Semiring_new (&semiring, monoid, times)) ; + + OK (GrB_Semiring_get_SIZE_(semiring, &size, GrB_INP0_TYPE_STRING)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + OK (GrB_Semiring_get_String(semiring, name, GrB_INP0_TYPE_STRING)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Semiring_get_SIZE_(semiring, &size, GrB_INP0_TYPE_CODE)) ; + ERR (GrB_Semiring_set_String_(GrB_MAX_TIMES_SEMIRING_INT32, "stuff", + GrB_NAME)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Semiring_set_Scalar_(semiring, s_int32, 0)) ; + ERR (GrB_Semiring_set_INT32_(semiring, 0, 0)) ; + ERR (GrB_Semiring_set_VOID_(semiring, nothing, 0, 0)) ; + + OK (GrB_Semiring_get_String_(semiring, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + OK (GrB_Semiring_set_String_(semiring, "stuff", GrB_NAME)) ; + OK (GrB_Semiring_get_String_(semiring, name, GrB_NAME)) ; + CHECK (MATCH (name, "stuff")) ; + OK (GrB_Semiring_get_SIZE_(semiring, &size, GrB_NAME)) ; + CHECK (size == strlen (name) + 1) ; + OK (GxB_print (semiring, 3)) ; + + expected = GrB_ALREADY_SET ; + ERR (GrB_Semiring_set_String_(semiring, "another user name", GrB_NAME)) ; + printf (" test GrB_ALREADY_SET: ok\n") ; + + printf ("\nsemiring with terminal monoid:\n") ; + int32_t id_int32 ; + OK (GrB_Semiring_get_String_(GrB_MAX_TIMES_SEMIRING_INT32, + name, GrB_NAME)) ; + OK (GxB_Semiring_fprint (GrB_MAX_TIMES_SEMIRING_INT32, name, 3, NULL)) ; + OK (GrB_Monoid_get_Scalar_ (GrB_MAX_TIMES_SEMIRING_INT32, s_int32, + GxB_MONOID_IDENTITY)) ; + OK (GrB_Scalar_nvals (&nvals, s_int32)) ; + CHECK (nvals == 1) ; + OK (GrB_Scalar_extractElement_INT32_(&id_int32, s_int32)) ; + CHECK (id_int32 == INT32_MIN) ; + + int32_t term_int32 ; + OK (GrB_Monoid_get_Scalar_ (GrB_MAX_TIMES_SEMIRING_INT32, s_int32, + GxB_MONOID_TERMINAL)) ; + OK (GrB_Scalar_extractElement_INT32_(&term_int32, s_int32)) ; + CHECK (term_int32 == INT32_MAX) ; + + op = NULL ; + OK (GrB_Semiring_get_SIZE_ (semiring, &size, GxB_MONOID_OPERATOR)) ; + CHECK (size == sizeof (GrB_BinaryOp)) ; + OK (GrB_Semiring_get_VOID (semiring, (void *) (&op), GxB_MONOID_OPERATOR)) ; + CHECK (op == add) ; + OK (GrB_Semiring_get_VOID_ (GrB_PLUS_TIMES_SEMIRING_INT32, (void *) &op, + GxB_MONOID_OPERATOR)) ; + CHECK (op == GrB_PLUS_INT32) ; + + OK (GrB_Semiring_get_SIZE_ (semiring, &size, GxB_SEMIRING_MONOID)) ; + CHECK (size == sizeof (GrB_Monoid)) ; + + OK (GrB_Semiring_get_SIZE_ (semiring, &size, GxB_SEMIRING_MULTIPLY)) ; + CHECK (size == sizeof (GrB_BinaryOp)) ; + + OK (GrB_Semiring_get_VOID_ (semiring, (void *) (&mon), + GxB_SEMIRING_MONOID)) ; + CHECK (mon == monoid) ; + + OK (GrB_Semiring_get_VOID_ (semiring, (void *) (&op), + GxB_SEMIRING_MULTIPLY)) ; + CHECK (op == times) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&add) ; + GrB_free (×) ; + GrB_free (&monoid) ; + GrB_free (&semiring) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test32: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test33.c b/GraphBLAS/Test/GB_mex_test33.c new file mode 100644 index 0000000000..74ef826d17 --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test33.c @@ -0,0 +1,157 @@ +//------------------------------------------------------------------------------ +// GB_mex_test33: test GrB_get and GrB_set (context) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test33" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Matrix A = NULL ; + GrB_Vector v = NULL ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GxB_Context context = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GxB_Context get/set + //-------------------------------------------------------------------------- + + int32_t nthreads1 = 999, nthreads2 = 777 ; + GxB_get (GxB_NTHREADS, &nthreads1) ; + printf ("nthreads: %d\n", nthreads1) ; + + OK (GxB_Context_get_INT_ (GxB_CONTEXT_WORLD, &nthreads2, GxB_NTHREADS)) ; + printf ("nthreads: %d\n", nthreads2) ; + CHECK (nthreads1 == nthreads2) ; + + OK (GxB_Context_set_INT_ (GxB_CONTEXT_WORLD, 7, GxB_NTHREADS)) ; + OK (GxB_Context_get_INT_ (GxB_CONTEXT_WORLD, &nthreads2, GxB_NTHREADS)) ; + CHECK (nthreads2 == 7) ; + + OK (GxB_Global_Option_get (GxB_NTHREADS, &i)) ; + CHECK (i == 7) ; + + OK (GrB_Scalar_setElement_FP64 (s_int32, 31)) ; + OK (GxB_Context_set_Scalar_ (GxB_CONTEXT_WORLD, s_int32, GxB_NTHREADS)) ; + OK (GxB_Context_get_Scalar_ (GxB_CONTEXT_WORLD, s_fp64, GxB_NTHREADS)) ; + OK (GrB_Scalar_extractElement_FP64 (&dvalue, s_fp64)) ; + CHECK (dvalue == 31) ; + + GxB_set (GxB_NTHREADS, nthreads1) ; + + int32_t gpu ; + OK (GxB_Context_get_INT_ (GxB_CONTEXT_WORLD, &gpu, GxB_GPU_ID)) ; + CHECK (gpu == -1) ; + + gpu = 4 ; + OK (GxB_Context_set_INT_ (GxB_CONTEXT_WORLD, 3, GxB_GPU_ID)) ; + OK (GxB_Context_get_INT_ (GxB_CONTEXT_WORLD, &gpu, GxB_GPU_ID)) ; + CHECK (gpu == -1) ; + + OK (GxB_Context_set_Scalar_ (GxB_CONTEXT_WORLD, s_int32, GxB_GPU_ID)) ; + OK (GxB_Context_get_Scalar_ (GxB_CONTEXT_WORLD, s_fp64, GxB_GPU_ID)) ; + OK (GrB_Scalar_extractElement_FP64 (&dvalue, s_fp64)) ; + CHECK (dvalue == -1) ; + + double chunk ; + OK (GxB_Context_get_Scalar_ (GxB_CONTEXT_WORLD, s_fp64, GxB_CHUNK)) ; + OK (GrB_Scalar_extractElement_FP64 (&chunk, s_fp64)) ; + printf ("chunk: %g\n", chunk) ; + + OK (GrB_Scalar_setElement_FP64 (s_fp64, 2048)) ; + OK (GxB_Context_set_Scalar_ (GxB_CONTEXT_WORLD, s_fp64, GxB_CHUNK)) ; + OK (GxB_Context_get_Scalar_ (GxB_CONTEXT_WORLD, s_fp32, GxB_CHUNK)) ; + OK (GrB_Scalar_extractElement_FP32 (&fvalue, s_fp32)) ; + CHECK (fvalue == 2048) ; + printf ("new chunk: %g\n", fvalue) ; + + OK (GxB_Context_get_SIZE_ (GxB_CONTEXT_WORLD, &size, GrB_NAME)) ; + CHECK (size == GxB_MAX_NAME_LEN) ; + OK (GxB_Context_get_String_ (GxB_CONTEXT_WORLD, name, GrB_NAME)) ; + printf ("name of world [%s]\n", name) ; + CHECK (MATCH (name, "GxB_CONTEXT_WORLD")) ; + + expected = GrB_INVALID_VALUE ; + ERR (GxB_Context_set_String_ (GxB_CONTEXT_WORLD, "newname", GrB_NAME)) ; + OK (GxB_Context_get_String_ (GxB_CONTEXT_WORLD, name, GrB_NAME)) ; + CHECK (MATCH (name, "GxB_CONTEXT_WORLD")) ; + + ERR (GxB_Context_get_SIZE_ (GxB_CONTEXT_WORLD, &size, GxB_FORMAT)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GxB_Context_get_VOID_ (GxB_CONTEXT_WORLD, nothing, 0)) ; + ERR (GxB_Context_set_VOID_ (GxB_CONTEXT_WORLD, nothing, 0, 0)) ; + ERR (GxB_Context_get_String_ (GxB_CONTEXT_WORLD, name, 999)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GxB_Context_get_INT_ (GxB_CONTEXT_WORLD, &i, GrB_NAME)) ; + ERR (GxB_Context_get_Scalar_ (GxB_CONTEXT_WORLD, s_fp32, GrB_NAME)) ; + ERR (GxB_Context_set_INT_ (GxB_CONTEXT_WORLD, 7, GrB_NAME)) ; + ERR (GxB_Context_set_Scalar_ (GxB_CONTEXT_WORLD, s_fp64, GrB_NAME)) ; + + expected = GrB_EMPTY_OBJECT ; + OK (GrB_Scalar_clear (s_int32)) ; + ERR (GxB_Context_set_Scalar_ (GxB_CONTEXT_WORLD, s_int32, GxB_NTHREADS)) ; + + OK (GxB_Context_new (&context)) ; + OK (GxB_Context_get_String_ (context, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + OK (GxB_Context_set_String_ (context, "another_name", GrB_NAME)) ; + OK (GxB_Context_get_String_ (context, name, GrB_NAME)) ; + CHECK (MATCH (name, "another_name")) ; + OK (GxB_Context_get_SIZE_ (context, &size, GrB_NAME)) ; + CHECK (size == strlen (name) + 1) ; + + OK (GxB_Context_disengage (NULL)) ; + GrB_free (&context) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&A) ; + GrB_free (&v) ; + GrB_free (&s) ; + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test33: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test34.c b/GraphBLAS/Test/GB_mex_test34.c new file mode 100644 index 0000000000..4ec290378b --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test34.c @@ -0,0 +1,466 @@ +//------------------------------------------------------------------------------ +// GB_mex_test34: test GrB_get and GrB_set (descriptor) +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test34" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +#define DGET(desc,value,field) \ +{ \ + OK (GrB_Descriptor_get_INT32 (desc, &i, field)) ; \ + CHECK (i == value) ; \ + OK (GrB_Scalar_clear (s_int32)) ; \ + OK (GrB_Descriptor_get_Scalar (desc, s_int32, field)) ; \ + int32_t iscalar = -1 ; \ + OK (GrB_Scalar_extractElement_INT32 (&iscalar, s_int32)) ; \ + CHECK (iscalar == value) ; \ + OK (GrB_Descriptor_get_SIZE (desc, &size, GrB_NAME)) ; \ + CHECK (size == GxB_MAX_NAME_LEN) ; \ + OK (GrB_Descriptor_get_String (desc, name, GrB_NAME)) ; \ + CHECK (MATCH (name, #desc)) ; \ +} + +#define DSET(desc,value,field) \ +{ \ + OK (GrB_Descriptor_set_INT32 (desc, GrB_DEFAULT, field)) ; \ + OK (GrB_Descriptor_set_INT32 (desc, value, field)) ; \ + int32_t i2 ; \ + OK (GrB_Descriptor_get_INT32 (desc, &i2, field)) ; \ + CHECK (i2 == value) ; \ + OK (GrB_Descriptor_set_INT32 (desc, GrB_DEFAULT, field)) ; \ + OK (GrB_Scalar_setElement_INT32 (s_int32, value)) ; \ + OK (GrB_Descriptor_set_Scalar (desc, s_int32, field)) ; \ + int32_t i3 ; \ + OK (GrB_Descriptor_get_INT32 (desc, &i2, field)) ; \ + CHECK (i2 == value) ; \ +} + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Matrix A = NULL ; + GrB_Vector v = NULL ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_Descriptor desc = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size ; + char name [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GrB_Descriptor get/set + //-------------------------------------------------------------------------- + +#if 0 + + // OUTP MASK MASK INP0 INP1 + // structural complement + // =========== ============== ========== ======== ======== + +// GrB_NULL // - - - - - +GrB_DESC_T1 , // - - - - GrB_TRAN +GrB_DESC_T0 , // - - - GrB_TRAN - +GrB_DESC_T0T1 , // - - - GrB_TRAN GrB_TRAN + +GrB_DESC_C , // - - GrB_COMP - - +GrB_DESC_CT1 , // - - GrB_COMP - GrB_TRAN +GrB_DESC_CT0 , // - - GrB_COMP GrB_TRAN - +GrB_DESC_CT0T1 , // - - GrB_COMP GrB_TRAN GrB_TRAN + +GrB_DESC_S , // - GrB_STRUCTURE - - - +GrB_DESC_ST1 , // - GrB_STRUCTURE - - GrB_TRAN +GrB_DESC_ST0 , // - GrB_STRUCTURE - GrB_TRAN - +GrB_DESC_ST0T1 , // - GrB_STRUCTURE - GrB_TRAN GrB_TRAN + +GrB_DESC_SC , // - GrB_STRUCTURE GrB_COMP - - +GrB_DESC_SCT1 , // - GrB_STRUCTURE GrB_COMP - GrB_TRAN +GrB_DESC_SCT0 , // - GrB_STRUCTURE GrB_COMP GrB_TRAN - +GrB_DESC_SCT0T1 , // - GrB_STRUCTURE GrB_COMP GrB_TRAN GrB_TRAN + +GrB_DESC_R , // GrB_REPLACE - - - - +GrB_DESC_RT1 , // GrB_REPLACE - - - GrB_TRAN +GrB_DESC_RT0 , // GrB_REPLACE - - GrB_TRAN - +GrB_DESC_RT0T1 , // GrB_REPLACE - - GrB_TRAN GrB_TRAN + +GrB_DESC_RC , // GrB_REPLACE - GrB_COMP - - +GrB_DESC_RCT1 , // GrB_REPLACE - GrB_COMP - GrB_TRAN +GrB_DESC_RCT0 , // GrB_REPLACE - GrB_COMP GrB_TRAN - +GrB_DESC_RCT0T1 , // GrB_REPLACE - GrB_COMP GrB_TRAN GrB_TRAN + +GrB_DESC_RS , // GrB_REPLACE GrB_STRUCTURE - - - +GrB_DESC_RST1 , // GrB_REPLACE GrB_STRUCTURE - - GrB_TRAN +GrB_DESC_RST0 , // GrB_REPLACE GrB_STRUCTURE - GrB_TRAN - +GrB_DESC_RST0T1 , // GrB_REPLACE GrB_STRUCTURE - GrB_TRAN GrB_TRAN + +GrB_DESC_RSC , // GrB_REPLACE GrB_STRUCTURE GrB_COMP - - +GrB_DESC_RSCT1 , // GrB_REPLACE GrB_STRUCTURE GrB_COMP - GrB_TRAN +GrB_DESC_RSCT0 , // GrB_REPLACE GrB_STRUCTURE GrB_COMP GrB_TRAN - +GrB_DESC_RSCT0T1 ; // GrB_REPLACE GrB_STRUCTURE GrB_COMP GrB_TRAN GrB_TRAN + +#endif + + DGET (GrB_NULL , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_T1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_T0 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_T0T1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_C , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_CT1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_CT0 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_CT0T1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_S , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_ST1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_ST0 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_ST0T1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_SC , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_SCT1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_SCT0 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_SCT0T1 , GrB_DEFAULT, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_R , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RT1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RT0 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RT0T1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_RC , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RCT1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RCT0 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RCT0T1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_RS , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RST1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RST0 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RST0T1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + + DGET (GrB_DESC_RSC , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RSCT1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RSCT0 , GrB_REPLACE, GrB_OUTP_FIELD) ; + DGET (GrB_DESC_RSCT0T1 , GrB_REPLACE, GrB_OUTP_FIELD) ; + + + + DGET (GrB_NULL , GrB_DEFAULT, GrB_MASK_FIELD) ; + DGET (GrB_DESC_T1 , GrB_DEFAULT, GrB_MASK_FIELD) ; + DGET (GrB_DESC_T0 , GrB_DEFAULT, GrB_MASK_FIELD) ; + DGET (GrB_DESC_T0T1 , GrB_DEFAULT, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_C , GrB_COMP, GrB_MASK_FIELD) ; + DGET (GrB_DESC_CT1 , GrB_COMP, GrB_MASK_FIELD) ; + DGET (GrB_DESC_CT0 , GrB_COMP, GrB_MASK_FIELD) ; + DGET (GrB_DESC_CT0T1 , GrB_COMP, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_S , GrB_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_ST1 , GrB_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_ST0 , GrB_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_ST0T1 , GrB_STRUCTURE, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_SC , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_SCT1 , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_SCT0 , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_SCT0T1 , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_R , GrB_DEFAULT, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RT1 , GrB_DEFAULT, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RT0 , GrB_DEFAULT, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RT0T1 , GrB_DEFAULT, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_RC , GrB_COMP, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RCT1 , GrB_COMP, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RCT0 , GrB_COMP, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RCT0T1 , GrB_COMP, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_RS , GrB_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RST1 , GrB_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RST0 , GrB_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RST0T1 , GrB_STRUCTURE, GrB_MASK_FIELD) ; + + DGET (GrB_DESC_RSC , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RSCT1 , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RSCT0 , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + DGET (GrB_DESC_RSCT0T1 , GrB_COMP_STRUCTURE, GrB_MASK_FIELD) ; + + + + DGET (GrB_NULL , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_T1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_T0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_T0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_C , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_CT1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_CT0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_CT0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_S , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_ST1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_ST0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_ST0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_SC , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_SCT1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_SCT0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_SCT0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_R , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RT1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RT0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_RT0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_RC , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RCT1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RCT0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_RCT0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_RS , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RST1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RST0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_RST0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + DGET (GrB_DESC_RSC , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RSCT1 , GrB_DEFAULT, GrB_INP0_FIELD) ; + DGET (GrB_DESC_RSCT0 , GrB_TRAN , GrB_INP0_FIELD) ; + DGET (GrB_DESC_RSCT0T1 , GrB_TRAN , GrB_INP0_FIELD) ; + + + DGET (GrB_NULL , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_T1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_T0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_T0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_C , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_CT1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_CT0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_CT0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_S , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_ST1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_ST0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_ST0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_SC , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_SCT1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_SCT0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_SCT0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_R , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RT1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_RT0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RT0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_RC , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RCT1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_RCT0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RCT0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_RS , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RST1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_RST0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RST0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + DGET (GrB_DESC_RSC , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RSCT1 , GrB_TRAN , GrB_INP1_FIELD) ; + DGET (GrB_DESC_RSCT0 , GrB_DEFAULT, GrB_INP1_FIELD) ; + DGET (GrB_DESC_RSCT0T1 , GrB_TRAN , GrB_INP1_FIELD) ; + + + for (int field = GxB_AxB_METHOD ; field <= GxB_IMPORT ; field++) + { + DGET (GrB_NULL , GrB_DEFAULT, field) ; + DGET (GrB_DESC_T1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_T0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_T0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_C , GrB_DEFAULT, field) ; + DGET (GrB_DESC_CT1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_CT0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_CT0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_S , GrB_DEFAULT, field) ; + DGET (GrB_DESC_ST1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_ST0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_ST0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_SC , GrB_DEFAULT, field) ; + DGET (GrB_DESC_SCT1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_SCT0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_SCT0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_R , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RT1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RT0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RT0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_RC , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RCT1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RCT0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RCT0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_RS , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RST1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RST0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RST0T1 , GrB_DEFAULT, field) ; + + DGET (GrB_DESC_RSC , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RSCT1 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RSCT0 , GrB_DEFAULT, field) ; + DGET (GrB_DESC_RSCT0T1 , GrB_DEFAULT, field) ; + } + + OK (GrB_Descriptor_get_String (NULL, name, GrB_NAME)) ; + CHECK (MATCH (name, "GrB_NULL")) ; + + //-------------------------------------------------------------------------- + + OK (GrB_Descriptor_new (&desc)) ; + + DSET (desc, GrB_REPLACE, GrB_OUTP_FIELD) ; + DSET (desc, GrB_DEFAULT, GrB_OUTP_FIELD) ; + + DSET (desc, GrB_REPLACE, GrB_OUTP) ; + DSET (desc, GrB_DEFAULT, GrB_OUTP) ; + + DSET (desc, GrB_COMP , GrB_MASK_FIELD) ; + DSET (desc, GrB_STRUCTURE , GrB_MASK_FIELD) ; + DSET (desc, GrB_COMP_STRUCTURE , GrB_MASK_FIELD) ; + DSET (desc, GrB_DEFAULT , GrB_MASK_FIELD) ; + + DSET (desc, GrB_COMP , GrB_MASK) ; + DSET (desc, GrB_STRUCTURE , GrB_MASK) ; + DSET (desc, GrB_COMP_STRUCTURE , GrB_MASK) ; + DSET (desc, GrB_DEFAULT , GrB_MASK) ; + + DSET (desc, GrB_TRAN , GrB_INP0) ; + DSET (desc, GrB_DEFAULT , GrB_INP0) ; + + DSET (desc, GrB_TRAN , GrB_INP1) ; + DSET (desc, GrB_DEFAULT , GrB_INP1) ; + + DSET (desc, GxB_AxB_GUSTAVSON , GxB_AxB_METHOD) ; + DSET (desc, GxB_AxB_DOT , GxB_AxB_METHOD) ; + DSET (desc, GxB_AxB_HASH , GxB_AxB_METHOD) ; + DSET (desc, GxB_AxB_SAXPY , GxB_AxB_METHOD) ; + DSET (desc, GrB_DEFAULT , GxB_AxB_METHOD) ; + + DSET (desc, 1 , GxB_SORT) ; + DSET (desc, GrB_DEFAULT , GxB_SORT) ; + + DSET (desc, 1 , GxB_COMPRESSION) ; + DSET (desc, GrB_DEFAULT , GxB_COMPRESSION) ; + + DSET (desc, GxB_FAST_IMPORT , GxB_IMPORT) ; + DSET (desc, GxB_SECURE_IMPORT , GxB_IMPORT) ; + DSET (desc, GrB_DEFAULT , GxB_IMPORT) ; + + OK (GrB_Descriptor_get_String_ (desc, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + OK (GrB_Descriptor_set_String_ (desc, "user_name", GrB_NAME)) ; + OK (GrB_Descriptor_get_String_ (desc, name, GrB_NAME)) ; + printf ("got name: [%s]\n", name) ; + CHECK (MATCH (name, "user_name")) ; + OK (GrB_Descriptor_set_String_ (desc, "", GrB_NAME)) ; + OK (GrB_Descriptor_get_String_ (desc, name, GrB_NAME)) ; + printf ("got name: [%s]\n", name) ; + CHECK (MATCH (name, "")) ; + METHOD (GrB_Descriptor_set_String_ (desc, "yet another name", GrB_NAME)) ; + OK (GrB_Descriptor_get_String_ (desc, name, GrB_NAME)) ; + printf ("got name: [%s]\n", name) ; + CHECK (MATCH (name, "yet another name")) ; + OK (GrB_Descriptor_get_SIZE_ (desc, &size, GrB_NAME)) ; + CHECK (size == strlen (name) + 1) ; + + //-------------------------------------------------------------------------- + // error handling + //-------------------------------------------------------------------------- + + printf ("\nerror handling:\n") ; + expected = GrB_INVALID_VALUE ; + ERR (GrB_Descriptor_get_VOID_ (GrB_DESC_T1, nothing, GrB_NAME)) ; + ERR (GrB_Descriptor_set_VOID_ (desc, nothing, 0, 0)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Descriptor_get_INT32_ (GrB_DESC_T1, &i, GrB_NAME)) ; + ERR (GrB_Descriptor_set_INT32_ (GrB_DESC_T1, GrB_REPLACE, GrB_OUTP)) ; + ERR (GrB_Descriptor_set_INT32 (NULL, GrB_REPLACE, GrB_OUTP)) ; + ERR (GrB_Descriptor_get_SIZE_ (GrB_DESC_T1, &size, GrB_OUTP)) ; + ERR (GrB_Descriptor_set_Scalar_ (GrB_DESC_T1, s_int32, GrB_MASK)) ; + ERR (GrB_Descriptor_set_Scalar (NULL, s_int32, GrB_MASK)) ; + ERR (GrB_Descriptor_set_INT32_ (desc, GrB_DEFAULT, GrB_NAME)) ; + ERR (GrB_Descriptor_set_String_ (GrB_DESC_T1, "newname", GrB_NAME)) ; + + char *err ; + ERR (GrB_Descriptor_set_INT32_ (desc, 999, GrB_OUTP)) ; + OK (GrB_Descriptor_error (&err, desc)) ; + printf ("error: %s\n\n", err) ; + + ERR (GrB_Descriptor_set_INT32_ (desc, 998, GrB_MASK)) ; + OK (GrB_Descriptor_error (&err, desc)) ; + printf ("error: %s\n\n", err) ; + + ERR (GrB_Descriptor_set_INT32_ (desc, 997, GrB_INP0)) ; + OK (GrB_Descriptor_error (&err, desc)) ; + printf ("error: %s\n\n", err) ; + + ERR (GrB_Descriptor_set_INT32_ (desc, 996, GrB_INP1)) ; + OK (GrB_Descriptor_error (&err, desc)) ; + printf ("error: %s\n\n", err) ; + + ERR (GrB_Descriptor_set_INT32_ (desc, 995, GxB_AxB_METHOD)) ; + OK (GrB_Descriptor_error (&err, desc)) ; + printf ("error: %s\n\n", err) ; + + expected = GrB_EMPTY_OBJECT ; + OK (GrB_Scalar_clear (s_int32)) ; + ERR (GrB_Descriptor_set_Scalar_ (desc, s_int32, GrB_MASK)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Descriptor_set_VOID_ (desc, nothing, 0, 0)) ; + ERR (GrB_Descriptor_get_VOID_ (desc, nothing, 0)) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&A) ; + GrB_free (&v) ; + GrB_free (&s) ; + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&desc) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test34: all tests passed\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test35.c b/GraphBLAS/Test/GB_mex_test35.c new file mode 100644 index 0000000000..76ede3b340 --- /dev/null +++ b/GraphBLAS/Test/GB_mex_test35.c @@ -0,0 +1,316 @@ +//------------------------------------------------------------------------------ +// GB_mex_test35: test GrB_get for a serialized blob +//------------------------------------------------------------------------------ + +// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +//------------------------------------------------------------------------------ + +#include "GB_mex.h" +#include "GB_mex_errors.h" + +#define USAGE "GB_mex_test35" + +#define FREE_ALL ; +#define GET_DEEP_COPY ; +#define FREE_DEEP_COPY ; + +typedef struct { int32_t stuff ; } mytype ; +#define MYTYPE_DEFN \ +"typedef struct { int32_t stuff ; } mytype ;" + +void mexFunction +( + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + + //-------------------------------------------------------------------------- + // startup GraphBLAS + //-------------------------------------------------------------------------- + + GrB_Info info, expected ; + bool malloc_debug = GB_mx_get_global (true) ; + GrB_Matrix A = NULL ; + GrB_Scalar s = NULL, s_fp64 = NULL, s_int32 = NULL, s_fp32 = NULL ; + GrB_Type type = NULL ; + uint8_t stuff [256] ; + void *nothing = stuff ; + size_t size, blob_size = 0 ; + char name [256] ; + char defn [2048] ; + int32_t code, i ; + float fvalue ; + double dvalue ; + void *blob = NULL ; + + OK (GrB_Scalar_new (&s_fp64, GrB_FP64)) ; + OK (GrB_Scalar_new (&s_fp32, GrB_FP32)) ; + OK (GrB_Scalar_new (&s_int32, GrB_INT32)) ; + + //-------------------------------------------------------------------------- + // GxB_Serialized_get + //-------------------------------------------------------------------------- + + OK (GrB_Matrix_new (&A, GrB_FP32, 5, 5)) ; + OK (GrB_Matrix_setElement (A, 0, 0, 1)) ; + OK (GrB_Matrix_wait (A, GrB_MATERIALIZE)) ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + expected = GrB_INVALID_VALUE ; + ERR (GxB_Serialized_get_VOID_(blob, nothing, 0, blob_size)) ; + + OK (GxB_Serialized_get_SIZE_(blob, &size, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + OK (GxB_Serialized_get_String_(blob, name, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GxB_Serialized_get_SIZE_(blob, &size, GxB_JIT_C_NAME, blob_size)) ; + CHECK (size == strlen ("float") + 1) ; + OK (GxB_Serialized_get_String_(blob, name, GxB_JIT_C_NAME, blob_size)) ; + CHECK (MATCH (name, "float")) ; + + OK (GxB_Serialized_get_String_(blob, name, GrB_NAME, blob_size)) ; + CHECK (MATCH (name, "")) ; + + OK (GxB_Serialized_get_String_(blob, name, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + + OK (GxB_Serialized_get_SIZE_(blob, &size, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + + OK (GxB_Serialized_get_INT32_(blob, &code, GrB_EL_TYPE_CODE, blob_size)) ; + CHECK (code == GrB_FP32_CODE) ; + + i = -1 ; + OK (GxB_Serialized_get_Scalar_(blob, s_int32, GrB_EL_TYPE_CODE, blob_size)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GrB_FP32_CODE) ; + + OK (GxB_Serialized_get_INT32_(blob, &i, GrB_STORAGE_ORIENTATION_HINT, + blob_size)) ; + printf ("blob storage: %d\n", i) ; + CHECK (i == GrB_COLMAJOR) ; + + OK (GxB_Serialized_get_INT32_(blob, &i, GxB_FORMAT, blob_size)) ; + printf ("blob storage: %d\n", i) ; + CHECK (i == GxB_BY_COL) ; + + OK (GxB_Serialized_get_INT32_(blob, &i, GxB_SPARSITY_CONTROL, blob_size)) ; + printf ("blob sparsity control: %d\n", i) ; + CHECK (i == GxB_AUTO_SPARSITY) ; + + OK (GrB_assign (A, NULL, NULL, 1, GrB_ALL, 5, GrB_ALL, 5, NULL)) ; + OK (GrB_Matrix_wait (A, GrB_MATERIALIZE)) ; + + OK (GrB_Matrix_get_String_ (A, name, GxB_JIT_C_NAME)) ; + CHECK (MATCH (name, "float")) ; + + OK (GrB_Matrix_get_SIZE_(A, &size, GrB_NAME)) ; + CHECK (size == 1) ; + OK (GrB_Matrix_get_String_(A, name, GrB_NAME)) ; + CHECK (MATCH (name, "")) ; + + OK (GrB_Matrix_set_String_(A, "A matrix", GrB_NAME)) ; + OK (GrB_Matrix_get_String_(A, name, GrB_NAME)) ; + CHECK (MATCH (name, "A matrix")) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_INT32_(blob, &i, GxB_SPARSITY_STATUS, blob_size)) ; + printf ("blob sparsity status: %d\n", i) ; + CHECK (i == GxB_FULL) ; + + OK (GxB_Serialized_get_String_ (blob, name, GrB_NAME, blob_size)) ; + printf ("name: [%s]\n", name) ; + CHECK (MATCH (name, "A matrix")) ; + OK (GxB_Serialized_get_String_ (blob, &size, GrB_NAME, blob_size)) ; + CHECK (size == strlen ("A matrix") + 1) ; + + OK (GxB_Serialized_get_String_ (blob, name, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (MATCH (name, "GrB_FP32")) ; + OK (GxB_Serialized_get_String_(blob, &size, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (size == strlen ("GrB_FP32") + 1) ; + + OK (GxB_Serialized_get_String_ (blob, name, GxB_JIT_C_NAME, blob_size)) ; + CHECK (MATCH (name, "float")) ; + OK (GxB_Serialized_get_String_ (blob, &size, GxB_JIT_C_NAME, blob_size)) ; + CHECK (size == strlen ("float") + 1) ; + + expected = GrB_INVALID_VALUE ; + ERR (GxB_Serialized_get_INT32_(blob, &i, 0, blob_size)) ; + ERR (GxB_Serialized_get_SIZE_(blob, &size, 0, blob_size)) ; + + fvalue = -1 ; + OK (GxB_Serialized_get_Scalar_(blob, s_fp32, GxB_BITMAP_SWITCH, + blob_size)) ; + OK (GrB_Scalar_extractElement_FP32_(&fvalue, s_fp32)) ; + printf ("blob bitmap switch: %g\n", fvalue) ; + CHECK (abs (fvalue - 0.04) < 1e-6) ; + + OK (GrB_Matrix_set_INT32_(A, GxB_BITMAP, GxB_SPARSITY_CONTROL)) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_String_(A, name, GxB_JIT_C_NAME)) ; + + OK (GxB_Serialized_get_INT32_(blob, &i, GxB_SPARSITY_STATUS, blob_size)) ; + printf ("blob sparsity status: %d\n", i) ; + CHECK (i == GxB_BITMAP) ; + + OK (GrB_Scalar_setElement_FP32_(s_fp32, 0.25)) ; + OK (GrB_Matrix_set_Scalar_(A, s_fp32, GxB_HYPER_SWITCH)) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_Scalar_(blob, s_fp64, GxB_HYPER_SWITCH, blob_size)) ; + OK (GrB_Scalar_extractElement_FP64_(&dvalue, s_fp64)) ; + printf ("blob hyper switch: %g\n", dvalue) ; + CHECK (abs (dvalue - 0.25) < 1e-6) ; + + OK (GrB_Matrix_set_INT32_(A, GrB_ROWMAJOR, GrB_STORAGE_ORIENTATION_HINT)) ; + OK (GrB_Matrix_get_INT32_(A, &i, GrB_STORAGE_ORIENTATION_HINT)) ; + CHECK (i == GrB_ROWMAJOR) ; + OK (GrB_Matrix_get_INT32_(A, &i, GxB_FORMAT)) ; + CHECK (i == GxB_BY_ROW) ; + // GxB_print (A, 3) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_INT32_(blob, &i, GrB_STORAGE_ORIENTATION_HINT, + blob_size)) ; + CHECK (i == GrB_ROWMAJOR) ; + OK (GxB_Serialized_get_INT32_(blob, &i, GxB_FORMAT, blob_size)) ; + CHECK (i == GxB_BY_ROW) ; + // GxB_print (A, 3) ; + + expected = GrB_INVALID_VALUE ; + ERR (GrB_Matrix_get_String_(A, defn, 999)) ; + ERR (GrB_Matrix_get_Scalar(A, s_int32, 999)) ; + + OK (GrB_Matrix_get_SIZE_(A, &size, GrB_NAME)) ; + CHECK (size == strlen ("A matrix") + 1) ; + + expected = GrB_INVALID_OBJECT ; + uint8_t *b = (uint8_t *) blob ; + ERR (GxB_Serialized_get_INT32_(blob, &i, GxB_FORMAT, 20)) ; + b [0]++ ; + ERR (GxB_Serialized_get_INT32_(blob, &i, GxB_FORMAT, blob_size)) ; + b [0]-- ; + OK (GxB_Serialized_get_INT32_(blob, &i, GxB_FORMAT, blob_size)) ; + CHECK (i == GxB_BY_ROW) ; + + OK (GxB_Serialized_get_Scalar_(blob, s_int32, GrB_STORAGE_ORIENTATION_HINT, + blob_size)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GrB_ROWMAJOR) ; + + OK (GxB_Serialized_get_Scalar_(blob, s_int32, GxB_FORMAT, blob_size)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GxB_BY_ROW) ; + + OK (GxB_Serialized_get_Scalar_(blob, s_int32, GxB_SPARSITY_CONTROL, + blob_size)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GxB_BITMAP) ; + + OK (GxB_Serialized_get_Scalar_(blob, s_int32, GxB_SPARSITY_STATUS, + blob_size)) ; + OK (GrB_Scalar_extractElement_INT32_(&i, s_int32)) ; + CHECK (i == GxB_BITMAP) ; + + expected = GrB_INVALID_VALUE ; + ERR (GxB_Serialized_get_Scalar_(blob, s_int32, GrB_NAME, blob_size)) ; + ERR (GxB_Serialized_get_Scalar_(blob, name, 9999, blob_size)) ; + + OK (GrB_Type_new (&type, sizeof (mytype))) ; + OK (GrB_Type_set_String_ (type, "mytype", GxB_JIT_C_NAME)) ; + OK (GrB_Type_set_String_ (type, MYTYPE_DEFN, GxB_JIT_C_DEFINITION)) ; + GrB_free (&A) ; + + int32_t one = 1 ; + OK (GrB_Matrix_new (&A, type, 5, 5)) ; + OK (GrB_Matrix_setElement (A, (void *) &one, 0, 0)) ; + OK (GrB_Matrix_wait (A, GrB_MATERIALIZE)) ; + OK (GxB_print (A, 3)) ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_String_(blob, name, GrB_NAME, blob_size)) ; + CHECK (MATCH (name, "")) ; + + OK (GxB_Serialized_get_String_(blob, name, GxB_JIT_C_NAME, blob_size)) ; + CHECK (MATCH (name, "mytype")) ; + + OK (GxB_Serialized_get_String_(blob, name, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (MATCH (name, "")) ; + + GrB_free (&A) ; + GrB_free (&type) ; + OK (GrB_Type_new (&type, sizeof (mytype))) ; + OK (GrB_Matrix_new (&A, type, 50, 50)) ; + OK (GrB_Matrix_setElement (A, (void *) &one, 0, 0)) ; + OK (GrB_Matrix_wait (A, GrB_MATERIALIZE)) ; + OK (GrB_Matrix_set_INT32_(A, GxB_HYPERSPARSE, GxB_SPARSITY_CONTROL)) ; + + OK (GrB_Matrix_set_String_(A, "A hyper", GrB_NAME)) ; + OK (GrB_Matrix_get_String_(A, name, GrB_NAME)) ; + printf ("name [%s]\n", name) ; + CHECK (MATCH (name, "A hyper")) ; + GxB_print (A, 3) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_String_(blob, name, GxB_JIT_C_NAME, blob_size)) ; + CHECK (MATCH (name, "")) ; + OK (GxB_Serialized_get_String_(blob, name, GrB_NAME, blob_size)) ; + printf ("name [%s]\n", name) ; + CHECK (MATCH (name, "A hyper")) ; + + OK (GrB_Type_set_String_ (type, "mytype", GxB_JIT_C_NAME)) ; + OK (GrB_Type_set_String_ (type, "my type", GrB_NAME)) ; + + // free the blob and recreate it + mxFree (blob) ; blob = NULL ; blob_size = 0 ; + OK (GxB_Matrix_serialize (&blob, &blob_size, A, NULL)) ; + + OK (GxB_Serialized_get_String_(blob, name, GxB_JIT_C_NAME, blob_size)) ; + CHECK (MATCH (name, "mytype")) ; + OK (GxB_Serialized_get_String_(blob, name, GrB_EL_TYPE_STRING, blob_size)) ; + CHECK (MATCH (name, "my type")) ; + OK (GxB_Serialized_get_String_(blob, name, GrB_NAME, blob_size)) ; + printf ("name [%s]\n", name) ; + CHECK (MATCH (name, "A hyper")) ; + + //-------------------------------------------------------------------------- + // finalize GraphBLAS + //-------------------------------------------------------------------------- + + GrB_free (&A) ; + GrB_free (&s) ; + GrB_free (&s_fp64) ; + GrB_free (&s_fp32) ; + GrB_free (&s_int32) ; + GrB_free (&type) ; + if (blob != NULL) mxFree (blob) ; + GB_mx_put_global (true) ; + printf ("\nGB_mex_test35: all tests passed.\n\n") ; +} + diff --git a/GraphBLAS/Test/GB_mex_test5.c b/GraphBLAS/Test/GB_mex_test5.c index a794b031ce..7d48a17de0 100644 --- a/GraphBLAS/Test/GB_mex_test5.c +++ b/GraphBLAS/Test/GB_mex_test5.c @@ -547,20 +547,12 @@ void mexFunction OK (GrB_IndexUnaryOp_wait_ (Banded, GrB_MATERIALIZE)) ; OK (GxB_IndexUnaryOp_fprint (Banded, "banded", 3, NULL)) ; -// #undef GrB_IndexUnaryOp_new -// #undef GrM_IndexUnaryOp_new -// OK (GRB (IndexUnaryOp_new) (&UpperBanded, -// (GxB_index_unary_function) upperbanded_idx, -// GrB_BOOL, GrB_INT64, GrB_INT64)) ; OK (GxB_IndexUnaryOp_new (&UpperBanded, (GxB_index_unary_function) upperbanded_idx, GrB_BOOL, GrB_INT64, GrB_INT64, "upperbanded_idx", UPPERBANDED_IDX_DEFN)) ; OK (GxB_IndexUnaryOp_fprint (UpperBanded, "upperbanded", 3, NULL)) ; -// OK (GRB (IndexUnaryOp_new) (&UpperBanded_int64, -// (GxB_index_unary_function) upperbanded_idx_int64, -// GrB_INT64, GrB_INT64, GrB_INT64)) ; OK (GxB_IndexUnaryOp_new (&UpperBanded_int64, (GxB_index_unary_function) upperbanded_idx_int64, GrB_INT64, GrB_INT64, GrB_INT64, @@ -1240,7 +1232,7 @@ void mexFunction expected = GrB_DOMAIN_MISMATCH ; printf ("(1)------------------------------------------------\n") ; - OK (GRB (IndexUnaryOp_new) (&Gunk, + OK (GrB_IndexUnaryOp_new (&Gunk, (GxB_index_unary_function) donothing, MyType, MyType, MyType)) ; ERR (GrB_Matrix_select_Scalar (A, NULL, NULL, Gunk, A, scalar, NULL)) ; OK (GrB_Matrix_error_ (&err, A)) ; @@ -1248,7 +1240,7 @@ void mexFunction OK (GrB_IndexUnaryOp_free_ (&Gunk)) ; printf ("(2)------------------------------------------------\n") ; - OK (GRB (IndexUnaryOp_new) (&Gunk, + OK (GrB_IndexUnaryOp_new (&Gunk, (GxB_index_unary_function) donothing, GrB_BOOL, MyType, MyType)) ; ERR (GrB_Matrix_select_Scalar (A, NULL, NULL, Gunk, A, scalar, NULL)) ; OK (GrB_Matrix_error_ (&err, A)) ; @@ -1256,7 +1248,7 @@ void mexFunction OK (GrB_IndexUnaryOp_free_ (&Gunk)) ; printf ("(3)------------------------------------------------\n") ; - OK (GRB (IndexUnaryOp_new) (&Gunk, + OK (GrB_IndexUnaryOp_new (&Gunk, (GxB_index_unary_function) donothing, GrB_BOOL, GrB_FP64, MyType)) ; ERR (GrB_Matrix_select_Scalar (A, NULL, NULL, Gunk, A, scalar, NULL)) ; OK (GrB_Matrix_error_ (&err, A)) ; @@ -1264,7 +1256,7 @@ void mexFunction OK (GrB_IndexUnaryOp_free_ (&Gunk)) ; printf ("(4)------------------------------------------------\n") ; - OK (GRB (IndexUnaryOp_new) (&Gunk, + OK (GrB_IndexUnaryOp_new (&Gunk, (GxB_index_unary_function) donothing, MyType, GrB_FP64, GrB_FP64)) ; ERR (GrB_Matrix_select_Scalar (A, NULL, NULL, Gunk, A, scalar, NULL)) ; OK (GrB_Matrix_error_ (&err, A)) ; diff --git a/GraphBLAS/Test/GB_mex_test7.c b/GraphBLAS/Test/GB_mex_test7.c index c9340ffe46..cffd16f7aa 100644 --- a/GraphBLAS/Test/GB_mex_test7.c +++ b/GraphBLAS/Test/GB_mex_test7.c @@ -29,6 +29,7 @@ void mexFunction GrB_Info info ; GrB_Matrix A = NULL, B = NULL, Y_mangled = NULL, Y = NULL, C1 = NULL, C2 = NULL ; + GrB_Scalar s = NULL ; //-------------------------------------------------------------------------- // startup GraphBLAS @@ -41,6 +42,15 @@ void mexFunction // matrix check //-------------------------------------------------------------------------- + OK (GrB_Scalar_new (&s, GrB_INT64)) ; + OK (GrB_Scalar_setElement_INT64 (s, 0)) ; + OK (GrB_Global_set_Scalar (GrB_GLOBAL, s, GxB_HYPER_HASH)) ; + OK (GrB_Scalar_clear (s)) ; + OK (GrB_Global_get_Scalar (GrB_GLOBAL, s, GxB_HYPER_HASH)) ; + int64_t i = 1 ; + OK (GrB_Scalar_extractElement_INT64 (&i, s)) ; + CHECK (i == 0) ; + OK (GrB_Matrix_new (&A, GrB_FP64, 100, 100)) ; OK (GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, GxB_HYPERSPARSE)) ; OK (GrB_Matrix_setElement_FP64 (A, (double) 1.2, 0, 0)) ; @@ -286,6 +296,13 @@ void mexFunction // wrapup //-------------------------------------------------------------------------- + OK (GrB_Scalar_setElement_INT64 (s, 1024)) ; + OK (GrB_Global_set_Scalar (GrB_GLOBAL, s, GxB_HYPER_HASH)) ; + OK (GrB_Scalar_clear (s)) ; + OK (GrB_Global_get_Scalar (GrB_GLOBAL, s, GxB_HYPER_HASH)) ; + OK (GrB_Scalar_extractElement_INT64 (&i, s)) ; + CHECK (i == 1024) ; + OK (GrB_Scalar_free (&s)) ; GB_mx_put_global (true) ; printf ("\nGB_mex_test7: all tests passed\n\n") ; } diff --git a/GraphBLAS/Test/GB_mx_get_global.c b/GraphBLAS/Test/GB_mx_get_global.c index 374bab5a97..2293698d51 100644 --- a/GraphBLAS/Test/GB_mx_get_global.c +++ b/GraphBLAS/Test/GB_mx_get_global.c @@ -162,6 +162,16 @@ bool GB_mx_get_global // true if doing malloc_debug Complex_init (builtin_complex [0]) ; + //-------------------------------------------------------------------------- + // set the hyper_hash control to a small value + //-------------------------------------------------------------------------- + + GrB_Scalar s ; + GrB_Scalar_new (&s, GrB_INT64) ; + GrB_Scalar_setElement_INT64 (s, 8) ; + GrB_Global_set_Scalar (GrB_GLOBAL, s, GxB_HYPER_HASH) ; + GrB_Scalar_free (&s) ; + //-------------------------------------------------------------------------- // return malloc debug status //-------------------------------------------------------------------------- diff --git a/GraphBLAS/Test/GB_spec_op.m b/GraphBLAS/Test/GB_spec_op.m index 8e31058d65..52b3f07dc3 100644 --- a/GraphBLAS/Test/GB_spec_op.m +++ b/GraphBLAS/Test/GB_spec_op.m @@ -222,20 +222,20 @@ z = pow2 (x,y) ; case { 'fmod', 'rem' } - % see ANSI C11 fmod function - % the built-in rem differs slightly from the ANSI C11 fmod, + % see C11 fmod function + % the built-in rem differs slightly from the C11 fmod, % if x/y is O(eps) smaller than an integer. z = rem (x,y) ; case { 'remainder' } - % see ANSI C11 remainder function + % see C11 remainder function m = (y ~= 0 & x ~= y) ; z = nan (size (x), ztype) ; z (x == y) = 0 ; z (m) = x (m) - round (x (m) ./ y (m)) .* y (m) ; case { 'copysign' } - % see ANSI C11 copysign function + % see C11 copysign function z = abs (x) .* (2 * double (y >= 0) - 1) ; case { 'complex', 'cmplx' } diff --git a/GraphBLAS/Test/README.txt b/GraphBLAS/Test/README.txt index e633aa6fdb..9fa56d5242 100644 --- a/GraphBLAS/Test/README.txt +++ b/GraphBLAS/Test/README.txt @@ -15,8 +15,8 @@ files to provide 'help GB_mex...' documentation. For a usable @GrB interface to GraphBLAS, see the GraphBLAS/GraphBLAS folder, and the @GrB object it supports. -Requirements: the mex command must use a C compiler supporting ANSI C11. -Microft Visual Studio does not support ANSI C11 so this test is not available +Requirements: the mex command must use a C compiler supporting C11. +Microft Visual Studio does not support C11 so this test is not available on Windows unless you use another compiler. To run the tests, use the following command in this directory, in the diff --git a/GraphBLAS/Test/logstat.m b/GraphBLAS/Test/logstat.m index 73c0b1043f..111e7898e5 100644 --- a/GraphBLAS/Test/logstat.m +++ b/GraphBLAS/Test/logstat.m @@ -142,8 +142,13 @@ function logstat (testscript, threads, jit_controls, factory_controls) fprintf (f, '%s %-11s %7.1f sec ', s, testscript, t) ; if (~isempty (strfind (pwd, 'Tcov'))) - global GraphBLAS_debug GraphBLAS_grbcov - save grbstat GraphBLAS_debug GraphBLAS_grbcov testscript + global GraphBLAS_debug GraphBLAS_grbcov GraphBLAS_grbcovs ... + GraphBLAS_scripts GraphBLAS_times + GraphBLAS_grbcovs {end+1} = GraphBLAS_grbcov (1:n) ; + GraphBLAS_scripts {end+1} = testscript ; + GraphBLAS_times {end+1} = t ; + save grbstat GraphBLAS_debug GraphBLAS_grbcov GraphBLAS_grbcovs ... + GraphBLAS_scripts GraphBLAS_times if (isempty (GraphBLAS_debug)) GraphBLAS_debug = false ; end diff --git a/GraphBLAS/Test/make.m b/GraphBLAS/Test/make.m index 63e4af6d52..99e1750314 100644 --- a/GraphBLAS/Test/make.m +++ b/GraphBLAS/Test/make.m @@ -11,7 +11,7 @@ function make (what) % % in -lgraphblas, use 'make all' if recompilation is needed % make all % make everything from scratch % -% GraphBLAS requires an ANSI C11 compliant compiler. On the Mac, clang 8.0 +% GraphBLAS requires an C11 compliant compiler. On the Mac, clang 8.0 % suffices. gcc should be version 4.9.3 or later % SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. diff --git a/GraphBLAS/Test/test269.m b/GraphBLAS/Test/test269.m new file mode 100644 index 0000000000..7499482c72 --- /dev/null +++ b/GraphBLAS/Test/test269.m @@ -0,0 +1,10 @@ +function test269 +%TEST269 test GrB_get / GrB_set for types, scalars, vectors, and matrices + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test26 ; +fprintf ('test269: all tests passed.\n') ; + + diff --git a/GraphBLAS/Test/test270.m b/GraphBLAS/Test/test270.m new file mode 100644 index 0000000000..ef47b3e291 --- /dev/null +++ b/GraphBLAS/Test/test270.m @@ -0,0 +1,10 @@ +function test270 +%TEST270 test GrB_get / GrB_set for unary ops + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test27 ; +fprintf ('test270: all tests passed.\n') ; + + diff --git a/GraphBLAS/Test/test271.m b/GraphBLAS/Test/test271.m new file mode 100644 index 0000000000..d894881954 --- /dev/null +++ b/GraphBLAS/Test/test271.m @@ -0,0 +1,10 @@ +function test271 +%TEST271 test GrB_get / GrB_set for binary ops + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test28 ; +fprintf ('test271: all tests passed.\n') ; + + diff --git a/GraphBLAS/Test/test273.m b/GraphBLAS/Test/test273.m new file mode 100644 index 0000000000..d6ab27b54d --- /dev/null +++ b/GraphBLAS/Test/test273.m @@ -0,0 +1,9 @@ +function test273 +%TEST273 test Global get/set + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test29 ; +fprintf ('test273 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/test274.m b/GraphBLAS/Test/test274.m new file mode 100644 index 0000000000..0e6ea92271 --- /dev/null +++ b/GraphBLAS/Test/test274.m @@ -0,0 +1,9 @@ +function test274 +%TEST274 test get/set for IndexUnary ops + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test30 ; +fprintf ('test274 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/test275.m b/GraphBLAS/Test/test275.m new file mode 100644 index 0000000000..b6238edafb --- /dev/null +++ b/GraphBLAS/Test/test275.m @@ -0,0 +1,9 @@ +function test275 +%TEST275 test get/set for monoids + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test31 ; +fprintf ('test275 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/test276.m b/GraphBLAS/Test/test276.m new file mode 100644 index 0000000000..832a5c1794 --- /dev/null +++ b/GraphBLAS/Test/test276.m @@ -0,0 +1,9 @@ +function test276 +%TEST276 test get/set for semirings + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test32 ; +fprintf ('test276 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/test277.m b/GraphBLAS/Test/test277.m new file mode 100644 index 0000000000..c84d58d820 --- /dev/null +++ b/GraphBLAS/Test/test277.m @@ -0,0 +1,9 @@ +function test277 +%TEST277 test get/set for context + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test33 ; +fprintf ('test277 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/test278.m b/GraphBLAS/Test/test278.m new file mode 100644 index 0000000000..b594294c13 --- /dev/null +++ b/GraphBLAS/Test/test278.m @@ -0,0 +1,9 @@ +function test278 +%TEST278 test get/set for descriptor + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test34 ; +fprintf ('test278 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/test279.m b/GraphBLAS/Test/test279.m new file mode 100644 index 0000000000..cb5a68c705 --- /dev/null +++ b/GraphBLAS/Test/test279.m @@ -0,0 +1,9 @@ +function test279 +%TEST279 test get/set for serialized blob + +% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +% SPDX-License-Identifier: Apache-2.0 + +GB_mex_test35 ; +fprintf ('test279 all tests passed.\n') ; + diff --git a/GraphBLAS/Test/testall.m b/GraphBLAS/Test/testall.m index db7e9fe704..17204c2a56 100644 --- a/GraphBLAS/Test/testall.m +++ b/GraphBLAS/Test/testall.m @@ -74,12 +74,15 @@ function testall (threads,longtests) f00 = {0,0} ; % factory off, off % run twice +j04 = {0,4} ; % JIT off, off j40 = {4,0} ; % JIT on, off f11 = {1,1} ; % factory on, on j4040 = {4,0,4,0} ; % JIT on, off, on , off f1100 = {1,1,0,0} ; % factory on, on , off, off +j040 = {0,4,0} ; % JIT off, on , off + j440 = {4,4,0} ; % JIT on, on , off f100 = {1,0,0} ; % factory on, off, off @@ -96,7 +99,18 @@ function testall (threads,longtests) % tests with high rates (over 100/sec) %---------------------------------------- -logstat ('test272' ,t, j0 , f1 ) ; % Context +logstat ('test250' ,t, j44 , f10 ) ; % JIT tests, set/get, other tests +logstat ('test279' ,t, j0 , f1 ) ; % blob get/set +logstat ('test278' ,t, j0 , f1 ) ; % descriptor get/set +logstat ('test277' ,t, j0 , f1 ) ; % context get/set +logstat ('test276' ,t, j0 , f1 ) ; % semiring get/set +logstat ('test275' ,t, j0 , f1 ) ; % monoid get/set +logstat ('test274' ,t, j0 , f1 ) ; % index unary op get/set +logstat ('test273' ,t, j0 , f1 ) ; % global get/set +logstat ('test272' ,t, j0 , f1 ) ; % misc simple tests +logstat ('test271' ,t, j0 , f1 ) ; % binary op get/set +logstat ('test270' ,t, j0 , f1 ) ; % unary op get/set +logstat ('test269' ,t, j0 , f1 ) ; % get/set for type, scalar, vec, mtx logstat ('test268' ,t, j4 , f1 ) ; % C=Z sparse masker jall = {4,3,2,1,4,2} ; fall = {1,1,1,1,0,0} ; @@ -112,7 +126,6 @@ function testall (threads,longtests) hack (2) = 0 ; GB_mex_hack (hack) ; % re-enable the Werk stack logstat ('test267' ,t, j40 , f00 ) ; % JIT error handling -logstat ('test266' ,t, j4 , f0 ) ; % JIT error handling logstat ('test265' ,t, j4 , f0 ) ; % reduce to scalar with user types logstat ('test264' ,t, j4 , f0 ) ; % enumify / macrofy tests logstat ('test263' ,t, j4 , f0 ) ; % JIT tests @@ -126,13 +139,14 @@ function testall (threads,longtests) logstat ('test254' ,t, j440, f100) ; %% mask types logstat ('test253' ,t, j4 , f1 ) ; % basic JIT tests logstat ('test252' ,t, j4 , f1 ) ; % basic tests -logstat ('test251' ,t, j404, f110) ; % dot4, dot2, with plus_pair -logstat ('test250' ,t, j44 , f10 ) ; % JIT tests, set/get, other tests +%ogstat ('test251' ,t, j404, f110) ; % dot4, dot2, with plus_pair +logstat ('test251' ,t, j44 , f10 ) ; % dot4, dot2, with plus_pair logstat ('test249' ,t, j4 , f1 ) ; % GxB_Context object logstat ('test247' ,t, j4 , f1 ) ; % GrB_mxm: fine Hash method logstat ('test246' ,t, j4 , f1 ) ; % GrB_mxm parallelism (slice_balanced) -logstat ('test01' ,t, j44 , f10 ) ; % error handling +%ogstat ('test01' ,t, j44 , f10 ) ; % error handling +logstat ('test01' ,t, j4 , f1 ) ; % error handling logstat ('test245' ,t, j40 , f11 ) ; % test complex row/col scale logstat ('test199' ,t, j4 , f1 ) ; % test dot2 with hypersparse logstat ('test83' ,t, j4 , f1 ) ; % GrB_assign with C_replace and empty J @@ -151,7 +165,8 @@ function testall (threads,longtests) logstat ('test256' ,t, j4 , f0 ) ; % JIT error handling logstat ('test186' ,t, j40 , f11 ) ; % saxpy, all formats (slice_balanced) logstat ('test186(0)' ,t, j4 , f1 ) ; % repeat with default slice_balanced -logstat ('test150' ,t, j40 , f10 ) ; %% mxm zombies, typecasting (dot3,saxpy) +%ogstat ('test150' ,t, j40 , f10 ) ; %% mxm zombies, typecasting (dot3,saxpy) +logstat ('test150' ,t, j0 , f0 ) ; %% mxm zombies, typecasting (dot3,saxpy) hack (2) = 0 ; GB_mex_hack (hack) ; % re-enable the Werk stack @@ -165,7 +180,7 @@ function testall (threads,longtests) logstat ('test179' ,t, j44 , f10 ) ; % test bitmap select logstat ('test174' ,t, j4 , f1 ) ; % test GrB_assign C=A logstat ('test155' ,t, j4 , f1 ) ; % test GrB_*_setElement, removeElement -logstat ('test156' ,t, j44 , f10 ) ; % test GrB_assign C=A with typecasting +%ogstat ('test156' ,t, j44 , f10 ) ; % test GrB_assign C=A with typecasting logstat ('test136' ,s, j4 , f1 ) ; % subassignment special cases logstat ('test02' ,t, j4 , f1 ) ; % matrix copy and dup tests logstat ('test109' ,t, j404, f110) ; % terminal monoid with user-defined type @@ -173,10 +188,12 @@ function testall (threads,longtests) logstat ('test207' ,t, j4 , f1 ) ; % test iso subref logstat ('test221' ,t, j4 , f1 ) ; % test C += A, C is bitmap and A is full logstat ('test162' ,t, j4 , f1 ) ; % test C=A*B with very sparse M -logstat ('test159' ,t, j40 , f10 ) ; %% test A*B +%ogstat ('test159' ,t, j40 , f10 ) ; %% test A*B +logstat ('test159' ,t, j0 , f0 ) ; %% test A*B logstat ('test09' ,t, j4 , f1 ) ; % duplicate I,J test of GB_mex_subassign logstat ('test132' ,t, j4 , f1 ) ; % setElement -logstat ('test141' ,t, j404, f110) ; % eWiseAdd with dense matrices +%ogstat ('test141' ,t, j404, f110) ; % eWiseAdd with dense matrices +logstat ('test141' ,t, j0 , f1 ) ; % eWiseAdd with dense matrices logstat ('testc2(1,1)',t, j44 , f10 ) ; % complex tests (quick case, builtin) logstat ('test214' ,t, j4 , f1 ) ; % test C=A'*B (tricount) logstat ('test213' ,t, j4 , f1 ) ; % test iso assign (method 05d) @@ -198,8 +215,10 @@ function testall (threads,longtests) hack (2) = 1 ; GB_mex_hack (hack) ; % disable the Werk stack -logstat ('test14' ,t, j404, f110) ; % GrB_reduce +%ogstat ('test14' ,t, j404, f110) ; % GrB_reduce +logstat ('test14' ,t, j44 , f10 ) ; % GrB_reduce logstat ('test180' ,s, j4 , f1 ) ; % test assign and subassign (1 thread) +%ogstat ('test180' ,t, j4 , f1 ) ; % test assign and subassign (4 threads) logstat ('test236' ,t, j4 , f1 ) ; % test GxB_Matrix_sort, GxB_Vector_sort hack (2) = 0 ; GB_mex_hack (hack) ; % re-enable the Werk stack @@ -219,7 +238,8 @@ function testall (threads,longtests) logstat ('test154' ,t, j40 , f11 ) ; % apply with binop and scalar binding logstat ('test238' ,t, j44 , f10 ) ; % test GrB_mxm (dot4 and dot2) -logstat ('test151b' ,t, j404, f110) ; % test bshift operator +%ogstat ('test151b' ,t, j404, f110) ; % test bshift operator +logstat ('test151b' ,t, j4 , f1 ) ; % test bshift operator logstat ('test184' ,t, j4 , f1 ) ; % special cases: mxm, transpose, build logstat ('test191' ,t, j40 , f10 ) ; %% test split logstat ('test188' ,t, j40 , f11 ) ; % test concat @@ -262,7 +282,8 @@ function testall (threads,longtests) logstat ('test176' ,t, j4 , f1 ) ; % test GrB_assign, method 09, 11 logstat ('test208' ,t, j4 , f1 ) ; % test iso apply, bind 1st and 2nd logstat ('test216' ,t, j4 , f1 ) ; % test C=A, iso case -logstat ('test142' ,t, j4040, f1100) ; %% test GrB_assign with accum +%ogstat ('test142' ,t, j4040, f1100) ; %% test GrB_assign with accum +logstat ('test142' ,t, j040, f100) ; %% test GrB_assign with accum logstat ('test137' ,s, j40 , f11 ) ; % GrB_eWiseMult, FIRST and SECOND logstat ('test139' ,s, j4 , f1 ) ; % merge sort, special cases logstat ('test172' ,t, j4 , f1 ) ; % test eWiseMult with M bitmap/full @@ -296,20 +317,24 @@ function testall (threads,longtests) logstat ('test200' ,t, j4 , f1 ) ; % test iso full matrix multiply logstat ('test197' ,t, j4 , f1 ) ; % test large sparse split logstat ('test84' ,t, j4 , f1 ) ; % GrB_assign (row/col with C CSR/CSC) -logstat ('test19b' ,t, j4 , f1 ) ; % GrB_assign, many pending operators +%ogstat ('test19b' ,t, j4 , f1 ) ; % GrB_assign, many pending operators logstat ('test19b' ,s, j4 , f1 ) ; % GrB_assign, many pending operators logstat ('test133' ,t, j4 , f1 ) ; % test mask operations (GB_masker) logstat ('test80' ,t, j4 , f1 ) ; % test GrB_mxm on all semirings -logstat ('test151' ,t, j44 , f10 ) ; % test bitwise operators -logstat ('test23' ,t, j40 , f11 ) ; % quick test of GB_*_build +%ogstat ('test151' ,t, j44 , f10 ) ; % test bitwise operators +%ogstat ('test23' ,t, j40 , f11 ) ; % quick test of GB_*_build +logstat ('test23' ,t, j0 , f1 ) ; % quick test of GB_*_build logstat ('test135' ,t, j4 , f1 ) ; % reduce to scalar -logstat ('test160' ,s, j40 , f11 ) ; % test A*B, single threaded +%ogstat ('test160' ,s, j40 , f11 ) ; % test A*B, single threaded +logstat ('test160' ,s, j0 , f1 ) ; % test A*B, single threaded logstat ('test54' ,t, j4 , f1 ) ; % assign and extract with begin:inc:end logstat ('test129' ,t, j4 , f1 ) ; % test GxB_select (tril, nonz, hyper) logstat ('test69' ,t, j4 , f1 ) ; % assign and subassign with alias logstat ('test230' ,t, j4 , f1 ) ; % test apply with idxunops -logstat ('test74' ,t, j40 , f11 ) ; % test GrB_mxm on all semirings -logstat ('test127' ,t, j404, f110) ; % test eWiseAdd, eWiseMult +%ogstat ('test74' ,t, j40 , f11 ) ; % test GrB_mxm on all semirings +logstat ('test74' ,t, j0 , f1 ) ; % test GrB_mxm on all semirings +%ogstat ('test127' ,t, j40 , f11 ) ; % test eWiseAdd, eWiseMult +logstat ('test127' ,t, j0 , f1 ) ; % test eWiseAdd, eWiseMult logstat ('test19' ,t, j4 , f1 ) ; % GxB_subassign, many pending operators %---------------------------------------- @@ -319,12 +344,15 @@ function testall (threads,longtests) logstat ('test11' ,t, j4 , f1 ) ; % exhaustive test of GrB_extractTuples logstat ('test215' ,t, j4 , f1 ) ; % test C=A'*B (dot2, ANY_PAIR) logstat ('test193' ,t, j4 , f1 ) ; % test GxB_Matrix_diag +%ogstat ('test195' ,t, j0 , f1 ) ; % all variants of saxpy3 slice_balanced logstat ('test195' ,t, j4 , f1 ) ; % all variants of saxpy3 slice_balanced -% logstat ('test233' ,t, j4 , f1 ) ; % bitmap saxpy C=A*B, A sparse, B bitmap +%ogstat ('test233' ,t, j4 , f1 ) ; % bitmap saxpy C=A*B, A sparse, B bitmap logstat ('test243' ,t, j4 , f1 ) ; % test GxB_Vector_Iterator -logstat ('test29' ,t, j40 , f11 ) ; % reduce with zombies +%ogstat ('test29' ,t, j40 , f11 ) ; % reduce with zombies +logstat ('test29' ,t, j0 , f1 ) ; % reduce with zombies -logstat ('testc2(0,0)',t, j404, f110) ; % A'*B, A+B, A*B, user-defined complex +%ogstat ('testc2(0,0)',t, j404, f110) ; % A'*B, A+B, A*B, user-defined complex +logstat ('testc2(0,0)',t, j04, f10 ) ; % A'*B, A+B, A*B, user-defined complex logstat ('testc4(0)' ,t, j4 , f1 ) ; % extractElement, setElement, user type logstat ('testc7(0)' ,t, j4 , f1 ) ; % assign, builtin complex logstat ('testcc(1)' ,t, j4 , f1 ) ; % transpose, builtin complex @@ -340,6 +368,7 @@ function testall (threads,longtests) logstat ('test53' ,t, j4 , f1 ) ; % quick test of GB_mex_Matrix_extract logstat ('test17' ,t, j4 , f1 ) ; % quick test of GrB_*_extractElement +%ogstat ('test231' ,t, j0 , f1 ) ; % test GrB_select with idxunp logstat ('test231' ,t, j4 , f1 ) ; % test GrB_select with idxunp %---------------------------------------- diff --git a/GraphBLAS/Test/GB_mex_test23.c b/GraphBLAS/Test/unused/GB_mex_test23.c similarity index 100% rename from GraphBLAS/Test/GB_mex_test23.c rename to GraphBLAS/Test/unused/GB_mex_test23.c diff --git a/GraphBLAS/Test/test151.m b/GraphBLAS/Test/unused/test151.m similarity index 100% rename from GraphBLAS/Test/test151.m rename to GraphBLAS/Test/unused/test151.m diff --git a/GraphBLAS/Test/test156.m b/GraphBLAS/Test/unused/test156.m similarity index 100% rename from GraphBLAS/Test/test156.m rename to GraphBLAS/Test/unused/test156.m diff --git a/GraphBLAS/Test/test233.m b/GraphBLAS/Test/unused/test233.m similarity index 100% rename from GraphBLAS/Test/test233.m rename to GraphBLAS/Test/unused/test233.m diff --git a/GraphBLAS/Test/test266.m b/GraphBLAS/Test/unused/test266.m similarity index 100% rename from GraphBLAS/Test/test266.m rename to GraphBLAS/Test/unused/test266.m diff --git a/GraphBLAS/Test/test_assign.m b/GraphBLAS/Test/unused/test_assign.m similarity index 100% rename from GraphBLAS/Test/test_assign.m rename to GraphBLAS/Test/unused/test_assign.m diff --git a/GraphBLAS/cmake_modules/GraphBLAS_JIT_configure.cmake b/GraphBLAS/cmake_modules/GraphBLAS_JIT_configure.cmake index e828f81b32..db377d925e 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_JIT_configure.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_JIT_configure.cmake @@ -2,7 +2,7 @@ # GraphBLAS/GraphBLAS_JIT_configure.cmake: configure the JIT #------------------------------------------------------------------------------- -# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. #------------------------------------------------------------------------------- diff --git a/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake b/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake index 2048bcda52..a132e22c2e 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake @@ -2,7 +2,7 @@ # GraphBLAS/GraphBLAS_JIT_paths.cmake: configure the JIT paths #------------------------------------------------------------------------------- -# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. #------------------------------------------------------------------------------- diff --git a/GraphBLAS/cmake_modules/GraphBLAS_PreJIT.cmake b/GraphBLAS/cmake_modules/GraphBLAS_PreJIT.cmake index 95c6c99f2f..ffc8aa851b 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_PreJIT.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_PreJIT.cmake @@ -2,7 +2,7 @@ # GraphBLAS/GraphBLAS_PreJIT.cmake: configure the PreJIT #------------------------------------------------------------------------------- -# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. #------------------------------------------------------------------------------- diff --git a/GraphBLAS/cmake_modules/GraphBLAS_compiler_options.cmake b/GraphBLAS/cmake_modules/GraphBLAS_compiler_options.cmake index 460472e4f2..af5634683c 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_compiler_options.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_compiler_options.cmake @@ -2,7 +2,7 @@ # GraphBLAS/cmake_modules/GraphBLAS_compiler_options.cmake #------------------------------------------------------------------------------- -# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 #------------------------------------------------------------------------------- diff --git a/GraphBLAS/cmake_modules/GraphBLAS_version.cmake b/GraphBLAS/cmake_modules/GraphBLAS_version.cmake index 180c095b58..b3235ff141 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_version.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_version.cmake @@ -2,21 +2,21 @@ # GraphBLAS/cmake_modules/GraphBLAS_version.cmake: define the GraphBLAS version #------------------------------------------------------------------------------- -# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. +# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024, All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 #------------------------------------------------------------------------------- # version of SuiteSparse:GraphBLAS -set ( GraphBLAS_DATE "Dec 30, 2023" ) -set ( GraphBLAS_VERSION_MAJOR 8 CACHE STRING "" FORCE ) -set ( GraphBLAS_VERSION_MINOR 3 CACHE STRING "" FORCE ) -set ( GraphBLAS_VERSION_SUB 1 CACHE STRING "" FORCE ) +set ( GraphBLAS_DATE "Jan 1, 2024" ) +set ( GraphBLAS_VERSION_MAJOR 9 CACHE STRING "" FORCE ) +set ( GraphBLAS_VERSION_MINOR 0 CACHE STRING "" FORCE ) +set ( GraphBLAS_VERSION_SUB 0 CACHE STRING "" FORCE ) # GraphBLAS C API Specification version, at graphblas.org -set ( GraphBLAS_API_DATE "Nov 15, 2021" ) +set ( GraphBLAS_API_DATE "Dec 22, 2023" ) set ( GraphBLAS_API_VERSION_MAJOR 2 ) -set ( GraphBLAS_API_VERSION_MINOR 0 ) +set ( GraphBLAS_API_VERSION_MINOR 1 ) set ( GraphBLAS_API_VERSION_SUB 0 ) message ( STATUS "Building SuiteSparse:GraphBLAS version: v" diff --git a/GraphBLAS/cmake_modules/SuiteSparseAtomic.cmake b/GraphBLAS/cmake_modules/SuiteSparseAtomic.cmake index 9953854836..3b93432294 100644 --- a/GraphBLAS/cmake_modules/SuiteSparseAtomic.cmake +++ b/GraphBLAS/cmake_modules/SuiteSparseAtomic.cmake @@ -2,7 +2,7 @@ # GraphBLAS/cmake_modules/SuiteSparseAtomic.cmake #------------------------------------------------------------------------------- -# Copyright (c) 2017-2023, Timothy A. Davis. All Rights Reserved. +# Copyright (c) 2017-2024, Timothy A. Davis. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 #------------------------------------------------------------------------------- diff --git a/GraphBLAS/lz4/README.txt b/GraphBLAS/lz4/README.txt index e2f8c05db7..222c8c9c22 100644 --- a/GraphBLAS/lz4/README.txt +++ b/GraphBLAS/lz4/README.txt @@ -23,7 +23,7 @@ Files in this folder: When LZ4 is compiled for use in SuiteSparse:GraphBLAS, LZ4_USER_MEMORY_FUNCTIONS is defined, and LZ4_malloc, LZ4_calloc, and LZ4_free, are provided to LZ4. Those functions use whatever memory manager is given to -GxB_init, or the ANSI C11 malloc/calloc/free for GrB_init. +GxB_init, or the C11 malloc/calloc/free for GrB_init. This compile-time change could cause a conflict if LZ4 is also installed as a system-wide library. To avoid the conflict, all LZ4 function names are renamed diff --git a/GraphBLAS/zstd/README.txt b/GraphBLAS/zstd/README.txt index 227086b279..6c9d594c89 100644 --- a/GraphBLAS/zstd/README.txt +++ b/GraphBLAS/zstd/README.txt @@ -17,8 +17,8 @@ Files in this folder: When ZSTD is compiled for use in SuiteSparse:GraphBLAS, ZSTD_DEPS_MALLOC is defined, and ZSTD_malloc, ZSTD_calloc, and ZSTD_free, are provided to ZSTD -instead of have it use the standard ANSI C11 malloc/calloc/free. Those -functions use whatever memory manager is given to GxB_init, or the ANSI C11 +instead of have it use the standard C11 malloc/calloc/free. Those +functions use whatever memory manager is given to GxB_init, or the C11 malloc/calloc/free for GrB_init. This compile-time change could cause a conflict if ZSTD is also installed as a diff --git a/SuiteSparse_config/CMakeLists.txt b/SuiteSparse_config/CMakeLists.txt index e9013d6a28..f72cb7d831 100644 --- a/SuiteSparse_config/CMakeLists.txt +++ b/SuiteSparse_config/CMakeLists.txt @@ -15,9 +15,9 @@ cmake_minimum_required ( VERSION 3.22 ) # version of both SuiteSparse and SuiteSparse_config -set ( SUITESPARSE_DATE "Dec 30, 2023" ) +set ( SUITESPARSE_DATE "Jan 1, 2024" ) set ( SUITESPARSE_VERSION_MAJOR 7 ) -set ( SUITESPARSE_VERSION_MINOR 4 ) +set ( SUITESPARSE_VERSION_MINOR 5 ) set ( SUITESPARSE_VERSION_SUB 0 ) set ( SUITESPARSE_CONFIG_VERSION_MAJOR ${SUITESPARSE_VERSION_MAJOR} CACHE STRING "" FORCE ) set ( SUITESPARSE_CONFIG_VERSION_MINOR ${SUITESPARSE_VERSION_MINOR} CACHE STRING "" FORCE ) diff --git a/SuiteSparse_config/README.txt b/SuiteSparse_config/README.txt index 4ff01953f8..9d306c9e2a 100644 --- a/SuiteSparse_config/README.txt +++ b/SuiteSparse_config/README.txt @@ -1,4 +1,4 @@ -SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +SuiteSparse_config, Copyright (c) 2012-2024, Timothy A. Davis. All Rights Reserved. SPDX-License-Identifier: BSD-3-clause