1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
|
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
/*!\file
* \brief rocsparseio.h includes other *.h and exposes a common interface
*/
#ifndef _ROCSPARSEIO_H_
#define _ROCSPARSEIO_H_
#define ROCSPARSEIO_VERSION_MAJOR 1
#include <stddef.h>
#include <stdint.h>
/*! \ingroup types_module
* \brief Specifies whether int32 or int64 is used.
*/
#ifdef __cplusplus
#include <cstdint>
#else
typedef long int int32_t;
typedef long long int int64_t;
#endif
#include <stdarg.h>
typedef char rocsparseio_string[512];
/*! \ingroup types_module
* \brief Info structure to hold all matrix meta data.
*
* \details
* The rocSPARSE matrix info is a structure holding all matrix information that
* is gathered during analysis routines. It must be initialized using
* rocsparse_create_mat_info() and the returned info structure must be passed
* to all subsequent library calls that require additional matrix information.
* It should be destroyed at the end using rocsparse_destroy_mat_info().
*/
/*! \ingroup types_module
* \brief Type used for enums in rocsparseio.
*
* \details
* The type \ref rocsparseio_enum_t must be the type used by enums.
*/
typedef int32_t rocsparseio_enum_t;
/*! \ingroup types_module
* \brief Enumeration type for status.
*/
typedef rocsparseio_enum_t rocsparseio_status_t;
typedef rocsparseio_enum_t rocsparseio_rwmode_t;
typedef rocsparseio_enum_t rocsparseio_order_t;
typedef rocsparseio_enum_t rocsparseio_direction_t;
typedef rocsparseio_enum_t rocsparseio_type_t;
typedef rocsparseio_enum_t rocsparseio_format_t;
typedef rocsparseio_enum_t rocsparseio_index_base_t;
/*! \ingroup types_module
* \brief Enumerates status.
*/
#define ROCSPARSEIO_STATUS_SUCCESS 0
#define ROCSPARSEIO_STATUS_INVALID_HANDLE 1
#define ROCSPARSEIO_STATUS_INVALID_POINTER 2
#define ROCSPARSEIO_STATUS_INVALID_VALUE 3
#define ROCSPARSEIO_STATUS_INVALID_ENUM 4
#define ROCSPARSEIO_STATUS_INVALID_FILE 5
#define ROCSPARSEIO_STATUS_INVALID_FILE_OPERATION 6
#define ROCSPARSEIO_STATUS_INVALID_FORMAT 7
#define ROCSPARSEIO_STATUS_INVALID_MODE 8
#define ROCSPARSEIO_STATUS_INVALID_SIZE 9
#define ROCSPARSEIO_STATUS_INVALID_MEMORY 10
#define ROCSPARSEIO_RWMODE_READ 0
#define ROCSPARSEIO_RWMODE_WRITE 1
#define ROCSPARSEIO_ORDER_ROW 0
#define ROCSPARSEIO_ORDER_COLUMN 1
#define ROCSPARSEIO_INDEX_BASE_ZERO 0
#define ROCSPARSEIO_INDEX_BASE_ONE 1
#define ROCSPARSEIO_DIRECTION_ROW 0
#define ROCSPARSEIO_DIRECTION_COLUMN 1
#define ROCSPARSEIO_TYPE_INT32 0
#define ROCSPARSEIO_TYPE_INT64 1
#define ROCSPARSEIO_TYPE_FLOAT32 2
#define ROCSPARSEIO_TYPE_FLOAT64 3
#define ROCSPARSEIO_TYPE_COMPLEX32 4
#define ROCSPARSEIO_TYPE_COMPLEX64 5
#define ROCSPARSEIO_TYPE_INT8 6
#define ROCSPARSEIO_FORMAT_DENSE_VECTOR 0
#define ROCSPARSEIO_FORMAT_DENSE_MATRIX 1
#define ROCSPARSEIO_FORMAT_SPARSE_CSX 2
#define ROCSPARSEIO_FORMAT_SPARSE_GEBSX 3
#define ROCSPARSEIO_FORMAT_SPARSE_COO 4
#define ROCSPARSEIO_FORMAT_SPARSE_DIA 5
#define ROCSPARSEIO_FORMAT_SPARSE_ELL 6
#define ROCSPARSEIO_FORMAT_SPARSE_HYB 7
#define ROCSPARSEIO_FORMAT_SPARSE_MCSX 8
typedef enum rocsparseio_index_base_
{
rocsparseio_index_base_zero = 0,
rocsparseio_index_base_one = 1
} rocsparseio_index_base;
typedef enum rocsparseio_rwmode_
{
rocsparseio_rwmode_read = ROCSPARSEIO_RWMODE_READ,
rocsparseio_rwmode_write = ROCSPARSEIO_RWMODE_WRITE
} rocsparseio_rwmode;
typedef enum rocsparseio_type_
{
rocsparseio_type_int32 = ROCSPARSEIO_TYPE_INT32,
rocsparseio_type_int64 = ROCSPARSEIO_TYPE_INT64,
rocsparseio_type_float32 = ROCSPARSEIO_TYPE_FLOAT32,
rocsparseio_type_float64 = ROCSPARSEIO_TYPE_FLOAT64,
rocsparseio_type_complex32 = ROCSPARSEIO_TYPE_COMPLEX32,
rocsparseio_type_complex64 = ROCSPARSEIO_TYPE_COMPLEX64,
rocsparseio_type_int8 = ROCSPARSEIO_TYPE_INT8
} rocsparseio_type;
typedef enum rocsparseio_format_
{
rocsparseio_format_dense_vector = ROCSPARSEIO_FORMAT_DENSE_VECTOR,
rocsparseio_format_dense_matrix = ROCSPARSEIO_FORMAT_DENSE_MATRIX,
rocsparseio_format_sparse_csx = ROCSPARSEIO_FORMAT_SPARSE_CSX,
rocsparseio_format_sparse_gebsx = ROCSPARSEIO_FORMAT_SPARSE_GEBSX,
rocsparseio_format_sparse_coo = ROCSPARSEIO_FORMAT_SPARSE_COO,
rocsparseio_format_sparse_dia = ROCSPARSEIO_FORMAT_SPARSE_DIA,
rocsparseio_format_sparse_ell = ROCSPARSEIO_FORMAT_SPARSE_ELL,
rocsparseio_format_sparse_hyb = ROCSPARSEIO_FORMAT_SPARSE_HYB,
rocsparseio_format_sparse_mcsx = ROCSPARSEIO_FORMAT_SPARSE_MCSX
} rocsparseio_format;
typedef enum rocsparseio_direction_
{
rocsparseio_direction_row = ROCSPARSEIO_DIRECTION_ROW,
rocsparseio_direction_column = ROCSPARSEIO_DIRECTION_COLUMN
} rocsparseio_direction;
typedef enum rocsparseio_order_
{
rocsparseio_order_row = 0,
rocsparseio_order_column = 1
} rocsparseio_order;
/*! \ingroup types_module
* \brief Enumerates status.
*/
typedef enum rocsparseio_status_
{
rocsparseio_status_success = ROCSPARSEIO_STATUS_SUCCESS,
rocsparseio_status_invalid_handle = ROCSPARSEIO_STATUS_INVALID_HANDLE,
rocsparseio_status_invalid_pointer = ROCSPARSEIO_STATUS_INVALID_POINTER,
rocsparseio_status_invalid_value = ROCSPARSEIO_STATUS_INVALID_VALUE,
rocsparseio_status_invalid_enum = ROCSPARSEIO_STATUS_INVALID_ENUM,
rocsparseio_status_invalid_file = ROCSPARSEIO_STATUS_INVALID_FILE,
rocsparseio_status_invalid_file_operation = ROCSPARSEIO_STATUS_INVALID_FILE_OPERATION,
rocsparseio_status_invalid_format = ROCSPARSEIO_STATUS_INVALID_FORMAT,
rocsparseio_status_invalid_mode = ROCSPARSEIO_STATUS_INVALID_MODE,
rocsparseio_status_invalid_size = ROCSPARSEIO_STATUS_INVALID_SIZE,
rocsparseio_status_invalid_memory = ROCSPARSEIO_STATUS_INVALID_MEMORY
} rocsparseio_status;
//
// Opaque structure.
//
typedef struct _rocsparseio_handle* rocsparseio_handle;
#ifdef __cplusplus
extern "C" {
#endif
//! @brief Open a rocsparseio file
//! @param[out] p_handle pointer to the rocsparseio handle to be created.
//! @param[in] mode indicates how to handle the file.
//! @param[in] filename flexible C-printf style file name.
//! @retval rocsparseio_status_success the operation completed successfully.
//! @retval rocsparseio_status_invalid_handle \p p_handle is a null pointer.
//! @retval rocsparseio_status_invalid_value \p mode is invalid
//! @retval rocsparseio_status_invalid_pointer \p filename is a null pointer.
rocsparseio_status rocsparseio_open(rocsparseio_handle* p_handle,
rocsparseio_rwmode mode,
const char* filename,
...);
//! @brief Close the rocsparseio file.
//! @param[in] handle pointer to the rocsparseio handle.
//! @retval rocsparseio_status_success the operation completed successfully.
//! @retval rocsparseio_status_invalid_handle \p handle is a null pointer.
rocsparseio_status rocsparseio_close(rocsparseio_handle handle);
//! @brief Get the description of a \ref rocsparseio_status.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] status status to get the description from.
//! @param[out] description.
//! @retval rocsparseio_status_success the operation completed successfully.
//! @retval rocsparseio_status_invalid_handle \p handle is a null pointer.
//! @retval rocsparseio_status_invalid_pointer \p description is a null pointer.
rocsparseio_status rocsparseio_status_description(rocsparseio_handle handle,
rocsparseio_status status,
rocsparseio_string description);
//! @brief Read the name of the object.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name of object.
//! @retval rocsparseio_status_success the operation completed successfully.
//! @retval rocsparseio_status_invalid_handle \p handle is a null pointer.
//! @retval rocsparseio_status_invalid_pointer \p format is a null pointer
rocsparseio_status rocsparseio_read_name(rocsparseio_handle handle, rocsparseio_string name);
//! @brief Read what kind of object is recorded.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] format of object.
//! @retval rocsparseio_status_success the operation completed successfully.
//! @retval rocsparseio_status_invalid_handle \p handle is a null pointer.
//! @retval rocsparseio_status_invalid_pointer \p format is a null pointer
rocsparseio_status rocsparseio_read_format(rocsparseio_handle handle, rocsparseio_format* format);
//! @brief Size in byte of a given \ref rocsparseio_type.
//! @param[in] type
//! @param[out] size
//! @retval rocsparseio_status_success the operation completed successfully.
//! @retval rocsparseio_status_invalid_value \p type is invalid
//! @retval rocsparseio_status_invalid_pointer \p size is a null pointer
rocsparseio_status rocsparseio_type_get_size(rocsparseio_type type, uint64_t* size);
//! @brief Write vector.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] data_type rocsparseio data type.
//! @param[in] data_nmemb length of the vector with respect to the data type.
//! @param[in] data values
//! @param[in] data_ld leading dimension of data.
//! @param[in] name flexible C-printf style name.
rocsparseio_status rocsparseio_write_dense_vector(rocsparseio_handle handle,
rocsparseio_type data_type,
uint64_t data_nmemb,
const void* data,
uint64_t data_ld,
const char* name,
...);
//! @brief Read vector.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] data_type rocsparseio data type.
//! @param[out] data_nmemb length of the vector with respect to the data type.
//! @param[out] data array of values internally created with malloc, the user is
//! responsible to free.
rocsparseio_status rocsparseio_read_dense_vector(rocsparseio_handle handle,
rocsparseio_type* data_type,
uint64_t* data_nmemb,
void** data);
//! @brief Read metadata vector.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] data_type rocsparseio data type.
//! @param[out] data_nmemb length of the vector with respect to the data type.
//! @note
//! - This method is useful if the user wants to have control over the memory
//! allocation.
//! - It is expected \ref rocsparseiox_read_dense_vector to be the next
//! rocsparseio routine being called.
rocsparseio_status rocsparseiox_read_metadata_dense_vector(rocsparseio_handle handle,
rocsparseio_type* data_type,
uint64_t* data_nmemb);
//! @brief Read vector.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] data array of values to be filled.
//! @param[in] data_ld leading dimension of data.
rocsparseio_status
rocsparseiox_read_dense_vector(rocsparseio_handle handle, void* data, uint64_t data_ld);
//! @brief Write dense
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] order indicates if memory layout is row- or column-oriented.
//! @param[in] m number of rows
//! @param[in] n number of columns
//! @param[in] data_type rocsparseio data type.
//! @param[in] data
//! @param[in] data_ld leading dimension of data.
//! @param[in] name flexible C-printf style name.
rocsparseio_status rocsparseio_write_dense_matrix(rocsparseio_handle handle,
rocsparseio_order order,
uint64_t m,
uint64_t n,
rocsparseio_type data_type,
const void* data,
uint64_t data_ld,
const char* name,
...);
//! @brief Read dense
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] order indicates if memory layout is row- or column-oriented.
//! @param[out] m number of rows
//! @param[out] n number of columns
//! @param[out] data_type rocsparseio data type.
//! @param[out] data array of values filled but created with malloc, the user is
//! responsible to free.
rocsparseio_status rocsparseio_read_dense_matrix(rocsparseio_handle handle,
rocsparseio_order* order,
uint64_t* m,
uint64_t* n,
rocsparseio_type* data_type,
void** data);
//! @brief Read metadata dense
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] order indicates if memory layout is row- or column-oriented.
//! @param[out] m number of rows
//! @param[out] n number of columns
//! @param[out] data_type rocsparseio data type.
rocsparseio_status rocsparseiox_read_metadata_dense_matrix(rocsparseio_handle handle,
rocsparseio_order* order,
uint64_t* m,
uint64_t* n,
rocsparseio_type* data_type);
//! @brief Read metadata dense
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] data array of values to be filled.
//! @param[in] data_ld leading dimension..
rocsparseio_status
rocsparseiox_read_dense_matrix(rocsparseio_handle handle, void* data, uint64_t data_ld);
//! @brief Write a sparse csr/csc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] dir indicates if the matrix is using a Compressed Sparse Row or
//! Column storage.
//! @param[in] m number of rows.
//! @param[in] n number of columns.
//! @param[in] nnz number of non-zeros.
//! @param[in] ptr_type type of elements of the array \p ptr.
//! @param[in] ptr array of offsets.
//! @param[in] ind_type type of elements of the array \p ind.
//! @param[in] ind array of column/row indices.
//! @param[in] val_type type of elements of the array \p val.
//! @param[in] val array of values.
//! @param[in] base index base used in arrays \p ptr and \p ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_csx(rocsparseio_handle handle,
rocsparseio_direction dir,
uint64_t m,
uint64_t n,
uint64_t nnz,
rocsparseio_type ptr_type,
const void* ptr,
rocsparseio_type ind_type,
const void* ind,
rocsparseio_type val_type,
const void* val,
rocsparseio_index_base base,
const char* name,
...);
//! @brief Read a sparse csr/csc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] dir indicates if the matrix is using with a Compressed Sparse
//! Row or Column storage.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] nnz number of non-zeros.
//! @param[out] ptr_type type of elements of the array \p ptr.
//! @param[out] ptr array of offsets.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] ind array of column/row indices.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] val array of values.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_csx(rocsparseio_handle handle,
rocsparseio_direction* dir,
uint64_t* m,
uint64_t* n,
uint64_t* nnz,
rocsparseio_type* ptr_type,
void** ptr,
rocsparseio_type* ind_type,
void** ind,
rocsparseio_type* val_type,
void** val,
rocsparseio_index_base* base);
//! @brief Read metadata information of the sparse csr/csc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] dir indicates if the matrix is using with a Compressed Sparse
//! Row or Column storage.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] nnz number of non-zeros.
//! @param[out] ptr_type type of elements of the array \p ptr.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_csx(rocsparseio_handle handle,
rocsparseio_direction* dir,
uint64_t* m,
uint64_t* n,
uint64_t* nnz,
rocsparseio_type* ptr_type,
rocsparseio_type* ind_type,
rocsparseio_type* data_type,
rocsparseio_index_base* base);
//! @brief Read sparse csr/csc matrix data arrays.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] ptr array of offsets to fill.
//! @param[in] ind array of column/row indices to fill.
//! @param[in] val array of values to fill.
//! @retval rocsparseio_status
rocsparseio_status
rocsparseiox_read_sparse_csx(rocsparseio_handle handle, void* ptr, void* ind, void* data);
//! @brief Write a sparse modified csr/csc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] dir indicates if the matrix is using a Modified Compressed Sparse Row or
//! Column storage.
//! @param[in] m number of rows.
//! @param[in] n number of columns.
//! @param[in] nnz number of non-zeros.
//! @param[in] ptr_type type of elements of the array \p ptr.
//! @param[in] ptr array of offsets.
//! @param[in] ind_type type of elements of the array \p ind.
//! @param[in] ind array of column/row indices.
//! @param[in] val_type type of elements of the array \p val.
//! @param[in] val array of values.
//! @param[in] base index base used in arrays \p ptr and \p ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_mcsx(rocsparseio_handle handle,
rocsparseio_direction dir,
uint64_t m,
uint64_t n,
uint64_t nnz,
rocsparseio_type ptr_type,
const void* ptr,
rocsparseio_type ind_type,
const void* ind,
rocsparseio_type val_type,
const void* val,
rocsparseio_index_base base,
const char* name,
...);
//! @brief Read a sparse modified csr/csc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] dir indicates if the matrix is using with a Modified Compressed Sparse
//! Row or Column storage.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] nnz number of non-zeros.
//! @param[out] ptr_type type of elements of the array \p ptr.
//! @param[out] ptr array of offsets.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] ind array of column/row indices.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] val array of values.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_mcsx(rocsparseio_handle handle,
rocsparseio_direction* dir,
uint64_t* m,
uint64_t* n,
uint64_t* nnz,
rocsparseio_type* ptr_type,
void** ptr,
rocsparseio_type* ind_type,
void** ind,
rocsparseio_type* val_type,
void** val,
rocsparseio_index_base* base);
//! @brief Read metadata information of the sparse modified csr/csc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] dir indicates if the matrix is using with a Modifed Compressed Sparse
//! Row or Column storage.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] nnz number of non-zeros.
//! @param[out] ptr_type type of elements of the array \p ptr.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_mcsx(rocsparseio_handle handle,
rocsparseio_direction* dir,
uint64_t* m,
uint64_t* n,
uint64_t* nnz,
rocsparseio_type* ptr_type,
rocsparseio_type* ind_type,
rocsparseio_type* data_type,
rocsparseio_index_base* base);
//! @brief Read sparse modified csr/csc matrix data arrays.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] ptr array of offsets to fill.
//! @param[in] ind array of column/row indices to fill.
//! @param[in] val array of values to fill.
//! @retval rocsparseio_status
rocsparseio_status
rocsparseiox_read_sparse_mcsx(rocsparseio_handle handle, void* ptr, void* ind, void* data);
//! @brief Write a sparse gebsr/gebsc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] dir indicates if the matrix is using a GEneral Block Sparse Row
//! or Column storage.
//! @param[in] dirb indicates storage ordering of dense block matrices.
//! @param[in] mb number of rows.
//! @param[in] nb number of columns.
//! @param[in] nnzb number of non-zeros.
//! @param[in] row_block_dim number of rows in a single dense block.
//! @param[in] col_block_dim number of columns in a single dense block.
//! @param[in] ptr_type type of elements of the array \p ptr.
//! @param[in] ptr array of offsets.
//! @param[in] ind_type type of elements of the array \p ind.
//! @param[in] ind array of column/row indices.
//! @param[in] val_type type of elements of the array \p val.
//! @param[in] val array of values.
//! @param[in] base index base used in arrays \p ptr and \p ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_gebsx(rocsparseio_handle handle,
rocsparseio_direction dir,
rocsparseio_direction dirb,
uint64_t mb,
uint64_t nb,
uint64_t nnzb,
uint64_t row_block_dim,
uint64_t col_block_dim,
rocsparseio_type ptr_type,
const void* ptr,
rocsparseio_type ind_type,
const void* ind,
rocsparseio_type val_type,
const void* val,
rocsparseio_index_base base,
const char* name,
...);
//! @brief Read a sparse gebsr/gebsc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] dir indicates if the matrix is using a GEneral Block Sparse Row
//! or Column storage.
//! @param[out] dirb indicates storage ordering of dense block matrices.
//! @param[out] mb number of rows.
//! @param[out] nb number of columns.
//! @param[out] nnzb number of non-zeros.
//! @param[out] row_block_dim number of rows in a single dense block.
//! @param[out] col_block_dim number of columns in a single dense block.
//! @param[out] ptr_type type of elements of the array \p ptr.
//! @param[out] ptr array of offsets.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] ind array of column/row indices.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] val array of values.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_gebsx(rocsparseio_handle handle,
rocsparseio_direction* dir,
rocsparseio_direction* dirb,
uint64_t* mb,
uint64_t* nb,
uint64_t* nnzb,
uint64_t* row_block_dim,
uint64_t* col_block_dim,
rocsparseio_type* ptr_type,
void** ptr,
rocsparseio_type* ind_type,
void** ind,
rocsparseio_type* val_type,
void** val,
rocsparseio_index_base* base);
//! @brief Read metadata information of a sparse gebsr/gebsc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] dir indicates if the matrix is using a GEneral Block Sparse Row
//! or Column storage.
//! @param[out] dirb indicates storage ordering of dense block matrices.
//! @param[out] mb number of rows.
//! @param[out] nb number of columns.
//! @param[out] nnzb number of non-zeros.
//! @param[out] row_block_dim number of rows in a single dense block.
//! @param[out] col_block_dim number of columns in a single dense block.
//! @param[out] ptr_type type of elements of the array \p ptr.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_gebsx(rocsparseio_handle handle,
rocsparseio_direction* dir,
rocsparseio_direction* dirb,
uint64_t* mb,
uint64_t* nb,
uint64_t* nnzb,
uint64_t* row_block_dim,
uint64_t* col_block_dim,
rocsparseio_type* ptr_type,
rocsparseio_type* ind_type,
rocsparseio_type* val_type,
rocsparseio_index_base* base);
//! @brief Read a sparse gebsr/gebsc matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] ptr array of offsets.
//! @param[out] ind array of column/row indices.
//! @param[out] val array of values.
//! @retval rocsparseio_status
rocsparseio_status
rocsparseiox_read_sparse_gebsx(rocsparseio_handle handle, void* ptr, void* ind, void* val);
//! @brief Write a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] m number of rows.
//! @param[in] n number of columns.
//! @param[in] nnz number of non-zeros.
//! @param[in] row_ind_type type of elements of the array \p row_ind.
//! @param[in] row_ind array of row indices.
//! @param[in] col_ind_type type of elements of the array \p col_ind.
//! @param[in] col_ind array of column indices.
//! @param[in] val_type type of elements of the array \p val.
//! @param[in] val array of values.
//! @param[in] base index base used in arrays \p row_ind and \p col_ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_coo(rocsparseio_handle handle,
uint64_t m,
uint64_t n,
uint64_t nnz,
rocsparseio_type row_ind_type,
const void* row_ind,
rocsparseio_type col_ind_type,
const void* col_ind,
rocsparseio_type val_type,
const void* val,
rocsparseio_index_base base,
const char* name,
...);
//! @brief Read a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] nnz number of non-zeros.
//! @param[out] row_ind_type type of elements of the array \p row_ind.
//! @param[out] row_ind array of offsets.
//! @param[out] col_ind_type type of elements of the array \p col_ind.
//! @param[out] col_ind array of column/row indices.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] val array of values.
//! @param[out] base index base used in arrays \p row_ind and \p col_ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_coo(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* nnz,
rocsparseio_type* row_ind_type,
void** row_ind,
rocsparseio_type* col_ind_type,
void** col_ind,
rocsparseio_type* val_type,
void** val,
rocsparseio_index_base* base);
//! @brief Read metadata information of a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] nnz number of non-zeros.
//! @param[out] row_ind_type type of elements of the array of row indices.
//! @param[out] col_ind_type type of elements of the array of column indices.
//! @param[out] val_type type of elements of the array.
//! @param[out] base index base used in arrays row and column indices.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_coo(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* nnz,
rocsparseio_type* row_ind_type,
rocsparseio_type* col_ind_type,
rocsparseio_type* val_type,
rocsparseio_index_base* base);
//! @brief Read a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] row_ind array of row indices.
//! @param[out] col_ind array of column indices.
//! @param[out] val array of values.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_sparse_coo(rocsparseio_handle handle,
void* row_ind,
void* col_ind,
void* val);
//! @brief Write a sparse ell matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[in] m number of rows.
//! @param[in] n number of columns.
//! @param[in] width width of the matrix.
//! @param[in] ind_type type of elements of the array \p ind.
//! @param[in] ind array of column/row indices.
//! @param[in] val_type type of elements of the array \p val.
//! @param[in] val array of values.
//! @param[in] base index base used in arrays and \p ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_ell(rocsparseio_handle handle,
uint64_t m,
uint64_t n,
uint64_t width,
rocsparseio_type ind_type,
const void* ind,
rocsparseio_type val_type,
const void* val,
rocsparseio_index_base base,
const char* name,
...);
//! @brief Read a sparse ell matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] width width of the matrix.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] ind array of column/row indices.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] val array of values.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_ell(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* width,
rocsparseio_type* ind_type,
void** ind,
rocsparseio_type* val_type,
void** val,
rocsparseio_index_base* base);
//! @brief Read metadata information of a sparse ell matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] width witdh of the matrix.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_ell(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* width,
rocsparseio_type* ind_type,
rocsparseio_type* val_type,
rocsparseio_index_base* base);
//! @brief Read a sparse ell matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] ind array of column indices.
//! @param[out] val array of values.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_sparse_ell(rocsparseio_handle handle, void* ind, void* val);
//! @brief Write a sparse dia matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[in] m number of rows.
//! @param[in] n number of columns.
//! @param[in] ndiag number of diagonals.
//! @param[in] ind_type type of elements of the array \p ind.
//! @param[in] ind array of diagonal indices.
//! @param[in] val_type type of elements of the array \p val.
//! @param[in] val array of values.
//! @param[in] base index base used in arrays and \p ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_dia(rocsparseio_handle handle,
uint64_t m,
uint64_t n,
uint64_t ndiag,
rocsparseio_type ind_type,
const void* ind,
rocsparseio_type val_type,
const void* val,
rocsparseio_index_base base,
const char* name,
...);
//! @brief Read a sparse dia matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] ndiag number of diagonals.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] ind array of diagonal indices.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] val array of values.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_dia(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* ndiag,
rocsparseio_type* ind_type,
void** ind,
rocsparseio_type* val_type,
void** val,
rocsparseio_index_base* base);
//! @brief Read metadata information of a sparse dia matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[in] ndiag number of diagonals.
//! @param[out] ind_type type of elements of the array \p ind.
//! @param[out] val_type type of elements of the array \p val.
//! @param[out] base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_dia(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* ndiag,
rocsparseio_type* ind_type,
rocsparseio_type* val_type,
rocsparseio_index_base* base);
//! @brief Read a sparse ell matrix.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] ind array of diagonal indices.
//! @param[out] val array of values.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_sparse_dia(rocsparseio_handle handle, void* ind, void* val);
//! @brief Write a sparse matrix with hyb format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[in] m number of rows.
//! @param[in] n number of columns.
//! @param[in] coo_nnz number of non-zeros.
//! @param[in] coo_row_ind_type type of elements of the array \p row_ind.
//! @param[in] coo_row_ind array of row indices.
//! @param[in] coo_col_ind_type type of elements of the array \p col_ind.
//! @param[in] coo_col_ind array of column indices.
//! @param[in] coo_val_type type of elements of the array \p val.
//! @param[in] coo_val array of values.
//! @param[in] coo_base index base used in arrays \p row_ind and \p col_ind.
//! @param[in] ell_width width of the matrix.
//! @param[in] ell_ind_type type of elements of the array \p ind.
//! @param[in] ell_ind array of column/row indices.
//! @param[in] ell_val_type type of elements of the array \p val.
//! @param[in] ell_val array of values.
//! @param[in] ell_base index base used in arrays and \p ind.
//! @param[in] name flexible C-printf style name.
//! @retval rocsparseio_status
rocsparseio_status rocsparseio_write_sparse_hyb(rocsparseio_handle handle,
uint64_t m,
uint64_t n,
uint64_t coo_nnz,
rocsparseio_type coo_row_ind_type,
const void* coo_row_ind,
rocsparseio_type coo_col_ind_type,
const void* coo_col_ind,
rocsparseio_type coo_val_type,
const void* coo_val,
rocsparseio_index_base coo_base,
uint64_t ell_width,
rocsparseio_type ell_col_ind_type,
const void* ell_col_ind,
rocsparseio_type ell_val_type,
const void* ell_val,
rocsparseio_index_base ell_base,
const char* name,
...);
//! @brief Read a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] coo_nnz number of non-zeros.
//! @param[out] coo_row_ind_type type of elements of the array \p row_ind.
//! @param[out] coo_row_ind array of offsets.
//! @param[out] coo_col_ind_type type of elements of the array \p col_ind.
//! @param[out] coo_col_ind array of column/row indices.
//! @param[out] coo_val_type type of elements of the array \p val.
//! @param[out] coo_val array of values.
//! @param[out] coo_base index base used in arrays \p row_ind and \p col_ind.
//! @param[out] ell_width width of the matrix.
//! @param[out] ell_ind_type type of elements of the array \p ind.
//! @param[out] ell_ind array of column/row indices.
//! @param[out] ell_val_type type of elements of the array \p val.
//! @param[out] ell_val array of values.
//! @param[out] ell_base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
//! @note allocation is performed with standard malloc function, the user is
//! responsible to the standard free function to free the memory.
rocsparseio_status rocsparseio_read_sparse_hyb(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* coo_nnz,
rocsparseio_type* coo_row_ind_type,
void** coo_row_ind,
rocsparseio_type* coo_col_ind_type,
void** coo_col_ind,
rocsparseio_type* coo_val_type,
void** coo_val,
rocsparseio_index_base* coo_base,
uint64_t* ell_width,
rocsparseio_type* ell_col_ind_type,
void** ell_col_ind,
rocsparseio_type* ell_val_type,
void** ell_val,
rocsparseio_index_base* ell_base);
//! @brief Read metadata information of a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] name name of the matrix.
//! @param[out] m number of rows.
//! @param[out] n number of columns.
//! @param[out] coo_nnz number of non-zeros.
//! @param[out] coo_row_ind_type type of elements of the array of row indices.
//! @param[out] coo_col_ind_type type of elements of the array of column indices.
//! @param[out] coo_val_type type of elements of the array.
//! @param[out] coo_base index base used in arrays row and column indices.
//! @param[out] ell_width witdh of the matrix.
//! @param[out] ell_ind_type type of elements of the array \p ind.
//! @param[out] ell_val_type type of elements of the array \p val.
//! @param[out] ell_base index base used in arrays \p ptr and \p ind.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_metadata_sparse_hyb(rocsparseio_handle handle,
uint64_t* m,
uint64_t* n,
uint64_t* coo_nnz,
rocsparseio_type* coo_row_ind_type,
rocsparseio_type* coo_col_ind_type,
rocsparseio_type* coo_val_type,
rocsparseio_index_base* coo_base,
uint64_t* ell_width,
rocsparseio_type* ell_col_ind_type,
rocsparseio_type* ell_val_type,
rocsparseio_index_base* ell_base);
//! @brief Read a sparse matrix with coordinates format.
//! @param[in] handle pointer to the rocsparseio handle.
//! @param[out] coo_row_ind array of row indices.
//! @param[out] coo_col_ind array of column indices.
//! @param[out] coo_val array of values.
//! @param[out] ell_col_ind array of column indices.
//! @param[out] ell_val array of values.
//! @retval rocsparseio_status
rocsparseio_status rocsparseiox_read_sparse_hyb(rocsparseio_handle handle,
void* coo_row_ind,
void* coo_col_ind,
void* coo_val,
void* ell_col_ind,
void* ell_val);
#ifdef __cplusplus
}
#endif
#endif /* _ROCSPARSEIO_H_ */
|