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
1b7d44b3
Commit
1b7d44b3
authored
3 years ago
by
Rafael Ravedutti
Browse files
Options
Downloads
Patches
Plain Diff
Add CUDA compilation rules
Signed-off-by:
Rafael Ravedutti
<
rafaelravedutti@gmail.com
>
parent
d20485ef
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+7
-1
7 additions, 1 deletion
Makefile
src/pairs/__init__.py
+1
-1
1 addition, 1 deletion
src/pairs/__init__.py
src/pairs/code_gen/cgen.py
+5
-2
5 additions, 2 deletions
src/pairs/code_gen/cgen.py
with
13 additions
and
4 deletions
Makefile
+
7
−
1
View file @
1b7d44b3
.PHONY
:
all build clean lj_ns
.PHONY
:
all build clean lj_ns
all
:
build lj_ns
clean
all
:
build lj_ns
@
echo
"Everything was done!"
@
echo
"Everything was done!"
build
:
build
:
...
@@ -10,8 +10,14 @@ build:
...
@@ -10,8 +10,14 @@ build:
lj_ns
:
lj_ns
:
@
echo
"Generating and compiling CPP for Lennard-Jones example..."
@
echo
"Generating and compiling CPP for Lennard-Jones example..."
python3 examples/lj_func.py
python3 examples/lj_func.py
# Targets
cpu
:
build lj_ns
g++
-o
lj_ns lj_ns.cpp
g++
-o
lj_ns lj_ns.cpp
gpu
:
build lj_ns
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 dist pairs.egg-info functions functions.pdf
This diff is collapsed.
Click to expand it.
src/pairs/__init__.py
+
1
−
1
View file @
1b7d44b3
...
@@ -4,7 +4,7 @@ from pairs.sim.simulation import Simulation
...
@@ -4,7 +4,7 @@ from pairs.sim.simulation import Simulation
def
simulation
(
ref
,
dims
=
3
,
timesteps
=
100
,
debug
=
False
):
def
simulation
(
ref
,
dims
=
3
,
timesteps
=
100
,
debug
=
False
):
return
Simulation
(
CGen
(
f
"
{
ref
}
.cpp
"
,
debug
),
dims
,
timesteps
)
return
Simulation
(
CGen
(
ref
,
debug
),
dims
,
timesteps
)
def
target_cpu
():
def
target_cpu
():
return
Target
(
Target
.
Backend_CPP
,
Target
.
Feature_CPU
)
return
Target
(
Target
.
Backend_CPP
,
Target
.
Feature_CPU
)
...
...
This diff is collapsed.
Click to expand it.
src/pairs/code_gen/cgen.py
+
5
−
2
View file @
1b7d44b3
...
@@ -26,11 +26,12 @@ from pairs.code_gen.printer import Printer
...
@@ -26,11 +26,12 @@ from pairs.code_gen.printer import Printer
class
CGen
:
class
CGen
:
temp_id
=
0
temp_id
=
0
def
__init__
(
self
,
output
,
target
,
debug
=
False
):
def
__init__
(
self
,
ref
,
target
,
debug
=
False
):
self
.
sim
=
None
self
.
sim
=
None
self
.
target
=
None
self
.
target
=
None
self
.
print
=
None
self
.
ref
=
ref
self
.
debug
=
debug
self
.
debug
=
debug
self
.
print
=
Printer
(
output
)
def
assign_simulation
(
self
,
sim
):
def
assign_simulation
(
self
,
sim
):
self
.
sim
=
sim
self
.
sim
=
sim
...
@@ -39,6 +40,8 @@ class CGen:
...
@@ -39,6 +40,8 @@ class CGen:
self
.
target
=
target
self
.
target
=
target
def
generate_program
(
self
,
ast_node
):
def
generate_program
(
self
,
ast_node
):
ext
=
"
.cu
"
if
self
.
target
.
is_gpu
()
else
"
.cpp
"
self
.
print
=
Printer
(
self
.
ref
+
ext
)
self
.
print
.
start
()
self
.
print
.
start
()
self
.
print
(
"
#include <math.h>
"
)
self
.
print
(
"
#include <math.h>
"
)
self
.
print
(
"
#include <stdbool.h>
"
)
self
.
print
(
"
#include <stdbool.h>
"
)
...
...
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