Skip to content

Commit

Permalink
Rectified funcs upto prod
Browse files Browse the repository at this point in the history
  • Loading branch information
sarrah-basta committed Jul 24, 2022
1 parent 48325b1 commit 2e2c2d7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 27 deletions.
5 changes: 2 additions & 3 deletions no-klu/src/Makefile
@@ -1,9 +1,8 @@
CXX = g++
CXXFLAGS = -g
SOURCES1 = kry_example.c nvector_octave.cpp
SOURCES2 = test_nvector_octave.cpp test_nvector_octave.cpp nvector_octave.cpp
DEPS1 = nvector_octave.h
DEPS2 = nvector_octave.h test_nvector.h
SOURCES2 = test_nvector_octave.cpp test_nvector.cpp nvector_octave.cpp
DEPS = nvector_octave.h test_nvector.h
OBJECTS1 = $(SOURCES1:.cpp=.o)
OBJECTS2 = $(SOURCES2:.cpp=.o)
EXECUTABLE1 = app
Expand Down
14 changes: 1 addition & 13 deletions no-klu/src/nvector_octave.cpp
Expand Up @@ -618,24 +618,12 @@ void N_VProd_Octave(N_Vector x, N_Vector y, N_Vector z)

void N_VDiv_Octave(N_Vector x, N_Vector y, N_Vector z)
{
// sunindextype i, N;
// realtype *xd, *yd, *zd;

// xd = yd = zd = NULL;

// N = NV_LENGTH_C(x);
// xd = NV_DATA_C(x);
// yd = NV_DATA_C(y);
// zd = NV_DATA_C(z);

// for (i = 0; i < N; i++)
// zd[i] = xd[i]/yd[i];

ColumnVector *xv, *zv, *yv;
xv = static_cast<ColumnVector *> NV_CONTENT_C(x);
zv = static_cast<ColumnVector *> NV_CONTENT_C(z);
yv = static_cast<ColumnVector *> NV_CONTENT_C(y);
// *zv = (*xv)/(*yv);
*zv = quotient((*xv),(*yv));

return;
}
Expand Down
Binary file added no-klu/src/nvector_octave.o
Binary file not shown.
Binary file added no-klu/src/test
Binary file not shown.
6 changes: 2 additions & 4 deletions no-klu/src/test_nvector.cpp
Expand Up @@ -432,7 +432,7 @@ int Test_N_VSetArrayPointer(N_Vector W, sunindextype local_length, int myid)
Wdata = (realtype*) malloc(local_length * sizeof(realtype));
for(i=0; i < local_length; i++){
Wdata[i] = ONE;
printf("\n F Wdata =",i, Wdata[i]);
// printf("\n F Wdata =",i, Wdata[i]);
}

/* attach data to vector */
Expand All @@ -444,7 +444,7 @@ int Test_N_VSetArrayPointer(N_Vector W, sunindextype local_length, int myid)
N_VConst(NEG_HALF,W); N_VPrint(W);
for(i=0; i < local_length; i++){
failure += SUNRCompare(Wdata[i], NEG_HALF);
printf("\n Wdata =", Wdata[i]);
// printf("\n Wdata =", Wdata[i]);
}

if (failure) {
Expand Down Expand Up @@ -1729,13 +1729,11 @@ int Test_N_VCompare(N_Vector X, N_Vector Z, sunindextype local_length, int myid)
break;
}
}
N_VPrint(X);

start_time = get_time();
N_VCompare(ONE, X, Z);
sync_device(X);
stop_time = get_time();
N_VPrint(Z);
/* check return vector */
for(i=0; i < local_length; i++){

Expand Down
Binary file added no-klu/src/test_nvector.o
Binary file not shown.
14 changes: 7 additions & 7 deletions no-klu/src/test_nvector_octave.cpp
Expand Up @@ -213,15 +213,15 @@ int main(int argc, char *argv[])
// fails += Test_N_VMinQuotientLocal(X, Y, length, 0);

/* local fused reduction operations */
printf("\nTesting local fused reduction operations:\n\n");
// fails += Test_N_VDotProdMultiLocal(V, length, 0);
// printf("\nTesting local fused reduction operations:\n\n");
// // fails += Test_N_VDotProdMultiLocal(V, length, 0);

/* XBraid interface operations */
printf("\nTesting XBraid interface operations:\n\n");
// /* XBraid interface operations */
// printf("\nTesting XBraid interface operations:\n\n");

fails += Test_N_VBufSize(X, length, 0);
fails += Test_N_VBufPack(X, length, 0);
fails += Test_N_VBufUnpack(X, length, 0);
// fails += Test_N_VBufSize(X, length, 0);
// fails += Test_N_VBufPack(X, length, 0);
// fails += Test_N_VBufUnpack(X, length, 0);

/* Free vectors */
N_VDestroy(W);
Expand Down
Binary file added no-klu/src/test_nvector_octave.o
Binary file not shown.

0 comments on commit 2e2c2d7

Please sign in to comment.