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
d4c1387f
Commit
d4c1387f
authored
1 year ago
by
Mulas, Giacomo
Browse files
Options
Downloads
Patches
Plain Diff
correct inconsistent devices between cuda and magma in case of ilp64
parent
3cb7c92e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cluster/cluster.cpp
+18
-10
18 additions, 10 deletions
src/cluster/cluster.cpp
src/make.inc
+9
-4
9 additions, 4 deletions
src/make.inc
with
27 additions
and
14 deletions
src/cluster/cluster.cpp
+
18
−
10
View file @
d4c1387f
...
@@ -95,24 +95,28 @@ void cluster(const string& config_file, const string& data_file, const string& o
...
@@ -95,24 +95,28 @@ void cluster(const string& config_file, const string& data_file, const string& o
cudaGetDeviceCount
(
&
device_count
);
cudaGetDeviceCount
(
&
device_count
);
logger
->
log
(
"DEBUG: Proc-"
+
to_string
(
mpidata
->
rank
)
+
" found "
+
to_string
(
device_count
)
+
" CUDA devices.
\n
"
,
LOG_DEBG
);
logger
->
log
(
"DEBUG: Proc-"
+
to_string
(
mpidata
->
rank
)
+
" found "
+
to_string
(
device_count
)
+
" CUDA devices.
\n
"
,
LOG_DEBG
);
logger
->
log
(
"INFO: Process "
+
to_string
(
mpidata
->
rank
)
+
" initializes MAGMA.
\n
"
);
logger
->
log
(
"INFO: Process "
+
to_string
(
mpidata
->
rank
)
+
" initializes MAGMA.
\n
"
);
magma_device_t
*
devices
=
new
magma_device_t
[
device_count
];
magma_device_t
*
magmadevices
=
new
magma_device_t
[
device_count
];
cudaSetValidDevices
(
devices
,
device_count
);
int
*
cudadevices
=
new
int
[
device_count
];
cudaSetValidDevices
(
cudadevices
,
device_count
);
for
(
int
ci
=
0
;
ci
<
device_count
;
ci
++
)
magmadevices
[
ci
]
=
(
magma_device_t
)
cudadevices
[
ci
];
magma_int_t
num_devices
;
magma_int_t
num_devices
;
magma_getdevices
(
devices
,
device_count
,
&
num_devices
);
magma_getdevices
(
magma
devices
,
device_count
,
&
num_devices
);
logger
->
log
(
"DEBUG: Proc-"
+
to_string
(
mpidata
->
rank
)
+
" found "
+
to_string
(
num_devices
)
+
" MAGMA devices.
\n
"
,
LOG_DEBG
);
logger
->
log
(
"DEBUG: Proc-"
+
to_string
(
mpidata
->
rank
)
+
" found "
+
to_string
(
num_devices
)
+
" MAGMA devices.
\n
"
,
LOG_DEBG
);
magma_int_t
magma_result
=
magma_init
();
magma_int_t
magma_result
=
magma_init
();
if
(
magma_result
!=
MAGMA_SUCCESS
)
{
if
(
magma_result
!=
MAGMA_SUCCESS
)
{
logger
->
err
(
"ERROR: Process "
+
to_string
(
mpidata
->
rank
)
+
" failed to initilize MAGMA.
\n
"
);
logger
->
err
(
"ERROR: Process "
+
to_string
(
mpidata
->
rank
)
+
" failed to initilize MAGMA.
\n
"
);
logger
->
err
(
"PROC-"
+
to_string
(
mpidata
->
rank
)
+
": MAGMA error code "
+
to_string
(
magma_result
)
+
"
\n
"
);
logger
->
err
(
"PROC-"
+
to_string
(
mpidata
->
rank
)
+
": MAGMA error code "
+
to_string
(
magma_result
)
+
"
\n
"
);
fclose
(
timing_file
);
fclose
(
timing_file
);
delete
[]
devices
;
delete
[]
magmadevices
;
delete
[]
cudadevices
;
delete
time_logger
;
delete
time_logger
;
delete
logger
;
delete
logger
;
return
;
return
;
}
}
#else
#else
int
*
devices
=
new
int
[
1
];
int
*
cudadevices
=
new
int
[
1
];
devices
[
0
]
=
-
1
;
int
*
magmadevices
=
new
int
[
1
];
cudadevices
[
0
]
=
magmadevices
[
0
]
=
-
1
;
#endif
#endif
// the following only happens on MPI process 0
// the following only happens on MPI process 0
if
(
mpidata
->
rank
==
0
)
{
if
(
mpidata
->
rank
==
0
)
{
...
@@ -125,7 +129,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
...
@@ -125,7 +129,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
string
message
=
"FILE: "
+
string
(
ex
.
what
())
+
"
\n
"
;
string
message
=
"FILE: "
+
string
(
ex
.
what
())
+
"
\n
"
;
logger
->
err
(
message
);
logger
->
err
(
message
);
fclose
(
timing_file
);
fclose
(
timing_file
);
delete
[]
devices
;
delete
[]
cudadevices
;
delete
[]
magmadevices
;
delete
time_logger
;
delete
time_logger
;
delete
logger
;
delete
logger
;
return
;
return
;
...
@@ -142,7 +147,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
...
@@ -142,7 +147,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
logger
->
err
(
message
);
logger
->
err
(
message
);
if
(
sconf
)
delete
sconf
;
if
(
sconf
)
delete
sconf
;
fclose
(
timing_file
);
fclose
(
timing_file
);
delete
[]
devices
;
delete
[]
cudadevices
;
delete
[]
magmadevices
;
delete
time_logger
;
delete
time_logger
;
delete
logger
;
delete
logger
;
return
;
return
;
...
@@ -248,7 +254,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
...
@@ -248,7 +254,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
tppoan
.
close
();
tppoan
.
close
();
fclose
(
timing_file
);
fclose
(
timing_file
);
fclose
(
output
);
fclose
(
output
);
delete
[]
devices
;
delete
[]
magmadevices
;
delete
[]
cudadevices
;
delete
p_scattering_angles
;
delete
p_scattering_angles
;
delete
cid
;
delete
cid
;
delete
logger
;
delete
logger
;
...
@@ -558,7 +565,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
...
@@ -558,7 +565,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
}
}
}
}
// Clean memory
// Clean memory
delete
[]
devices
;
delete
[]
magmadevices
;
delete
[]
cudadevices
;
delete
cid
;
delete
cid
;
delete
p_scattering_angles
;
delete
p_scattering_angles
;
delete
sconf
;
delete
sconf
;
...
...
This diff is collapsed.
Click to expand it.
src/make.inc
+
9
−
4
View file @
d4c1387f
...
@@ -97,10 +97,12 @@ endif
...
@@ -97,10 +97,12 @@ endif
# define (outside) USE_MAGMA for magma support
# define (outside) USE_MAGMA for magma support
ifdef
USE_MAGMA
ifdef
USE_MAGMA
ifdef
MAGMA_LIB
ifdef
MAGMA_LIB
MAGMA_LDFLAGS
=
-
L
$MAGMA_LIB
-
lmagma
-
lcudart
override
MAGMA_LDFLAGS
=
-
L
$
(
MAGMA_LIB
)
else
endif
MAGMA_LDFLAGS
=
-
lmagma
-
lcudart
ifdef
CUDA_HOME
override
MAGMA_LDFLAGS
+=
-
L
$
(
CUDA_HOME
)
/
lib64
endif
endif
override
MAGMA_LDFLAGS
+=
-
lmagma
-
lcudart
#the next endif is for USE_MAGMA
#the next endif is for USE_MAGMA
endif
endif
...
@@ -139,8 +141,11 @@ endif
...
@@ -139,8 +141,11 @@ endif
ifdef
USE_MAGMA
ifdef
USE_MAGMA
override
CXXFLAGS
+=
-
DUSE_MAGMA
override
CXXFLAGS
+=
-
DUSE_MAGMA
ifdef
CUDA_HOME
override
CXXFLAGS
+=
-
I
$
(
CUDA_HOME
)
/
include
endif
ifdef
MAGMA_INCLUDE
ifdef
MAGMA_INCLUDE
override
CXXFLAGS
+=
-
I
$MAGMA_INCLUDE
override
CXXFLAGS
+=
-
I
$
(
MAGMA_INCLUDE
)
endif
endif
ifdef
USE_ILP64
ifdef
USE_ILP64
override
CXXFLAGS
+=
-
DMAGMA_ILP64
override
CXXFLAGS
+=
-
DMAGMA_ILP64
...
...
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