def cula_gpu_solve(A_, b_, trans='T'): A_shape = A_.shape b_shape = b_.shape assert (len(A_shape) == 2) assert (len(b_shape) == 2) if trans in ['T', 'C']: l, n = A_shape k, m = b_shape if n != k: raise ValueError('A and b must be aligned.') elif trans in ['N']: n, l = A_shape k, m = b_shape if l != m: raise ValueError('A and b must be aligned.') else: raise ValueError('Invalid value for trans') lda = max(1, n) ldb = max(1, n, l) # construct pointer arrays needed for culaDeviceSgels # Cula requires you to pass a pointer for A and b. A_ptr = A_.gpudata b_ptr = b_.gpudata cula.culaDeviceSgels(trans, n, l, m, A_ptr, lda, b_ptr, ldb) return A_, b_
def cula_gpu_solve(A_, b_, trans='T'): A_shape = A_.shape b_shape = b_.shape assert(len(A_shape) == 2) assert(len(b_shape) == 2) if trans in ['T', 'C']: l, n = A_shape k, m = b_shape if n != k: raise ValueError('A and b must be aligned.') elif trans in ['N']: n, l = A_shape k, m = b_shape if l != m: raise ValueError('A and b must be aligned.') else: raise ValueError('Invalid value for trans') lda = max(1, n) ldb = max(1, n, l) # construct pointer arrays needed for culaDeviceSgels # Cula requires you to pass a pointer for A and b. A_ptr = A_.gpudata b_ptr = b_.gpudata cula.culaDeviceSgels(trans, n, l, m, A_ptr, lda, b_ptr, ldb) return A_, b_