Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_devices
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_devices
Commits
c4dd3cff
Commit
c4dd3cff
authored
3 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Optimizing TLS version
parent
6d8f28cc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#4092
failed
3 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/util/cudify/cudify_openmp.hpp
+22
-8
22 additions, 8 deletions
src/util/cudify/cudify_openmp.hpp
src/util/cudify/cudify_vars.cpp
+8
-0
8 additions, 0 deletions
src/util/cudify/cudify_vars.cpp
with
30 additions
and
8 deletions
src/util/cudify/cudify_openmp.hpp
+
22
−
8
View file @
c4dd3cff
...
...
@@ -293,6 +293,16 @@ static void init_wrappers()
{
n_workers
=
omp_get_num_threads
();
}
#pragma omp parallel for
for
(
int
s
=
0
;
s
<
n_workers
;
s
++
)
{
unsigned
int
tid
=
omp_get_thread_num
();
tid_x
[
tid
]
=
&
threadIdx
.
x
;
tid_y
[
tid
]
=
&
threadIdx
.
y
;
tid_z
[
tid
]
=
&
threadIdx
.
z
;
}
}
...
...
@@ -340,6 +350,10 @@ void launch_kernel(boost::context::detail::transfer_t par)
boost
::
context
::
detail
::
jump_fcontext
(
par
.
fctx
,
0
);
}
extern
unsigned
int
*
tid_x
[
OPENMP_MAX_NUM_THREADS
];
extern
unsigned
int
*
tid_y
[
OPENMP_MAX_NUM_THREADS
];
extern
unsigned
int
*
tid_z
[
OPENMP_MAX_NUM_THREADS
];
template
<
typename
lambda_f
,
typename
ite_type
>
static
void
exe_kernel
(
lambda_f
f
,
ite_type
&
ite
)
{
...
...
@@ -380,10 +394,10 @@ static void exe_kernel(lambda_f f, ite_type & ite)
{
for
(
int
k
=
0
;
k
<
ite
.
wthr
.
x
;
k
++
)
{
size_t
tid
=
omp_get_thread_num
();
if
(
first_block
==
true
||
is_sync_free
==
false
)
{
size_t
tid
=
omp_get_thread_num
();
blockIdx
.
z
=
i
;
blockIdx
.
y
=
j
;
blockIdx
.
x
=
k
;
...
...
@@ -408,13 +422,13 @@ static void exe_kernel(lambda_f f, ite_type & ite)
// Work threads
for
(
int
it
=
0
;
it
<
ite
.
thr
.
z
;
it
++
)
{
threadIdx
.
z
=
it
;
*
tid_z
[
tid
]
=
it
;
for
(
int
jt
=
0
;
jt
<
ite
.
thr
.
y
;
jt
++
)
{
threadIdx
.
y
=
jt
;
*
tid_y
[
tid
]
=
jt
;
for
(
int
kt
=
0
;
kt
<
ite
.
thr
.
x
;
kt
++
)
{
threadIdx
.
x
=
kt
;
*
tid_x
[
tid
]
=
kt
;
auto
t
=
boost
::
context
::
detail
::
jump_fcontext
(
contexts
[
nc
+
tid
*
stride
],
&
fe
);
contexts
[
nc
+
tid
*
stride
]
=
t
.
fctx
;
...
...
@@ -435,13 +449,13 @@ static void exe_kernel(lambda_f f, ite_type & ite)
// Work threads
for
(
int
it
=
0
;
it
<
ite
.
thr
.
z
;
it
++
)
{
threadIdx
.
z
=
it
;
*
tid_z
[
tid
]
=
it
;
for
(
int
jt
=
0
;
jt
<
ite
.
thr
.
y
;
jt
++
)
{
threadIdx
.
y
=
jt
;
*
tid_y
[
tid
]
=
jt
;
for
(
int
kt
=
0
;
kt
<
ite
.
thr
.
x
;
kt
++
)
{
threadIdx
.
x
=
kt
;
*
tid_x
[
tid
]
=
kt
;
f
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/util/cudify/cudify_vars.cpp
+
8
−
0
View file @
c4dd3cff
...
...
@@ -17,6 +17,14 @@ alpa_base_structs __alpa_base__;
thread_local
dim3
threadIdx
;
thread_local
dim3
blockIdx
;
#ifndef OPENMP_MAX_NUM_THREADS
#define OPENMP_MAX_NUM_THREADS 896
#endif
unsigned
int
*
tid_x
[
OPENMP_MAX_NUM_THREADS
];
unsigned
int
*
tid_y
[
OPENMP_MAX_NUM_THREADS
];
unsigned
int
*
tid_z
[
OPENMP_MAX_NUM_THREADS
];
dim3
blockDim
;
dim3
gridDim
;
...
...
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