uDeviceX consists of units. They are implemented in /src/u/
.
1. Build and run
Compile unit A
: from /src
directory
u.conf0 ./u/A
u.make -j
2. Update make file fragments
From /src
u.u u/A
updates hw/make/*.mk
files
3. Create a new unit
From /src
mkdir -p hw/make
Add two file: hw/make/i
and hw/make/e
. The files are used by u.u
to create a list of unit source files. i
is a script which returns a
list of [i]ncluded files. e
returns a list of [e]xcluded files. The
i
list "minus" e
list is used as a source. e
file is
optional. In other words e
"black lists" files returned by i
.
For i
and e
the variable $U
is set to u/hw/hst
.
Run
u.u u/hw/hst
Add u/hw/hst/make/dep.mk u/hw/hst/make/obj.mk u/hw/hstmake/dir.mk
u/hw/hst/make/rule.mk
to git.
4. list of units
4.1. comm unit
a send/recv unit with the 26 neighbors using comm module
4.2. error unit
a unit to test error handling UC
, CC
and MC
(see utils)
4.2.1. compile
from /src/
directory:
u.conf0 u/error
u.make -j
4.2.2. usage
ERR_KIND=<kind> ./udx
where <kind>
must be:
-
0 for rasing an error from host code
-
1 for testing
MC
on a failing MPI call -
2 for testing
CC
on a failing cuda API call
The output should result in an error message, location of the error and a backtrace
4.3. hw unit
a "Hello World!" unit with kernel launch.
4.4. hw unit
a "Hello World!" unit. This serves as a base for creating new units
4.5. linal unit
a unit to test linear algebra functions
4.5.1. compile
Run from src/
u.conf0 u/linal
4.5.2. run
Invert symmetric 3x3 matrix
u.run ./udx -- 2 1 5 3 4 -2
2.857143e-01 -2.857143e-01 1.428571e-01 3.766234e-01 3.896104e-02 -6.493507e-02
compare to 'octave/matlab'
>> C = [2,1,5;1,3,4;5,4,-2] >> C^(-1) ans = 0.285714 -0.285714 0.142857 -0.285714 0.376623 0.038961 0.142857 0.038961 -0.064935
4.6. mesh bb unit
4.6.1. intro
Bounce back on triangulated mesh
4.6.2. params
if MESHBB_LOG_ROOTS
is defined logs coeficeints of cubic polynomials
and roots to meshbb.roots
.
4.7. MPI error
Units triggers mpi error. A test for MC
macro.
4.8. pair unit
4.8.1. Intro
It is for test pair interactions.
4.8.2. Compile
Run from src/
u.conf0 u/pair
or from other directorie
s=<path to src> echo run | u.conf $s u/pair $s/conf/test.h
4.8.3. Build
u.make -j
4.8.4. Run
Particles coordinates, velocities, kinds, and colors are provided via
stdin
. An example is in src/data/pair/2.
If RND
is set it is used as a scale of random force for all pairs.
s=<path to src> ./udx < $s/data/pair/2 RND=42 ./udx < $s/data/pair/2
Returns force between two particles
-2.4 0 0
4.8.5. Source
4.8.6. Test
u.test test/pair
4.9. RBC forces
Dumps internal RBC forces.
4.11. RBC random
Dumps random numbers generated by src/rbc/rnd
4.12. scan unit
a unit to test scan algorithm (exclusive prefix sum , see e.g. https://en.wikipedia.org/wiki/Prefix_sum) on host and device.
4.13. signed distance function (sdf) unit
a unit to test sdf field.
4.13.1. compile
u.conf0 u/sdf
u.make -j
4.13.2. run
Copy sdf file
u.cp.sdf cyl1/cyl sdf.dat
cyl1/cyl
along z
and center at the domain center and radius
lx/4
.
Pass coordinates as arguments
x=2.5 y=0 z=0 u.run ./udx $x $y $z
Returns
0 0 2.5 1.45547
4.14. x unit
standard uDeviceX code