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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
8bc86876
Commit
8bc86876
authored
1 year ago
by
Giovanni La Mura
Browse files
Options
Downloads
Plain Diff
Rebase loval prepare_magma on remote branch
parents
ea91f54f
d4c1387f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cluster/cluster.cpp
+18
-10
18 additions, 10 deletions
src/cluster/cluster.cpp
src/include/types.h
+10
-0
10 additions, 0 deletions
src/include/types.h
src/make.inc
+54
-8
54 additions, 8 deletions
src/make.inc
with
82 additions
and
18 deletions
src/cluster/cluster.cpp
+
18
−
10
View file @
8bc86876
...
@@ -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/include/types.h
+
10
−
0
View file @
8bc86876
...
@@ -27,9 +27,15 @@ typedef __complex__ double dcomplex;
...
@@ -27,9 +27,15 @@ typedef __complex__ double dcomplex;
#ifdef USE_LAPACK
#ifdef USE_LAPACK
#ifdef USE_MKL
#ifdef USE_MKL
#ifdef USE_ILP64
#ifndef MKL_INT
#ifndef MKL_INT
#define MKL_INT int64_t
#define MKL_INT int64_t
#endif // MKL_INT
#endif // MKL_INT
#else
#ifndef MKL_INT
#define MKL_INT int32_t
#endif // MKL_INT
#endif
#include
<mkl_lapacke.h>
#include
<mkl_lapacke.h>
#else
#else
#include
<lapacke.h>
#include
<lapacke.h>
...
@@ -44,7 +50,11 @@ typedef __complex__ double dcomplex;
...
@@ -44,7 +50,11 @@ typedef __complex__ double dcomplex;
#ifdef lapack_int
#ifdef lapack_int
#define np_int lapack_int
#define np_int lapack_int
#else
#else
#ifdef USE_ILP64
#define np_int int64_t
#define np_int int64_t
#else
#define np_int int32_t
#endif // USE_ILP64
#endif // lapack_int
#endif // lapack_int
#endif // np_int
#endif // np_int
...
...
This diff is collapsed.
Click to expand it.
src/make.inc
+
54
−
8
View file @
8bc86876
...
@@ -48,32 +48,47 @@ endif
...
@@ -48,32 +48,47 @@ endif
# define (outside) USE_LAPACK for lapacke support, LAPACK_ILP64 for ilp64 interface, MKL_ILP64 the same if using MKL implementation
# define (outside) USE_LAPACK for lapacke support, LAPACK_ILP64 for ilp64 interface, MKL_ILP64 the same if using MKL implementation
ifdef
USE_LAPACK
ifdef
USE_LAPACK
# define (outside) USE_ILP64 for long long int support in lapack/mkl/magma interfaces
ifdef
USE_ILP64
ifndef
LAPACK_ILP64
ifndef
LAPACK_ILP64
override
LAPACK_ILP64
=
1
override
LAPACK_ILP64
=
1
endif
#LAPACK_ILP64
endif
endif
# define (outside) USE_MKL to use the MKL implementation of lapacke
# define (outside) USE_MKL to use the MKL implementation of lapacke
ifdef
USE_MKL
ifdef
USE_MKL
# define (outside) USE_ILP64 for long long int support in lapack/mkl/magma interfaces
ifdef
USE_ILP64
ifndef
MKL_ILP64
ifndef
MKL_ILP64
override
MKL_ILP64
=
1
override
MKL_ILP64
=
1
endif
#MKL_ILP64
endif
endif
ifndef
LAPACK_INCLUDE
ifndef
LAPACK_INCLUDE
# this is for the MKL implementation
# this is for the MKL implementation
override
LAPACK_INCLUDE
=
$
(
MKLROOT
)
/
include
override
LAPACK_INCLUDE
=
$
(
MKLROOT
)
/
include
endif
endif
#LAPACK_INCLUDE
ifndef
LAPACK_LDFLAGS
ifndef
LAPACK_LDFLAGS
# this is for the MKL implementation
# this is for the MKL implementation
# define (outside) USE_ILP64 for long long int support in lapack/mkl/magma interfaces
ifdef
USE_ILP64
override
LAPACK_LDFLAGS
=-
L
$
(
MKLROOT
)
/
lib
-
Wl
,
--
no
-
as
-
needed
-
lmkl_intel_ilp64
-
lmkl_gnu_thread
-
lmkl_core
-
lgomp
-
lpthread
-
lm
-
ldl
override
LAPACK_LDFLAGS
=-
L
$
(
MKLROOT
)
/
lib
-
Wl
,
--
no
-
as
-
needed
-
lmkl_intel_ilp64
-
lmkl_gnu_thread
-
lmkl_core
-
lgomp
-
lpthread
-
lm
-
ldl
else
override
LAPACK_LDFLAGS
=-
L
$
(
MKLROOT
)
/
lib
-
Wl
,
--
no
-
as
-
needed
-
lmkl_intel_lp64
-
lmkl_gnu_thread
-
lmkl_core
-
lgomp
-
lpthread
-
lm
-
ldl
endif
endif
endif
#LAPACK_LDFLAGS
# the next else refers to USE_MKL
# the next else refers to USE_MKL
else
else
#this is for when USE_MKL is _not_ defined
ifndef
LAPACK_INCLUDE
ifndef
LAPACK_INCLUDE
# this is for standard "vanilla" lapacke64
# this is for standard "vanilla" lapacke64
override
LAPACK_INCLUDE
=/
usr
/
include
override
LAPACK_INCLUDE
=/
usr
/
include
endif
endif
# LAPACK_INCLUDE
ifndef
LAPACK_LDFLAGS
ifndef
LAPACK_LDFLAGS
ifdef
USE_ILP64
# this is for standard "vanilla" lapacke64
# this is for standard "vanilla" lapacke64
override
LAPACK_LDFLAGS
=-
llapacke64
override
LAPACK_LDFLAGS
=-
llapacke64
else
override
LAPACK_LDFLAGS
=-
llapacke
endif
endif
endif
#LAPACK_LDFLAGS
# the next endif is for USE_MKL
# the next endif is for USE_MKL
endif
endif
#the next endif is for USE_LAPACK
#the next endif is for USE_LAPACK
...
@@ -81,7 +96,13 @@ endif
...
@@ -81,7 +96,13 @@ endif
# define (outside) USE_MAGMA for magma support
# define (outside) USE_MAGMA for magma support
ifdef
USE_MAGMA
ifdef
USE_MAGMA
MAGMA_LDFLAGS
=
-
lmagma
-
lcudart
ifdef
MAGMA_LIB
override
MAGMA_LDFLAGS
=
-
L
$
(
MAGMA_LIB
)
endif
ifdef
CUDA_HOME
override
MAGMA_LDFLAGS
+=
-
L
$
(
CUDA_HOME
)
/
lib64
endif
override
MAGMA_LDFLAGS
+=
-
lmagma
-
lcudart
#the next endif is for USE_MAGMA
#the next endif is for USE_MAGMA
endif
endif
...
@@ -92,25 +113,50 @@ ifdef USE_OPENMP
...
@@ -92,25 +113,50 @@ ifdef USE_OPENMP
override
CXXFLAGS
+=
-
fopenmp
override
CXXFLAGS
+=
-
fopenmp
# closes USE_OPENMP
# closes USE_OPENMP
endif
endif
ifdef
USE_ILP64
override
CXXFLAGS
+=
-
DUSE_ILP64
endif
ifdef
USE_LAPACK
ifdef
USE_LAPACK
override
CXXFLAGS
+=
-
DUSE_LAPACK
-
DLAPACK_ILP64
override
CXXFLAGS
+=
-
DUSE_LAPACK
ifdef
USE_ILP64
override
CXXFLAGS
+=
-
DLAPACK_ILP64
endif
# closes USE_LAPACK
endif
ifdef
USE_MKL
ifdef
USE_MKL
override
CXXFLAGS
+=
-
DMKL_ILP64
-
DUSE_MKL
-
I
$
(
MKLROOT
)
/
include
override
CXXFLAGS
+=
-
DUSE_MKL
-
I
$
(
MKLROOT
)
/
include
ifdef
USE_ILP64
override
CXXFLAGS
+=
-
DMKL_ILP64
endif
# closes USE_MKL
# closes USE_MKL
endif
endif
ifdef
USE_OPENMP
ifdef
USE_OPENMP
override
CXXFLAGS
+=
-
fopenmp
override
CXXFLAGS
+=
-
fopenmp
# closes USE_OPENMP
# closes USE_OPENMP
endif
endif
# closes USE_LAPACK
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
override
CXXFLAGS
+=
-
I
$
(
MAGMA_INCLUDE
)
endif
ifdef
USE_ILP64
override
CXXFLAGS
+=
-
DMAGMA_ILP64
endif
# closes USE_MAGMA
# closes USE_MAGMA
endif
endif
# closes CXXFLAGS
# closes CXXFLAGS
endif
endif
# HDF5_LIB defines the default path to the HDF5 libraries to use
# HDF5_LIB defines the default path to the HDF5 libraries to use
# CXXLDFLAGS defines the default linker flags to use for C++ codes
# CXXLDFLAGS defines the default linker flags to use for C++ codes
ifndef
CXXLDFLAGS
ifndef
CXXLDFLAGS
...
...
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