Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
memory-faucet
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
数学の武士
memory-faucet
Commits
386b23e2
Commit
386b23e2
authored
4 months ago
by
数学の武士
Browse files
Options
Downloads
Patches
Plain Diff
Add ctest:
shoul be fixed: no error when ptr2[4] = float(2);
parent
9ecbca68
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+8
-1
8 additions, 1 deletion
CMakeLists.txt
test.cpp
+39
-0
39 additions, 0 deletions
test.cpp
with
47 additions
and
1 deletion
CMakeLists.txt
+
8
−
1
View file @
386b23e2
...
...
@@ -49,4 +49,11 @@ set(HEADER
include_directories
(
include/
)
add_library
(
memory-faucet
${
SOURCES
}
${
HEADER
}
)
target_include_directories
(
memory-faucet PUBLIC
${
memory_processing_SOURCE_DIR
}
/include
)
target_link_libraries
(
memory-faucet memproc
)
\ No newline at end of file
target_link_libraries
(
memory-faucet memproc
)
enable_testing
()
add_executable
(
test1 test.cpp
)
target_link_libraries
(
test1 memory-faucet
)
add_test
(
NAME Test1 COMMAND ./test1
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test.cpp
0 → 100644
+
39
−
0
View file @
386b23e2
#include
"memory-faucet.h"
#include
<cstdio>
int
main
(
void
)
{
const
size_t
required_size1
=
sizeof
(
float
)
*
100
;
const
size_t
required_size2
=
sizeof
(
float
)
*
1
;
const
size_t
required_size3
=
sizeof
(
float
)
*
10000
;
const
size_t
required_size4
=
sizeof
(
float
)
*
1000
;
const
size_t
required_size5
=
sizeof
(
float
)
*
100000
;
const
size_t
required_size6
=
sizeof
(
float
)
*
100000000
;
memBuf
<
MemType
::
CPU
>
Buf1
(
required_size1
);
memBuf
<
MemType
::
CPU
>
Buf2
(
required_size2
);
memBuf
<
MemType
::
CPU
,
buf_choose_policy
::
find_best_unsorted
>
Buf3
(
required_size3
);
memBuf
<
MemType
::
CPU
,
buf_choose_policy
::
find_best_unsorted
>
Buf4
(
required_size4
);
memBuf
<
MemType
::
CPU
>
Buf5
(
required_size5
);
memBuf
<
MemType
::
CPU
>
Buf6
(
required_size6
);
#ifdef INCLUDE_CUDA
const
size_t
required_size7
=
sizeof
(
float
)
*
10000000
;
memBuf
<
MemType
::
GPU
>
Buf7
(
required_size7
);
#endif
float
*
ptr1
=
static_cast
<
float
*>
(
Buf1
.
ptr
());
float
*
ptr2
=
static_cast
<
float
*>
(
Buf2
.
ptr
());
float
*
ptr4
=
static_cast
<
float
*>
(
Buf4
.
ptr
());
float
*
ptr6
=
static_cast
<
float
*>
(
Buf6
.
ptr
());
ptr2
[
0
]
=
float
(
2
);
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
ptr1
[
i
]
=
float
(
i
);
ptr4
[
i
]
=
float
(
i
);
ptr6
[
i
]
=
float
(
i
);
}
return
0
;
}
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