import numpy as np import random from ctypes import * if __name__ == '__main__': # This version references matrices by matrixID instead of pointers print("This code tests some basic matrix building and reading routines\n") # initialize larc mat_store_exp = 26 op_store_exp = 24 max_level = 10 rnd_sig_bits = -1 # default value trunc_to_zero_bits = -1 # default value pylarc.create_report_thread(1800) verbose = 1 pylarc.initialize_larc(mat_store_exp, op_store_exp, max_level, rnd_sig_bits, trunc_to_zero_bits, verbose) # In the Makefile you can compile with different scalarType values # Define string for using in formating filenames scalarTypeStr = pylarc.cvar.scalarTypeStr # Calculate number of matrices created, then print part of matrix store num_matrices_made = pylarc.num_matrices_created() print("\n%d matrices have been created" % num_matrices_made) end = num_matrices_made - 1 # build array in C from Python list of scalars print("Using row_major_list_to_store on data entered from python\n")
# trunc_to_zero_bits = 52 ###################################################### ## TODO: find out the space in which this test fails!!! ## DBL_MANT_DIG is the number of digits in FLT_MANT ## ## why aren't we using DBL_MANT_BITS ??????? the number of bits ## used in the mantissa ###################################################### verbose = 1 pylarc.initialize_larc(matrix_exponent, op_exponent, max_level, rnd_sig_bits, trunc_to_zero_bits, verbose) pylarc.create_report_thread(180) print_naive = 0 print_nonzeros = 0 print("Problem size is small enough to run on desktop") if print_naive: print(" will print files of naive matrices") else: print(" not printing files of naive matrices") if print_nonzeros: print(" will print files of nonzero matrices\n") else: print(" not printing files of nonzero matrices\n") ## LARGE STORES for cs1l,cs4l,cs9l else: ## matrix_exponent = 26 ## op_exponent = 24