Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csparse-gpu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lubomir Riha
csparse-gpu
Commits
5c47f32a
Commit
5c47f32a
authored
6 years ago
by
Lubomir Riha
Browse files
Options
Downloads
Patches
Plain Diff
update2
parent
d2be194c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CSparse/Demo/Makefile.orig
+39
-0
39 additions, 0 deletions
CSparse/Demo/Makefile.orig
CSparse/Source/cs_lsolve.xxx_cubackup
+34
-0
34 additions, 0 deletions
CSparse/Source/cs_lsolve.xxx_cubackup
CSparse/Source/cs_lsolve_gpu.cu
+72
-0
72 additions, 0 deletions
CSparse/Source/cs_lsolve_gpu.cu
with
145 additions
and
0 deletions
CSparse/Demo/Makefile.orig
0 → 100644
+
39
−
0
View file @
5c47f32a
CF
=
$(
CFLAGS
)
$(
CPPFLAGS
)
$(
TARGET_ARCH
)
-O
I
=
-I
../Include
CC
=
/usr/local/cuda/bin/nvcc
-g
LDLIBS
+=
-lm
CS
=
$(
LDFLAGS
)
../Lib/libcsparse.a
$(
LDLIBS
)
all
:
lib cs_demo1 cs_demo2 cs_demo3
-
./cs_demo1 < ../Matrix/t1
-
./cs_demo2 < ../Matrix/t1
-
./cs_demo2 < ../Matrix/ash219
-
./cs_demo2 < ../Matrix/bcsstk01
-
./cs_demo2 < ../Matrix/fs_183_1
-
./cs_demo2 < ../Matrix/mbeacxc
-
./cs_demo2 < ../Matrix/west0067
-
./cs_demo2 < ../Matrix/lp_afiro
-
./cs_demo2 < ../Matrix/bcsstk16
-
./cs_demo3 < ../Matrix/bcsstk01
-
./cs_demo3 < ../Matrix/bcsstk16
lib
:
(
cd
../Lib
;
$(
MAKE
)
)
cs_demo1
:
lib cs_demo1.c Makefile
$(
CC
)
$(
CF
)
$(
I
)
-o
cs_demo1 cs_demo1.c
$(
CS
)
cs_demo2
:
lib cs_demo2.c cs_demo.c cs_demo.h Makefile
$(
CC
)
$(
CF
)
$(
I
)
-o
cs_demo2 cs_demo2.c cs_demo.c
$(
CS
)
cs_demo3
:
lib cs_demo3.c cs_demo.c cs_demo.h Makefile
$(
CC
)
$(
CF
)
$(
I
)
-o
cs_demo3 cs_demo3.c cs_demo.c
$(
CS
)
clean
:
-
$(
RM
)
*
.o
purge
:
distclean
distclean
:
clean
-
$(
RM
)
-r
cs_demo1 cs_demo2 cs_demo3
*
.a
*
.dSYM
*
.obj
*
.dll
This diff is collapsed.
Click to expand it.
CSparse/Source/cs_lsolve.xxx_cubackup
0 → 100644
+
34
−
0
View file @
5c47f32a
#include "cs.h"
///* solve Lx=b where x and b are dense. x=b on input, solution on output. */
//__global__
//void cs_lsolve_gpu (int n, const int *Lp, const int *Li, const double *Lx, double *x)
//{
// int p, j;
//
// // double *Lx ;
// // n = L->n ;
// // Lp = L->p ;
// // Li = L->i ;
// // Lx = L->x ;
//
// for (j = 0 ; j < n ; j++)
// {
// x [j] /= Lx [Lp [j]] ;
// for (p = Lp [j]+1 ; p < Lp [j+1] ; p++)
// {
// x [Li [p]] -= Lx [p] * x [j] ;
// }
// }
//
// //return (1);
//}
This diff is collapsed.
Click to expand it.
CSparse/Source/cs_lsolve_gpu.cu
0 → 100644
+
72
−
0
View file @
5c47f32a
#include
"cs.h"
///* solve Lx=b where x and b are dense. x=b on input, solution on output. */
///*
//csi cs_lsolve (const cs *L, double *x)
//{
// csi p, j, n, *Lp, *Li ;
// double *Lx ;
// if (!CS_CSC (L) || !x) return (0) ; /* check inputs */
// n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;
// for (j = 0 ; j < n ; j++)
// {
// x [j] /= Lx [Lp [j]] ;
// for (p = Lp [j]+1 ; p < Lp [j+1] ; p++)
// {
// x [Li [p]] -= Lx [p] * x [j] ;
// }
// }
// return (1) ;
//}
//*/
/* solve Lx=b where x and b are dense. x=b on input, solution on output. */
//csi cs_lsolve_gpu (const cs *L, double *x)
// typedef struct cs_sparse /* matrix in compressed-column or triplet form */
// {
// csi nzmax ; /* maximum number of entries */
// csi m ; /* number of rows */
// csi n ; /* number of columns */
// csi *p ; /* column pointers (size n+1) or col indices (size nzmax) */
// csi *i ; /* row indices, size nzmax */
// double *x ; /* numerical values, size nzmax */
// csi nz ; /* # of entries in triplet matrix, -1 for compressed-col */
// } cs ;
__global__
void
cs_lsolve_gpu
(
int
n
,
const
int
*
Lp
,
const
int
*
Li
,
const
double
*
Lx
,
double
*
x
)
{
int
p
,
j
;
// double *Lx ;
// n = L->n ;
// Lp = L->p ;
// Li = L->i ;
// Lx = L->x ;
for
(
j
=
0
;
j
<
n
;
j
++
)
{
x
[
j
]
/=
Lx
[
Lp
[
j
]]
;
for
(
p
=
Lp
[
j
]
+
1
;
p
<
Lp
[
j
+
1
]
;
p
++
)
{
x
[
Li
[
p
]]
-=
Lx
[
p
]
*
x
[
j
]
;
printf
(
"GPU: %f"
,
x
[
Li
[
p
]]);
}
}
//return (1);
}
extern
"C"
{
void
cs_lsolve_acc
(
int
n
,
const
int
*
Lp
,
const
int
*
Li
,
const
double
*
Lx
,
double
*
x
)
{
cs_lsolve_gpu
<<<
1
,
1
>>>
(
n
,
Lp
,
Li
,
Lx
,
x
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment