Skip to content

Commit

Permalink
Minor code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelesh committed Mar 11, 2024
1 parent 842a64e commit 1fb4b30
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 35 deletions.
1 change: 0 additions & 1 deletion resolve/random/RandomSketchingCount.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <resolve/MemoryUtils.hpp>
#include <resolve/vector/Vector.hpp>
#include <resolve/random/cpuSketchingKernels.h>
#ifdef RESOLVE_USE_HIP
#include <resolve/hip/hipSketchingKernels.h>
#endif
Expand Down
6 changes: 0 additions & 6 deletions resolve/random/RandomSketchingCountCpu.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#include <resolve/vector/Vector.hpp>
#include <resolve/random/cpuSketchingKernels.h>
#ifdef RESOLVE_USE_HIP
#include <resolve/hip/hipSketchingKernels.h>
#endif
#ifdef RESOLVE_USE_CUDA
#include <resolve/cuda/cudaSketchingKernels.h>
#endif
#include <resolve/random/RandomSketchingCountCpu.hpp>

namespace ReSolve
Expand Down
3 changes: 0 additions & 3 deletions resolve/random/RandomSketchingCountCpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ namespace ReSolve {
index_type* h_labels_{nullptr}; ///< label array size _n_, with values from _0_ to _k-1_ assigned by random
index_type* h_flip_{nullptr}; ///< flip array with values of 1 and -1 assigned by random

// index_type* d_labels_{nullptr}; ///< h_labels GPU counterpart
// index_type* d_flip_{nullptr}; ///< h_flip GPU counterpart
// memory::MemorySpace memspace_;
// MemoryHandler mem_; ///< Device memory manager object
};
}
1 change: 0 additions & 1 deletion resolve/random/RandomSketchingFWHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <resolve/MemoryUtils.hpp>
#include <resolve/vector/Vector.hpp>
#include <resolve/utilities/logger/Logger.hpp>
#include <resolve/random/cpuSketchingKernels.h>
#ifdef RESOLVE_USE_HIP
#include <resolve/hip/hipSketchingKernels.h>
#endif
Expand Down
6 changes: 0 additions & 6 deletions resolve/random/RandomSketchingFWHTCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
#include <resolve/vector/Vector.hpp>
#include <resolve/utilities/logger/Logger.hpp>
#include <resolve/random/cpuSketchingKernels.h>
#ifdef RESOLVE_USE_HIP
#include <resolve/hip/hipSketchingKernels.h>
#endif
#ifdef RESOLVE_USE_CUDA
#include <resolve/cuda/cudaSketchingKernels.h>
#endif
#include <resolve/random/RandomSketchingFWHTCpu.hpp>

namespace ReSolve
Expand Down
3 changes: 0 additions & 3 deletions resolve/random/RandomSketchingFWHTCpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@ namespace ReSolve {
index_type* h_D_{nullptr}; ///< D is a diagonal matrix (FWHT computed y = PHDx), we store it as an array. D consists of _1_s and _-1_s
index_type* h_perm_{nullptr}; ///< permuation array, containing _k_ values in range of _0_ to _n-1_

// index_type* d_D_{nullptr}; ///< device mirror of D
// index_type* d_perm_{nullptr}; ///< device mirror of h_perm
real_type* d_aux_{nullptr}; ///< auxiliary variable needed to store partial results in FWHT application.

index_type N_{0}; ///< padded vector size
index_type log2N_{0}; ///< log2 of N_, used multiple times so we store it
real_type one_over_k_{0.0}; ///< 1/k, used many times for scaling so we store the value to avoid recomputation

// memory::MemorySpace memspace_;
// MemoryHandler mem_; ///< Device memory manager object
};
}
15 changes: 7 additions & 8 deletions resolve/random/RandomSketchingImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,28 @@ namespace ReSolve
}

namespace ReSolve
{
{
/**
* @brief Interface to random sketching implementations
*/
class RandomSketchingImpl
{
private:
using vector_type = vector::Vector;

public:
// constructor
RandomSketchingImpl()
{
}

// destructor
virtual ~RandomSketchingImpl()
{
}

// Actual sketching process
virtual int Theta(vector_type* input, vector_type* output) = 0;
virtual int Theta(vector::Vector* input, vector::Vector* output) = 0;

// Setup the parameters, sampling matrices, permuations, etc
virtual int setup(index_type n, index_type k) = 0;
// Need to use with methods that restart

// Needed for iterative methods with restarting
virtual int reset() = 0;
};
} // namespace ReSolve
4 changes: 1 addition & 3 deletions resolve/random/SketchingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
namespace ReSolve {

/**
* @brief Simple constructor
* @brief Constructor creates requested sketching method.
*
*/
SketchingHandler::SketchingHandler(SketchingMethod method, memory::MemorySpace memspace)
{
// if (vh.getIsCudaEnabled()) {
// }
switch (method)
{
case LinSolverIterativeRandFGMRES::cs:
Expand Down
9 changes: 5 additions & 4 deletions resolve/random/SketchingHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ namespace ReSolve

// Setup the parameters, sampling matrices, permuations, etc
int setup(index_type n, index_type k);
// Need to use with methods that restart

// Needed for iterative methods with restarting
int reset();

private:
RandomSketchingImpl* sketching_{nullptr}; ///< Pointer to implementation

bool isCpuEnabled_{false};
bool isCudaEnabled_{false};
bool isHipEnabled_{false};
// bool isCpuEnabled_{false};
// bool isCudaEnabled_{false};
// bool isHipEnabled_{false};
};

} // namespace ReSolve

0 comments on commit 1fb4b30

Please sign in to comment.