Skip to content

Commit 7a1bd4e

Browse files
committed
profile forward pass
1 parent 40f85e0 commit 7a1bd4e

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

‎src/utils/linalg.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,6 @@ CSR_Matrix *csr_csc_matmul_alloc(const CSR_Matrix *A, const CSC_Matrix *B)
325325
void block_left_multiply_vec(const struct CSR_Matrix *A, const double *x, double *y,
326326
int p)
327327
{
328-
assert(A != NULL && x != NULL && y != NULL && p > 0);
329-
330328
/* For each block */
331329
for (int block = 0; block < p; block++)
332330
{

‎tests/profiling/profile_left_matmul.h‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
const char *profile_left_matmul()
1515
{
1616
/* A @ X where A is 50 x 50 dense stored in CSR and X is 50 x 50 variable */
17-
int n = 50;
17+
int n = 100;
1818
expr *X = new_variable(n, n, 0, n * n);
1919
CSR_Matrix *A = new_csr_matrix(n, n, n * n);
2020
for (int i = 0; i < n * n; i++)
@@ -39,10 +39,11 @@ const char *profile_left_matmul()
3939
x_vals[i] = 1.0;
4040
}
4141

42-
// should benchmark forward later
43-
// AX->forward(AX, x_vals);
44-
4542
Timer timer;
43+
clock_gettime(CLOCK_MONOTONIC, &timer.start);
44+
AX->forward(AX, x_vals);
45+
clock_gettime(CLOCK_MONOTONIC, &timer.end);
46+
printf("left_matmul forward time: %8.3f seconds\n", GET_ELAPSED_SECONDS(timer));
4647
clock_gettime(CLOCK_MONOTONIC, &timer.start);
4748
AX->jacobian_init(AX);
4849
clock_gettime(CLOCK_MONOTONIC, &timer.end);

0 commit comments

Comments
 (0)