Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup testing of bml_add #94

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ if(BML_INTERNAL_GEMM)
endif()

set(BLAS_VENDOR ""
CACHE STRING "If set, the preferred BLAS/LAPACK vendor. Possible choices: {Intel,MKL,ACML,GNU}")
CACHE STRING "If set, the preferred BLAS/LAPACK vendor. Possible choices: {,Intel,MKL,ACML,GNU}")

if(BLAS_VENDOR STREQUAL "Intel" OR BLAS_VENDOR STREQUAL "MKL")
message(STATUS "Attempting to use Intel's BLAS/LAPACK (MKL)")
Expand Down
1 change: 0 additions & 1 deletion src/C-interface/dense/bml_add_dense_typed.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ double TYPED_FUNC(
shared(B_matrix, A_localRowMin, A_localRowMax) \
shared(N, myRank) \
reduction(+:trnorm)
//for (int i = 0; i < N * N; i++)
for (int i = A_localRowMin[myRank] * N; i < A_localRowMax[myRank] * N;
i++)
{
Expand Down
7 changes: 2 additions & 5 deletions src/C-interface/dense/bml_allocate_dense_typed.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,9 @@ bml_matrix_dense_t *TYPED_FUNC(
TYPED_FUNC(bml_zero_matrix_dense) (N, distrib_mode);
REAL_T *A_dense = A->matrix;
#pragma omp parallel for default(none) shared(A_dense)
for (int i = 0; i < N; i++)
for (int i = 0; i < N * N; i++)
{
for (int j = 0; j < N; j++)
{
A_dense[ROWMAJOR(i, j, N, N)] = rand() / (double) RAND_MAX;
}
A_dense[i] = rand() / (double) RAND_MAX;
}
return A;
}
Expand Down
10 changes: 0 additions & 10 deletions src/C-interface/ellpack/bml_add_ellpack_typed.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void TYPED_FUNC(
int N = A->N;
int A_M = A->M;
int B_M = B->M;

int ix[N], jx[N];

int *A_nnz = A->nnz;
Expand All @@ -67,7 +66,6 @@ void TYPED_FUNC(
shared(A_index, A_value, A_nnz) \
shared(A_localRowMin, A_localRowMax) \
shared(B_index, B_value, B_nnz)
//for (int i = 0; i < N; i++)
for (int i = A_localRowMin[myRank]; i < A_localRowMax[myRank]; i++)
{
int l = 0;
Expand All @@ -79,7 +77,6 @@ void TYPED_FUNC(
{
x[k] = 0.0;
ix[k] = i + 1;
//A_index[ROWMAJOR(i, l, N, A_M)] = k;
jx[l] = k;
l++;
}
Expand All @@ -94,7 +91,6 @@ void TYPED_FUNC(
{
x[k] = 0.0;
ix[k] = i + 1;
//A_index[ROWMAJOR(i, l, N, A_M)] = k;
jx[l] = k;
l++;
}
Expand All @@ -106,7 +102,6 @@ void TYPED_FUNC(
for (int jp = 0; jp < l; jp++)
{
int jind = jx[jp];
//REAL_T xTmp = x[A_index[ROWMAJOR(i, jp, N, A_M)]];
REAL_T xTmp = x[jind];
if (is_above_threshold(xTmp, threshold))
{
Expand Down Expand Up @@ -154,8 +149,6 @@ double TYPED_FUNC(
int *B_nnz = B->nnz;
int *B_index = B->index;

int ind, ind2;

REAL_T x[N];
REAL_T y[N];
REAL_T *A_value = (REAL_T *) A->value;
Expand All @@ -177,7 +170,6 @@ double TYPED_FUNC(
shared(A_localRowMin, A_localRowMax) \
shared(B_index, B_value, B_nnz) \
reduction(+:trnorm)
//for (int i = 0; i < N; i++)
for (int i = A_localRowMin[myRank]; i < A_localRowMax[myRank]; i++)
{
int l = 0;
Expand All @@ -190,7 +182,6 @@ double TYPED_FUNC(
x[k] = 0.0;
ix[k] = i + 1;
y[k] = 0.0;
//A_index[ROWMAJOR(i, l, N, A_M)] = k;
jx[l] = k;
l++;
}
Expand All @@ -207,7 +198,6 @@ double TYPED_FUNC(
x[k] = 0.0;
ix[k] = i + 1;
y[k] = 0.0;
//A_index[ROWMAJOR(i, l, N, A_M)] = k;
jx[l] = k;
l++;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include_directories(${CMAKE_SOURCE_DIR}/src/C-interface)

set(SOURCES_TYPED
add_matrix_typed.c
test_bml_add_typed.c
adjacency_matrix_typed.c
adjungate_triangle_matrix_typed.c
allocate_matrix_typed.c
Expand Down Expand Up @@ -39,7 +39,7 @@ set_target_properties(bmltests
POSITION_INDEPENDENT_CODE yes)

add_executable(bml-test
add_matrix.c
test_bml_add.c
adjacency_matrix.c
adjungate_triangle_matrix.c
allocate_matrix.c
Expand Down
73 changes: 0 additions & 73 deletions tests/add_matrix_typed.c

This file was deleted.

2 changes: 1 addition & 1 deletion tests/bml_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const char *test_description[] = {
};

const test_function_t testers[] = {
test_add,
test_bml_add,
test_adjacency,
test_adjungate_triangle,
test_allocate,
Expand Down
2 changes: 1 addition & 1 deletion tests/bml_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ typedef int (
const bml_matrix_precision_t matrix_precision,
const int M);

#include "add_matrix.h"
#include "adjacency_matrix.h"
#include "adjungate_triangle_matrix.h"
#include "allocate_matrix.h"
Expand All @@ -27,6 +26,7 @@ typedef int (
#include "scale_matrix.h"
#include "set_row.h"
#include "submatrix_matrix.h"
#include "test_bml_add.h"
#include "test_bml_gemm.h"
#include "threshold_matrix.h"
#include "trace_matrix.h"
Expand Down
16 changes: 9 additions & 7 deletions tests/add_matrix.c → tests/test_bml_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdio.h>

int
test_add(
test_bml_add(
const int N,
const bml_matrix_type_t matrix_type,
const bml_matrix_precision_t matrix_precision,
Expand All @@ -13,18 +13,20 @@ test_add(
switch (matrix_precision)
{
case single_real:
return test_add_single_real(N, matrix_type, matrix_precision, M);
return test_bml_add_single_real(N, matrix_type, matrix_precision,
M);
break;
case double_real:
return test_add_double_real(N, matrix_type, matrix_precision, M);
return test_bml_add_double_real(N, matrix_type, matrix_precision,
M);
break;
case single_complex:
return test_add_single_complex(N, matrix_type, matrix_precision,
M);
return test_bml_add_single_complex(N, matrix_type,
matrix_precision, M);
break;
case double_complex:
return test_add_double_complex(N, matrix_type, matrix_precision,
M);
return test_bml_add_double_complex(N, matrix_type,
matrix_precision, M);
break;
default:
fprintf(stderr, "unknown matrix precision\n");
Expand Down
14 changes: 7 additions & 7 deletions tests/add_matrix.h → tests/test_bml_add.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
#ifndef __ADD_MATRIX_H
#define __ADD_MATRIX_H
#ifndef __TEST_BML_ADD_H
#define __TEST_BML_ADD_H

#include <bml.h>

int test_add(
int test_bml_add(
const int N,
const bml_matrix_type_t matrix_type,
const bml_matrix_precision_t matrix_precision,
const int M);

int test_add_single_real(
int test_bml_add_single_real(
const int N,
const bml_matrix_type_t matrix_type,
const bml_matrix_precision_t matrix_precision,
const int M);

int test_add_double_real(
int test_bml_add_double_real(
const int N,
const bml_matrix_type_t matrix_type,
const bml_matrix_precision_t matrix_precision,
const int M);

int test_add_single_complex(
int test_bml_add_single_complex(
const int N,
const bml_matrix_type_t matrix_type,
const bml_matrix_precision_t matrix_precision,
const int M);

int test_add_double_complex(
int test_bml_add_double_complex(
const int N,
const bml_matrix_type_t matrix_type,
const bml_matrix_precision_t matrix_precision,
Expand Down
Loading