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
e824ff9a
Commit
e824ff9a
authored
3 years ago
by
Rafael Ravedutti
Browse files
Options
Downloads
Patches
Plain Diff
Compile both CPU and GPU versions together
Signed-off-by:
Rafael Ravedutti
<
rafaelravedutti@gmail.com
>
parent
02327683
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+12
-8
12 additions, 8 deletions
Makefile
examples/lj_func.py
+13
-1
13 additions, 1 deletion
examples/lj_func.py
with
25 additions
and
9 deletions
Makefile
+
12
−
8
View file @
e824ff9a
.PHONY
:
all build clean lj_ns
.PHONY
:
all build clean lj_ns
_cpu lj_ns_gpu
all
:
build lj_ns
all
:
build lj_ns
_cpu lj_ns_gpu
@
echo
"Everything was done!"
@
echo
"Everything was done!"
build
:
build
:
@
echo
"Building pairs package..."
@
echo
"Building pairs package..."
python3 setup.py build
&&
python3 setup.py
install
--user
python3 setup.py build
&&
python3 setup.py
install
--user
lj_ns
:
lj_ns_cpu
:
@
echo
"Generating and compiling CPP for Lennard-Jones example..."
@
echo
"Generating and compiling Lennard-Jones example for CPU..."
python3 examples/lj_func.py
python3 examples/lj_func.py cpu
lj_ns_gpu
:
@
echo
"Generating and compiling Lennard-Jones example for GPU..."
python3 examples/lj_func.py gpu
# Targets
# Targets
cpu
:
build lj_ns
cpu
:
build lj_ns
_cpu
g++
-o
lj_ns lj_ns.cpp
g++
-o
lj_ns lj_ns.cpp
gpu
:
build lj_ns
gpu
:
build lj_ns
_gpu
nvcc
-o
lj_ns lj_ns.cu
nvcc
-o
lj_ns lj_ns.cu
clean
:
clean
:
@
echo
"Cleaning..."
@
echo
"Cleaning..."
rm
-rf
build lj_ns lj_ns.cpp dist pairs.egg-info functions functions.pdf
rm
-rf
build lj_ns lj_ns.cpp
lj_ns.cu
dist pairs.egg-info functions functions.pdf
This diff is collapsed.
Click to expand it.
examples/lj_func.py
+
13
−
1
View file @
e824ff9a
import
pairs
import
pairs
import
sys
def
lj
(
i
,
j
):
def
lj
(
i
,
j
):
...
@@ -12,6 +13,12 @@ def euler(i):
...
@@ -12,6 +13,12 @@ def euler(i):
position
[
i
]
+=
dt
*
velocity
[
i
]
position
[
i
]
+=
dt
*
velocity
[
i
]
cmd
=
sys
.
argv
[
0
]
target
=
sys
.
argv
[
1
]
if
len
(
sys
.
argv
[
1
])
>
1
else
"
none
"
if
target
!=
'
cpu
'
and
target
!=
'
gpu
'
:
print
(
f
"
Invalid target, use
{
cmd
}
<cpu/gpu>
"
)
dt
=
0.005
dt
=
0.005
cutoff_radius
=
2.5
cutoff_radius
=
2.5
skin
=
0.3
skin
=
0.3
...
@@ -32,5 +39,10 @@ psim.vtk_output("output/test")
...
@@ -32,5 +39,10 @@ psim.vtk_output("output/test")
psim
.
compute
(
lj
,
cutoff_radius
,
{
'
sigma6
'
:
sigma6
,
'
epsilon
'
:
epsilon
})
psim
.
compute
(
lj
,
cutoff_radius
,
{
'
sigma6
'
:
sigma6
,
'
epsilon
'
:
epsilon
})
psim
.
compute
(
euler
,
symbols
=
{
'
dt
'
:
dt
})
psim
.
compute
(
euler
,
symbols
=
{
'
dt
'
:
dt
})
psim
.
target
(
pairs
.
target_cpu
())
psim
.
target
(
pairs
.
target_cpu
())
#psim.target(pairs.target_gpu())
if
target
==
'
gpu
'
:
psim
.
target
(
pairs
.
target_gpu
())
else
:
psim
.
target
(
pairs
.
target_cpu
())
psim
.
generate
()
psim
.
generate
()
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