-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #416 from DrTimothyAldenDavis/dev2
7.2.1
- Loading branch information
Showing
36 changed files
with
650 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The following files must be exact copies of the files in | ||
SuiteSparse_GPURuntime/Include: | ||
|
||
SuiteSparseGPU_debug.hpp | ||
SuiteSparseGPU_internal.hpp | ||
SuiteSparseGPU_macros.hpp | ||
SuiteSparseGPU_Workspace.hpp | ||
SuiteSparseGPU_workspace_macros.hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// ============================================================================= | ||
// === SuiteSparse_GPURuntime/Include/SuiteSparseGPU_Workspace.hpp ============= | ||
// ============================================================================= | ||
|
||
// SuiteSparse_GPURuntime, Copyright (c) 2013-2016, Timothy A Davis, | ||
// Sencer Nuri Yeralan, and Sanjay Ranka. All Rights Reserved. | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef SUITESPARSE_GPURUNTIME_WORKSPACE_HPP | ||
#define SUITESPARSE_GPURUNTIME_WORKSPACE_HPP | ||
|
||
#include "SuiteSparseGPU_internal.hpp" | ||
|
||
class Workspace | ||
{ | ||
private: | ||
|
||
size_t nitems; // number of items to allocate | ||
size_t size_of_item; // size of each item, in bytes | ||
size_t totalSize; // nitems * size_of_item | ||
|
||
// bool lazyAllocate; // no longer used (for possible future use) | ||
bool pageLocked; // true if CPU memory is pagelocked | ||
|
||
void *cpuReference; // pointer to CPU memory | ||
void *gpuReference; // pointer to GPU memory | ||
|
||
public: | ||
// Read-Only Properties | ||
size_t getCount(void){ return nitems; } | ||
size_t getStride(void){ return size_of_item; } | ||
void *cpu(void){ return cpuReference; } | ||
void *gpu(void){ return gpuReference; } | ||
|
||
// Constructor/Destructor | ||
void *operator new(size_t bytes, Workspace* ptr){ return ptr; } | ||
Workspace(size_t nitems, size_t size_of_item); | ||
~Workspace(); | ||
|
||
// Memory management wrappers | ||
static void *cpu_malloc(size_t nitems, size_t size_of_item, | ||
bool pageLocked=false); | ||
static void *cpu_calloc(size_t nitems, size_t size_of_item, | ||
bool pageLocked=false); | ||
static void *cpu_free(void *address, bool pageLocked = false); | ||
static void *gpu_malloc(size_t nitems, size_t size_of_item); | ||
static void *gpu_calloc(size_t nitems, size_t size_of_item); | ||
static void *gpu_free(void *); | ||
|
||
// Workspace management | ||
static Workspace *allocate | ||
( | ||
size_t nitems, // number of items to allocate | ||
size_t size_of_item, // size of each item, in bytes | ||
bool doCalloc = false, // if true, then calloc; else malloc | ||
bool cpuAlloc = true, // if true, then allocate CPU memory | ||
bool gpuAlloc = true, // if true, then allocate GPU memory | ||
bool pageLocked = false // true if CPU memory is pagelocked | ||
); | ||
|
||
// destroy workspace, freeing memory on both the CPU and GPU | ||
static Workspace *destroy | ||
( | ||
Workspace *address | ||
); | ||
|
||
// Reference manipulation functions | ||
template <typename T> void extract(T *cpu_arg, T *gpu_arg) | ||
{ | ||
*cpu_arg = (T) cpuReference; | ||
*gpu_arg = (T) gpuReference; | ||
} | ||
void assign(void *cpu_arg, void *gpu_arg) | ||
{ | ||
cpuReference = cpu_arg; | ||
gpuReference = gpu_arg; | ||
} | ||
|
||
// unused, left commented out for possible future use | ||
// void setLazy() | ||
// { | ||
// lazyAllocate = true; | ||
// } | ||
|
||
// Memory management for workspaces | ||
virtual bool ws_malloc(bool cpuAlloc = true, bool gpuAlloc = true); | ||
virtual bool ws_calloc(bool cpuAlloc = true, bool gpuAlloc = true); | ||
virtual void ws_free(bool cpuFree=true, bool gpuFree=true); | ||
|
||
// GPU-CPU transfer routines | ||
virtual bool transfer(cudaMemcpyKind direction, bool synchronous=true, | ||
cudaStream_t stream=0); | ||
|
||
// CPU & GPU memory functions | ||
// memset functions unused, left commented out for possible future use | ||
// bool gpu_memset(size_t newValue); | ||
// bool cpu_memset(size_t newValue); | ||
|
||
// Debug | ||
#if DEBUG_ATLEAST_ERRORONLY | ||
static void print(Workspace *workspace) | ||
{ | ||
printf ( | ||
"(%ld,%ld) has %ld entries of size %ld each.\n", | ||
(size_t) workspace->cpu(), | ||
(size_t) workspace->gpu(), | ||
workspace->getCount(), | ||
workspace->getStride() | ||
); | ||
} | ||
#endif | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// ============================================================================= | ||
// === SuiteSparse_GPURuntime/Include/SuiteSparseGPU_debug.hpp ================= | ||
// ============================================================================= | ||
|
||
// SuiteSparse_GPURuntime, Copyright (c) 2013-2016, Timothy A Davis, | ||
// Sencer Nuri Yeralan, and Sanjay Ranka. All Rights Reserved. | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef SUITESPARSE_GPURUNTIME_DEBUG_HPP | ||
#define SUITESPARSE_GPURUNTIME_DEBUG_HPP | ||
|
||
#define GPURUNTIME_DLEVEL_OFF 0 | ||
#define GPURUNTIME_DLEVEL_ERRORONLY 1 | ||
#define GPURUNTIME_DLEVEL_CASUAL 2 | ||
#define GPURUNTIME_DLEVEL_VERBOSE 3 | ||
#define GPURUNTIME_DLEVEL_EXTREME 4 | ||
|
||
//------------------------------------------------------------------------------ | ||
// force debugging off | ||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef NDEBUG | ||
#define NDEBUG | ||
#endif | ||
|
||
// uncomment this line to turn on debugging | ||
// #undef NDEBUG | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef NDEBUG | ||
#define GPURUNTIME_DLEVEL GPURUNTIME_DLEVEL_CASUAL | ||
#else | ||
// no debugging | ||
#define GPURUNTIME_DLEVEL GPURUNTIME_DLEVEL_OFF | ||
#endif | ||
|
||
#define DEBUG_ATLEAST_ERRORONLY (GPURUNTIME_DLEVEL >= GPURUNTIME_DLEVEL_ERRORONLY) | ||
#define DEBUG_ATLEAST_CASUAL (GPURUNTIME_DLEVEL >= GPURUNTIME_DLEVEL_CASUAL) | ||
#define DEBUG_ATLEAST_VERBOSE (GPURUNTIME_DLEVEL >= GPURUNTIME_DLEVEL_VERBOSE) | ||
#define DEBUG_ATLEAST_EXTREME (GPURUNTIME_DLEVEL >= GPURUNTIME_DLEVEL_EXTREME) | ||
|
||
#ifndef GPURUNTIME_LOGFILE_PATH | ||
#define GPURUNTIME_LOGFILE_PATH "SuiteSparse_GPURuntime-logfile.txt" | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// ============================================================================= | ||
// SuiteSparse_GPURuntime/Include/SuiteSparseGPU_internal.hpp | ||
// ============================================================================= | ||
|
||
// SuiteSparse_GPURuntime, Copyright (c) 2013-2016, Timothy A Davis, | ||
// Sencer Nuri Yeralan, and Sanjay Ranka. All Rights Reserved. | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef SUITESPARSEGPU_INTERNAL_HPP | ||
#define SUITESPARSEGPU_INTERNAL_HPP | ||
|
||
#ifdef SUITESPARSE_CUDA | ||
|
||
#include "cuda_runtime.h" | ||
#include "SuiteSparse_config.h" | ||
|
||
#include <stdlib.h> | ||
|
||
#include "SuiteSparseGPU_macros.hpp" | ||
|
||
#if DEBUG_ATLEAST_ERRORONLY | ||
#include <stdio.h> | ||
#endif | ||
|
||
class Workspace; | ||
|
||
#include "SuiteSparseGPU_Workspace.hpp" | ||
|
||
#endif | ||
|
||
#include "SuiteSparse_GPURuntime.hpp" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// ============================================================================= | ||
// === SuiteSparse_GPURuntime/Include/SuiteSparseGPU_macros.hpp ================ | ||
// ============================================================================= | ||
|
||
// SuiteSparse_GPURuntime, Copyright (c) 2013-2016, Timothy A Davis, | ||
// Sencer Nuri Yeralan, and Sanjay Ranka. All Rights Reserved. | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef SUITESPARSE_GPURUNTIME_MACROS_HPP | ||
#define SUITESPARSE_GPURUNTIME_MACROS_HPP | ||
|
||
#ifndef IMPLIES | ||
#define IMPLIES(p,q) (!(p) || ((p) && (q))) | ||
#endif | ||
|
||
#include "SuiteSparseGPU_debug.hpp" | ||
#include "SuiteSparseGPU_workspace_macros.hpp" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// ============================================================================= | ||
// SuiteSparse_GPURuntime/Include/SuiteSparseGPU_workspace_macros.hpp | ||
// ============================================================================= | ||
|
||
// SuiteSparse_GPURuntime, Copyright (c) 2013-2016, Timothy A Davis, | ||
// Sencer Nuri Yeralan, and Sanjay Ranka. All Rights Reserved. | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#ifndef SUITESPARSE_GPURUNTIME_WORKSPACE_MACROS_HPP | ||
#define SUITESPARSE_GPURUNTIME_WORKSPACE_MACROS_HPP | ||
|
||
#ifndef GPU_REFERENCE | ||
#define GPU_REFERENCE(WORKSPACE, TYPE) \ | ||
((TYPE) (WORKSPACE != NULL ? (WORKSPACE)->gpu() : NULL)) | ||
#endif | ||
|
||
#ifndef CPU_REFERENCE | ||
#define CPU_REFERENCE(WORKSPACE, TYPE) \ | ||
((TYPE) (WORKSPACE != NULL ? (WORKSPACE)->cpu() : NULL)) | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
\title{Mongoose User Guide, Version 3.2.0} | ||
\title{Mongoose User Guide, Version 3.2.1} | ||
\author{Scott Kolodziej, Nuri Yeralan, Tim Davis, William W. Hager} | ||
\date{Sept 8, 2023} | ||
\date{Sept 18, 2023} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.