Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pairs
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
software
pairs
Commits
276b8405
Commit
276b8405
authored
2 years ago
by
Rafael Ravedutti
Browse files
Options
Downloads
Patches
Plain Diff
Add device functions to header
Signed-off-by:
Rafael Ravedutti
<
rafaelravedutti@gmail.com
>
parent
446868a3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
runtime/devices/cuda.cu
+0
-11
0 additions, 11 deletions
runtime/devices/cuda.cu
runtime/devices/device.hpp
+16
-3
16 additions, 3 deletions
runtime/devices/device.hpp
with
16 additions
and
14 deletions
runtime/devices/cuda.cu
+
0
−
11
View file @
276b8405
...
@@ -41,15 +41,4 @@ __host__ void copy_static_symbol_to_host(void *d_ptr, const void *h_ptr, size_t
...
@@ -41,15 +41,4 @@ __host__ void copy_static_symbol_to_host(void *d_ptr, const void *h_ptr, size_t
//CUDA_ASSERT(cudaMemcpyFromSymbol(h_ptr, d_ptr, count));
//CUDA_ASSERT(cudaMemcpyFromSymbol(h_ptr, d_ptr, count));
}
}
__device__
int
atomic_add
(
int
*
addr
,
int
val
)
{
return
atomicAdd
(
addr
,
val
);
}
__device__
int
atomic_add_resize_check
(
int
*
addr
,
int
val
,
int
*
resize
,
int
capacity
)
{
const
int
add_res
=
*
addr
+
val
;
if
(
add_res
>=
capacity
)
{
*
resize
=
add_res
;
return
*
addr
;
}
return
atomic_add
(
addr
,
val
);
}
}
}
This diff is collapsed.
Click to expand it.
runtime/devices/device.hpp
+
16
−
3
View file @
276b8405
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#ifndef PAIRS_TARGET_CUDA
#ifndef PAIRS_TARGET_CUDA
# define __host__
# define __host__
# define __device__
typedef
int
cudaError_t
;
typedef
int
cudaError_t
;
#endif
#endif
...
@@ -18,7 +17,21 @@ __host__ void copy_to_device(const void *h_ptr, void *d_ptr, size_t count);
...
@@ -18,7 +17,21 @@ __host__ void copy_to_device(const void *h_ptr, void *d_ptr, size_t count);
__host__
void
copy_to_host
(
const
void
*
d_ptr
,
void
*
h_ptr
,
size_t
count
);
__host__
void
copy_to_host
(
const
void
*
d_ptr
,
void
*
h_ptr
,
size_t
count
);
__host__
void
copy_static_symbol_to_device
(
void
*
h_ptr
,
const
void
*
d_ptr
,
size_t
count
);
__host__
void
copy_static_symbol_to_device
(
void
*
h_ptr
,
const
void
*
d_ptr
,
size_t
count
);
__host__
void
copy_static_symbol_to_host
(
void
*
d_ptr
,
const
void
*
h_ptr
,
size_t
count
);
__host__
void
copy_static_symbol_to_host
(
void
*
d_ptr
,
const
void
*
h_ptr
,
size_t
count
);
__device__
int
atomic_add
(
int
*
addr
,
int
val
);
__device__
int
atomic_add_resize_check
(
int
*
addr
,
int
val
,
int
*
resize
,
int
capacity
);
#ifdef PAIRS_TARGET_CUDA
__device__
int
atomic_add
(
int
*
addr
,
int
val
)
{
return
atomicAdd
(
addr
,
val
);
}
__device__
int
atomic_add_resize_check
(
int
*
addr
,
int
val
,
int
*
resize
,
int
capacity
)
{
const
int
add_res
=
*
addr
+
val
;
if
(
add_res
>=
capacity
)
{
*
resize
=
add_res
;
return
*
addr
;
}
return
atomic_add
(
addr
,
val
);
}
#else
int
atomic_add
(
int
*
addr
,
int
val
);
int
atomic_add_resize_check
(
int
*
addr
,
int
val
,
int
*
resize
,
int
capacity
);
#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