Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
fd465c15
Commit
fd465c15
authored
10 months ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Save the result of magma_zinvert in the err variable
parent
1952ceed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libnptm/magma_calls.cpp
+5
-10
5 additions, 10 deletions
src/libnptm/magma_calls.cpp
with
5 additions
and
10 deletions
src/libnptm/magma_calls.cpp
+
5
−
10
View file @
fd465c15
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
void
magma_zinvert
(
dcomplex
**
mat
,
np_int
n
,
int
&
jer
)
{
void
magma_zinvert
(
dcomplex
**
mat
,
np_int
n
,
int
&
jer
)
{
// magma_int_t result = magma_init();
// magma_int_t result = magma_init();
magma_int_t
result
=
MAGMA_SUCCESS
;
magma_int_t
err
=
MAGMA_SUCCESS
;
magma_queue_t
queue
=
NULL
;
magma_queue_t
queue
=
NULL
;
magma_int_t
dev
=
0
;
magma_int_t
dev
=
0
;
magma_queue_create
(
dev
,
&
queue
);
magma_queue_create
(
dev
,
&
queue
);
...
@@ -24,28 +24,23 @@ void magma_zinvert(dcomplex **mat, np_int n, int &jer) {
...
@@ -24,28 +24,23 @@ void magma_zinvert(dcomplex **mat, np_int n, int &jer) {
magma_int_t
*
piv
,
info
;
// piv - array of indices of inter -
magma_int_t
*
piv
,
info
;
// piv - array of indices of inter -
magma_int_t
m
=
(
magma_int_t
)
n
;
// changed rows; a - mxm matrix
magma_int_t
m
=
(
magma_int_t
)
n
;
// changed rows; a - mxm matrix
magma_int_t
mm
=
m
*
m
;
// size of a, r, c
magma_int_t
mm
=
m
*
m
;
// size of a, r, c
magmaDoubleComplex
*
a
=
(
magmaDoubleComplex
*
)
&
(
mat
[
0
][
0
]);
// a- mxm matrix on the host
magmaDoubleComplex
*
a
=
(
magmaDoubleComplex
*
)
&
(
mat
[
0
][
0
]);
// a
- mxm matrix on the host
magmaDoubleComplex
*
d_a
;
// d_a - mxm matrix a on the device
magmaDoubleComplex
*
d_a
;
// d_a - mxm matrix a on the device
magma_int_t
err
;
ldwork
=
m
*
magma_get_zgetri_nb
(
m
);
// optimal block size
ldwork
=
m
*
magma_get_zgetri_nb
(
m
);
// optimal block size
// allocate matrices
// allocate matrices
err
=
magma_zmalloc
(
&
d_a
,
mm
);
// device memory for a
err
=
magma_zmalloc
(
&
d_a
,
mm
);
// device memory for a
err
=
magma_zmalloc
(
&
dwork
,
ldwork
);
// dev. mem. for ldwork
err
=
magma_zmalloc
(
&
dwork
,
ldwork
);
// dev. mem. for ldwork
piv
=
(
magma_int_t
*
)
malloc
(
m
*
sizeof
(
magma_int_t
))
;
// host mem.
piv
=
new
magma_int_t
[
m
]
;
// host mem.
magma_zsetmatrix
(
m
,
m
,
a
,
m
,
d_a
,
m
,
queue
);
// copy a -> d_a
magma_zsetmatrix
(
m
,
m
,
a
,
m
,
d_a
,
m
,
queue
);
// copy a -> d_a
// find the inverse matrix: d_a*X=I using the LU factorization
// with partial pivoting and row interchanges computed by
// magma_zgetrf_gpu; row i is interchanged with row piv(i);
// d_a - mxm matrix; d_a is overwritten by the inverse
magma_zgetrf_gpu
(
m
,
m
,
d_a
,
m
,
piv
,
&
info
);
magma_zgetrf_gpu
(
m
,
m
,
d_a
,
m
,
piv
,
&
info
);
magma_zgetri_gpu
(
m
,
d_a
,
m
,
piv
,
dwork
,
ldwork
,
&
info
);
magma_zgetri_gpu
(
m
,
d_a
,
m
,
piv
,
dwork
,
ldwork
,
&
info
);
magma_zgetmatrix
(
m
,
m
,
d_a
,
m
,
a
,
m
,
queue
);
// copy d_a -> a
magma_zgetmatrix
(
m
,
m
,
d_a
,
m
,
a
,
m
,
queue
);
// copy d_a -> a
free
(
piv
)
;
// free host memory
delete
[]
piv
;
// free host memory
magma_free
(
d_a
);
// free device memory
magma_free
(
d_a
);
// free device memory
magma_queue_destroy
(
queue
);
// destroy queue
magma_queue_destroy
(
queue
);
// destroy queue
// result = magma_finalize();
// result = magma_finalize();
jer
=
(
int
)
result
;
jer
=
(
int
)
err
;
}
}
#endif
#endif
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