Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calng
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
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
calibration
calng
Commits
97d8e93f
Commit
97d8e93f
authored
2 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Improve buffer initialization, skip pinning for CPU device
parent
5117aadc
No related branches found
No related tags found
1 merge request
!12
Snapshot: field test deployed version as of end of run 202201
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/calng/Gotthard2Correction.py
+1
-0
1 addition, 0 deletions
src/calng/Gotthard2Correction.py
src/calng/base_correction.py
+4
-2
4 additions, 2 deletions
src/calng/base_correction.py
src/calng/shmem_utils.py
+3
-5
3 additions, 5 deletions
src/calng/shmem_utils.py
with
8 additions
and
7 deletions
src/calng/Gotthard2Correction.py
+
1
−
0
View file @
97d8e93f
...
...
@@ -200,6 +200,7 @@ class Gotthard2Correction(BaseCorrection):
_image_data_path
=
"
data.adc
"
_cell_table_path
=
"
data.memoryCell
"
_warn_memory_cell_range
=
False
# for now, receiver always writes 255
_cuda_pin_buffers
=
False
@staticmethod
def
expectedParameters
(
expected
):
...
...
This diff is collapsed.
Click to expand it.
src/calng/base_correction.py
+
4
−
2
View file @
97d8e93f
...
...
@@ -197,6 +197,7 @@ class BaseCorrection(PythonDevice):
_image_data_path
=
"
image.data
"
# customize for *some* subclasses
_cell_table_path
=
"
image.cellId
"
_warn_memory_cell_range
=
True
# can be disabled for some detectors
_cuda_pin_buffers
=
True
def
_load_constant_to_runner
(
self
,
constant_name
,
constant_data
):
"""
Subclass must define how to process constants into correction maps and store
...
...
@@ -894,8 +895,9 @@ class BaseCorrection(PythonDevice):
self
.
output_data_dtype
,
shmem_buffer_name
,
)
self
.
log
.
INFO
(
"
Trying to pin the shmem buffer memory
"
)
self
.
_shmem_buffer
.
cuda_pin
()
if
self
.
_cuda_pin_buffers
:
self
.
log
.
INFO
(
"
Trying to pin the shmem buffer memory
"
)
self
.
_shmem_buffer
.
cuda_pin
()
self
.
log
.
INFO
(
"
Done, shmem buffer is ready
"
)
else
:
self
.
_shmem_buffer
.
change_shape
(
self
.
output_data_shape
)
...
...
This diff is collapsed.
Click to expand it.
src/calng/shmem_utils.py
+
3
−
5
View file @
97d8e93f
...
...
@@ -67,8 +67,6 @@ class ShmemCircularBuffer:
self
.
_buffer_ary
=
None
self
.
_update_shape
(
array_shape
,
dtype
)
self
.
_cuda_pinned
=
False
# important for performance and pinning: touch memory to actually allocate
self
.
_buffer_ary
.
fill
(
0
)
def
_update_shape
(
self
,
array_shape
,
dtype
):
array_shape
=
tuple
(
array_shape
)
...
...
@@ -101,16 +99,16 @@ class ShmemCircularBuffer:
def
cuda_pin
(
self
):
import
cupy
self
.
_memory_pointer
=
self
.
_buffer_ary
.
ctypes
.
get_data
()
cupy
.
cuda
.
runtime
.
hostRegister
(
self
.
_memory_pointer
,
self
.
_shared_memory
.
size
,
0
self
.
_memory_pointer
,
self
.
_shared_memory
.
size
,
0
)
def
__del__
(
self
):
if
self
.
_cuda_pinned
:
import
cupy
cupy
.
cuda
.
runtime
.
hostUnregister
(
self
.
_memory_pointer
)
del
self
.
_buffer_ary
del
self
.
_shared_memory
...
...
This diff is collapsed.
Click to expand it.
David Hammer
@hammerd
mentioned in commit
3566342d
·
2 years ago
mentioned in commit
3566342d
mentioned in commit 3566342d031db1bb435b6430f100afdbaaa6c4bf
Toggle commit list
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