Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
ocladock-fpga
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
docking
ocladock-fpga
Commits
9c153df7
Commit
9c153df7
authored
Feb 09, 2018
by
Leonardo Solis
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LS9 blocks + added comments + corrections
parent
3938e557
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
410 additions
and
592 deletions
+410
-592
ofdock_taskpar_alt/Makefile
ofdock_taskpar_alt/Makefile
+66
-47
ofdock_taskpar_alt/device/Krnl_Conform.cl
ofdock_taskpar_alt/device/Krnl_Conform.cl
+41
-113
ofdock_taskpar_alt/device/Krnl_GA.cl
ofdock_taskpar_alt/device/Krnl_GA.cl
+104
-119
ofdock_taskpar_alt/device/Krnl_IGL_Arbiter.cl
ofdock_taskpar_alt/device/Krnl_IGL_Arbiter.cl
+26
-38
ofdock_taskpar_alt/device/Krnl_InterE.cl
ofdock_taskpar_alt/device/Krnl_InterE.cl
+18
-52
ofdock_taskpar_alt/device/Krnl_IntraE.cl
ofdock_taskpar_alt/device/Krnl_IntraE.cl
+23
-55
ofdock_taskpar_alt/device/Krnl_LS.cl
ofdock_taskpar_alt/device/Krnl_LS.cl
+6
-32
ofdock_taskpar_alt/device/Krnl_LS2.cl
ofdock_taskpar_alt/device/Krnl_LS2.cl
+1
-1
ofdock_taskpar_alt/device/Krnl_LS3.cl
ofdock_taskpar_alt/device/Krnl_LS3.cl
+1
-1
ofdock_taskpar_alt/device/Krnl_PRNG.cl
ofdock_taskpar_alt/device/Krnl_PRNG.cl
+3
-88
ofdock_taskpar_alt/host/src/performdocking.cpp
ofdock_taskpar_alt/host/src/performdocking.cpp
+107
-46
ofdock_taskpar_alt/prof.md
ofdock_taskpar_alt/prof.md
+14
-0
No files found.
ofdock_taskpar_alt/Makefile
View file @
9c153df7
...
...
@@ -532,7 +532,11 @@ else
endif
ENABLE_KERNELS
=
$(K1)
$(K2)
$(K3)
$(K4)
$(K5)
$(K6)
$(K7)
$(K8)
$(K9)
$(K10)
$(K11)
$(K12)
$(K13)
$(K14)
$(K15)
$(K16)
$(K17)
$(K18)
$(K19)
$(K20)
$(K21)
$(K22)
$(K23)
$(K24)
$(K25)
$(K26)
$(K27)
$(K28)
$(K29)
$(K30)
$(K31)
$(K32)
$(K33)
$(K34)
$(K35)
$(K36)
$(K37)
$(K38)
$(K39)
$(K40)
$(K41)
$(K42)
$(K43)
$(K44)
$(K45)
$(K46)
$(K47)
$(K48)
ENABLE_KERNELS
=
$(K1)
$(K2)
$(K3)
$(K4)
$(K5)
$(K6)
$(K7)
$(K8)
$(K9)
$(K10)
\
$(K11)
$(K12)
$(K13)
$(K14)
$(K15)
$(K16)
$(K17)
$(K18)
$(K19)
$(K20)
\
$(K21)
$(K22)
$(K23)
$(K24)
$(K25)
$(K26)
$(K27)
$(K28)
$(K29)
$(K30)
\
$(K31)
$(K32)
$(K33)
$(K34)
$(K35)
$(K36)
$(K37)
$(K38)
$(K39)
$(K40)
\
$(K41)
$(K42)
$(K43)
$(K44)
$(K45)
$(K46)
$(K47)
$(K48)
# =============================
# Reproduce result (remove randomness)
...
...
@@ -666,7 +670,18 @@ else
SEP_FGRID_FLAG
=
endif
FIPO_FLAG
=
$(FIPOCO_FLAG)
$(FIPOIE_FLAG)
$(FIPOIA_FLAG)
$(FIPOLS1_FLAG)
$(FIPOLS2_FLAG)
$(FIPOLS3_FLAG)
$(FIPOLS4_FLAG)
$(FIPOLS5_FLAG)
$(FIPOLS6_FLAG)
$(FIPOLS7_FLAG)
$(FIPOLS8_FLAG)
$(FIPOLS9_FLAG)
$(COPYPOPENE_FLAG)
$(SEP_FGRID_FLAG)
FIPO_FLAG
=
$(FIPOCO_FLAG)
\
$(FIPOIE_FLAG)
$(FIPOIA_FLAG)
\
$(FIPOLS1_FLAG)
\
$(FIPOLS2_FLAG)
\
$(FIPOLS3_FLAG)
\
$(FIPOLS4_FLAG)
\
$(FIPOLS5_FLAG)
\
$(FIPOLS6_FLAG)
\
$(FIPOLS7_FLAG)
\
$(FIPOLS8_FLAG)
\
$(FIPOLS9_FLAG)
\
$(COPYPOPENE_FLAG)
$(SEP_FGRID_FLAG)
# =============================
# AOC flags
...
...
@@ -716,18 +731,19 @@ $(TARGET_DIR)/$(TARGET) : Makefile $(SRCS) $(INCS) $(TARGET_DIR)
$(
foreach
L,
$(LIBS)
,-l
$L
)
\
-o
$(TARGET_DIR)
/
$(TARGET)
$(DOCK_DEBUG_FLAG)
$(DEV)
$(DOCK_PROG)
$(ENABLE_KERNELS)
$(REP)
$(FIPO_FLAG)
@
echo
" "
@
echo
"================================"
@
echo
"INFO: host binary is under:
bin/
"
@
echo
"================================"
@
echo
"================================
===================
"
@
echo
"INFO: host binary is under:
$(TARGET_DIR)
/
$(TARGET)
"
@
echo
"================================
===================
"
@
echo
" "
# Docking parameters
# NEV was usually set to 100000
# Docking parameters
# that directly determine the execution time
# Following values are used only for emulation
# to have a short but still a representative test
PDB
:=
1stp
NRUN
:=
10
NEV
:=
50000
# Project name
PROJECT_NAME
:=
ofdock_taskpar_alt
...
...
@@ -753,9 +769,9 @@ BOARD := Proc10A_X115
keremu
:
$(DEV_SRC)
aoc
-march
=
emulator
-v
--board
$(BOARD)
$(DEV_SRC)
-o
$(TARGET_DIR)
/
$(KRNL_NAME)
.aocx
$(REP)
$(FIPO_FLAG)
$(AOC_FLAG)
-g
@
echo
" "
@
echo
"==============================================================="
@
echo
"INFO: emulation files are under:
bin
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"==============================================================="
@
echo
"===============================================================
==========
"
@
echo
"INFO: emulation files are under:
$(TARGET_DIR)
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"===============================================================
==========
"
@
echo
" "
# Run emulation
...
...
@@ -766,9 +782,9 @@ emu: $(TARGET_DIR)/$(TARGET) keremu
cd
$(TARGET_DIR)
&&
\
CL_CONTEXT_EMULATOR_DEVICE_ALTERA
=
1 ./
$(TARGET)
-ffile
../input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
../input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nev
$(NEV)
-nrun
$(NRUN)
-gfpop
1
@
echo
" "
@
echo
"========================================"
@
echo
"INFO: log file is under:
bin
/docking.dlg"
@
echo
"========================================"
@
echo
"========================================
==========
"
@
echo
"INFO: log file is under:
$(TARGET_DIR)
/docking.dlg"
@
echo
"========================================
==========
"
@
echo
" "
...
...
@@ -781,13 +797,13 @@ emu: $(TARGET_DIR)/$(TARGET) keremu
kerrpt
:
$(DEV_SRC)
aoc
--board
$(BOARD)
$(DEV_SRC)
-o
$(TARGET_DIR)
/
$(KRNL_NAME)
.aoco
$(REP)
$(FIPO_FLAG)
$(AOC_FLAG)
-c
--report
-g
@
echo
" "
@
echo
"=================================================================="
@
echo
"INFO: report files are under:
bin
/
$(KRNL_NAME)
/reports/report.html"
@
echo
"INFO: THIS WORKS ONLY FROM V16.1 ON "
@
echo
" "
@
echo
"INFO: report file is under:
bin
/
$(KRNL_NAME)
.log "
@
echo
"INFO: THIS WORKS IN V16.0 AND OLDER. "
@
echo
"=================================================================="
@
echo
"==================================================================
==========
"
@
echo
"INFO: report files are under:
$(TARGET_DIR)
/
$(KRNL_NAME)
/reports/report.html"
@
echo
"INFO: THIS WORKS ONLY FROM V16.1 ON
"
@
echo
"
"
@
echo
"INFO: report file is under:
$(TARGET_DIR)
/
$(KRNL_NAME)
.log "
@
echo
"INFO: THIS WORKS IN V16.0 AND OLDER.
"
@
echo
"==================================================================
==========
"
@
echo
" "
# Build hw (FPGA bitstream)
...
...
@@ -799,17 +815,17 @@ kerrpt: $(DEV_SRC)
hw
:
aoc
--board
$(BOARD)
$(DEV_SRC)
-o
$(TARGET_DIR_HW)
/
$(KRNL_NAME)
.aocx
$(FIPO_FLAG)
$(AOC_FLAG)
@
echo
" "
@
echo
"================================================================"
@
echo
"INFO: FPGA bitstream is under:
bin_hw
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"================================================================"
@
echo
"================================================================
==========
"
@
echo
"INFO: FPGA bitstream is under:
$(TARGET_DIR_HW)
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"================================================================
==========
"
@
echo
" "
hw-he
:
aoc
--high-effort
--board
$(BOARD)
$(DEV_SRC)
-o
$(TARGET_DIR_HW)
/
$(KRNL_NAME)
.aocx
$(FIPO_FLAG)
$(AOC_FLAG)
@
echo
" "
@
echo
"================================================================"
@
echo
"INFO: FPGA bitstream is under:
bin_hw
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"================================================================"
@
echo
"================================================================
==========
"
@
echo
"INFO: FPGA bitstream is under:
$(TARGET_DIR_HW)
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"================================================================
==========
"
@
echo
" "
# Build hw (FPGA bitstream) instrumented with performance counters
...
...
@@ -821,13 +837,13 @@ hw-he:
hw-prof
:
aoc
--profile
--board
$(BOARD)
$(DEV_SRC)
-o
$(TARGET_DIR_HW_PROF)
/
$(KRNL_NAME)
.aocx
$(FIPO_FLAG)
$(AOC_FLAG)
@
echo
" "
@
echo
"====================================================================================="
@
echo
"INFO: instrumented FPGA bitstream is under:
bin_hw_profile
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"====================================================================================="
@
echo
"=====================================================================================
=======
"
@
echo
"INFO: instrumented FPGA bitstream is under:
$(TARGET_DIR_HW_PROF)
/
$(KRNL_NAME)
(.aoco)(.aocx)"
@
echo
"=====================================================================================
=======
"
@
echo
" "
# Execute on
sauron
server
# Execute on
remote
server
# Host-recompilation
# Copy of host to $(TARGET_DIR_HW)
# The working directory is changed
...
...
@@ -835,15 +851,15 @@ hw-prof:
exe
:
$(TARGET_DIR)/$(TARGET)
cp
$(TARGET_DIR)
/
$(TARGET)
$(TARGET_DIR_HW)
/
&&
\
cd
$(TARGET_DIR_HW)
&&
\
./
$(TARGET)
-ffile
../input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
../input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nrun
10
./
$(TARGET)
-ffile
../input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
../input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nrun
$(NRUN)
-resnam
docking_
$(PDB)
_
$(NRUN)
@
echo
" "
@
echo
"==========================================="
@
echo
"INFO: log file is under:
bin_hw/docking
.dlg"
@
echo
"==========================================="
@
echo
"===========================================
=========================
"
@
echo
"INFO: log file is under:
$(TARGET_DIR_HW)
/docking_
$(PDB)
_
$(NRUN)
.dlg"
@
echo
"===========================================
=========================
"
@
echo
" "
# Execute and profile on
sauron
server
# Execute and profile on
remote
server
# Host-recompilation
# Copy of host to $(TARGET_DIR_HW_PROF)
# The working directory is changed
...
...
@@ -851,20 +867,23 @@ exe: $(TARGET_DIR)/$(TARGET)
exe-prof
:
$(TARGET_DIR)/$(TARGET)
cp
$(TARGET_DIR)
/
$(TARGET)
$(TARGET_DIR_HW_PROF)
/
&&
\
cd
$(TARGET_DIR_HW_PROF)
&&
\
./
$(TARGET)
-ffile
../input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
../input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nrun
10
./
$(TARGET)
-ffile
../input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
../input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nrun
$(NRUN)
-resnam
docking_
$(PDB)
_
$(NRUN)
@
echo
" "
@
echo
"==================================================="
@
echo
"INFO: log file is under:
bin_hw_profile/docking
.dlg"
@
echo
"==================================================="
@
echo
"===================================================
======================
"
@
echo
"INFO: log file is under:
$(TARGET_DIR_HW_PROF)
/docking_
$(PDB)
_
$(NRUN)
.dlg"
@
echo
"===================================================
======================
"
@
echo
" "
COPY_DIR
:=
copy_
$(PROJECT_NAME)
COPY_DIR_DOCK
:=
$(PROJECT_NAME)
# Make sure this remote-server alias exists (in ~/.ssh/config)
SERVER
:=
sauron
# Delete an existing folder if previously created
# Create a folder $(COPY_DIR) in the parent directory
# Copy binaries into $(COPY_DIR) folder, avoiding the (innecesary) compilation intermediate files
# Copy source files into $(COPY_DIR) as host is built in the
HARP2 front-end
# Copy source files into $(COPY_DIR) as host is built in the
remote $(SERVER)
# Create a zip file out of the $(COPY_DIR) folder
copy
:
clean-copy
mkdir
../
$(COPY_DIR)
...
...
@@ -882,16 +901,16 @@ copy: clean-copy
cp
-r
input/ ../
$(COPY_DIR)
/
$(COPY_DIR_DOCK)
/
cp
-r
wrapcl/ ../
$(COPY_DIR)
/
$(COPY_DIR_DOCK)
/
cp
-r
../common ../
$(COPY_DIR)
/
cp
../conf_aoc160_
sauron
.sh ../
$(COPY_DIR)
/
cp
../conf_aoc160_
$(SERVER)
.sh ../
$(COPY_DIR)
/
cd
../
;
zip
-r
$(COPY_DIR)
.zip
$(COPY_DIR)
@
echo
" "
@
echo
"Transfer the
$(COPY_DIR)
.zip file to
sauron
server: "
@
echo
"Transfer the
$(COPY_DIR)
.zip file to
$(SERVER)
server: "
@
echo
" "
cd
../
&&
scp
$(COPY_DIR)
.zip
sauron
:~/
cd
../
&&
scp
$(COPY_DIR)
.zip
$(SERVER)
:~/
@
echo
" "
@
echo
"================="
@
echo
"
Transfer finished
"
@
echo
"================="
@
echo
"=================
=========================
"
@
echo
"
Files listed were transferred to
$(SERVER)
"
@
echo
"=================
=========================
"
@
echo
" "
clean-copy
:
...
...
ofdock_taskpar_alt/device/Krnl_Conform.cl
View file @
9c153df7
//
--------------------------------------------------------------------------
//
The
function
changes
the
conformation
of
my
ligand
according
to
//
the
genotype
given
by
the
second
parameter
.
//
Conform
changes
the
conformation
of
the
ligand
according
to
//
the
genotype
fed
by
any
producer
logic/kernel
(
IC,
GG,
LSs
)
.
//
Originally
from:
processligand.c
//
--------------------------------------------------------------------------
__kernel
__attribute__
((
max_global_work_dim
(
0
)))
...
...
@@ -18,9 +18,7 @@ void Krnl_Conform(
unsigned
int
DockConst_rotbondlist_length,
unsigned
char
DockConst_num_of_atoms,
unsigned
char
DockConst_num_of_genes,
/*
unsigned
char
Host_num_of_rotbonds,
*/
#
if
defined
(
FIXED_POINT_CONFORM
)
__constant
fixedpt4*
restrict
KerConstStatic_ref_orientation_quats_const,
#
else
...
...
@@ -36,17 +34,13 @@ void Krnl_Conform(
printf
(
"%-40s %u\n"
,
"DockConst_num_of_genes: "
,
DockConst_num_of_genes
)
;
#
endif
/*
//
check
best
practices
guide
//
Check
best
practices
guide
//
Table
11.
Effects
of
numbanks
and
bankwidth
on
the
Bank
Geometry
...
//
only
first
three
indexes
of
the
lower
array
are
used
//
however
size
of
lower
array
was
declared
as
4
,
just
to
keep
sizes
equal
to
power
of
2
__local
float
__attribute__
((
numbanks
(
8
)
,
bankwidth
(
16
)))
loc_coords[MAX_NUM_OF_ATOMS][4]
;
*/
/*
bool
active
=
true
;
*/
//
Only
first
three
indexes
of
the
lower
array
are
used
//
however
size
of
lower
array
was
declared
as
4
,
//
just
to
keep
sizes
equal
to
power
of
2
//
__local
float
__attribute__
((
numbanks
(
8
)
,
bankwidth
(
16
)))
loc_coords[MAX_NUM_OF_ATOMS][4]
;
char
active
=
0x01
;
__local
int
rotlist_localcache
[MAX_NUM_OF_ROTATIONS]
;
...
...
@@ -62,10 +56,6 @@ while(active) {
fixedpt
phi
;
fixedpt
theta
;
fixedpt
genrotangle
;
/*
fixedpt
sin_theta,
cos_theta
;
fixedpt3
genrot_unitvec
;
*/
fixedpt3
genotype_xyz
;
fixedpt3
__attribute__
((
memory,
...
...
@@ -79,10 +69,6 @@ while(active) {
float
phi
;
float
theta
;
float
genrotangle
;
/*
float
sin_theta,
cos_theta
;
float3
genrot_unitvec
;
*/
float3
genotype_xyz
;
float3
__attribute__
((
memory,
...
...
@@ -94,10 +80,6 @@ while(active) {
))
loc_coords
[MAX_NUM_OF_ATOMS]
;
#
endif
/*
active
=
read_channel_altera
(
chan_IGL2Conform_active
)
;
mem_fence
(
CLK_CHANNEL_MEM_FENCE
)
;
*/
char2
actmode
=
read_channel_altera
(
chan_IGL2Conform_actmode
)
;
mem_fence
(
CLK_CHANNEL_MEM_FENCE
)
;
...
...
@@ -113,52 +95,19 @@ while(active) {
#
endif
for
(
uchar
i=0
; i<DockConst_num_of_genes; i++) {
/*float
fl_tmp
=
read_channel_altera
(
chan_IGL2Conform_genotype
)
;*/
float
fl_tmp
;
switch
(
mode
)
{
case
'I
'
:
fl_tmp
=
read_channel_altera
(
chan_IC2Conf_genotype
)
;
break
;
case
'G
'
:
fl_tmp
=
read_channel_altera
(
chan_GG2Conf_genotype
)
;
break
;
case
0x01:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS1_genotype
)
;
break
;
case
0x02:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS2_genotype
)
;
break
;
case
0x03:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS3_genotype
)
;
break
;
case
0x04:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS4_genotype
)
;
break
;
case
0x05:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS5_genotype
)
;
break
;
case
0x06:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS6_genotype
)
;
break
;
case
0x07:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS7_genotype
)
;
break
;
case
0x08:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS8_genotype
)
;
break
;
case
0x09:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS9_genotype
)
;
break
;
case
'I
'
:
fl_tmp
=
read_channel_altera
(
chan_IC2Conf_genotype
)
; break;
case
'G
'
:
fl_tmp
=
read_channel_altera
(
chan_GG2Conf_genotype
)
; break;
case
0x01:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS1_genotype
)
; break;
case
0x02:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS2_genotype
)
; break;
case
0x03:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS3_genotype
)
; break;
case
0x04:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS4_genotype
)
; break;
case
0x05:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS5_genotype
)
; break;
case
0x06:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS6_genotype
)
; break;
case
0x07:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS7_genotype
)
; break;
case
0x08:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS8_genotype
)
; break;
case
0x09:
fl_tmp
=
read_channel_altera
(
chan_LS2Conf_LS9_genotype
)
; break;
}
if
(
i
>
2
)
{
...
...
@@ -168,7 +117,7 @@ while(active) {
//printf
(
"Conform: %u %u\n"
,
mode,
i
)
;
#
if
defined
(
FIXED_POINT_CONFORM
)
//
c
onvert
float
to
fixedpt
//
C
onvert
float
to
fixedpt
fixedpt
fx_tmp
=
fixedpt_fromfloat
(
fl_tmp
)
;
switch
(
i
)
{
case
0:
genotype_xyz.x
=
fx_tmp
; break;
...
...
@@ -196,40 +145,23 @@ while(active) {
if
(
active
==
0x00
)
{printf
(
" %-20s: %s\n"
,
"Krnl_Conform"
,
"must be disabled"
)
;}
#
endif
/*
#
if
defined
(
FIXED_POINT_CONFORM
)
sin_theta
=
fixedpt_sin
(
theta
)
;
cos_theta
=
fixedpt_cos
(
theta
)
;
genrot_unitvec.x
=
fixedpt_mul
(
sin_theta,
fixedpt_cos
(
phi
))
;
genrot_unitvec.y
=
fixedpt_mul
(
sin_theta,
fixedpt_sin
(
phi
))
;
genrot_unitvec.z
=
cos_theta
;
#
else
sin_theta
=
native_sin
(
theta
)
;
cos_theta
=
native_cos
(
theta
)
;
genrot_unitvec.x
=
sin_theta*native_cos
(
phi
)
;
genrot_unitvec.y
=
sin_theta*native_sin
(
phi
)
;
genrot_unitvec.z
=
cos_theta
;
#
endif
*/
for
(
ushort
rotation_counter
=
0
; rotation_counter < DockConst_rotbondlist_length; rotation_counter++)
{
int
rotation_list_element
=
rotlist_localcache
[rotation_counter]
;
if
((
rotation_list_element
&
RLIST_DUMMY_MASK
)
==
0
)
//
i
f
not
dummy
rotation
if
((
rotation_list_element
&
RLIST_DUMMY_MASK
)
==
0
)
//
I
f
not
dummy
rotation
{
uint
atom_id
=
rotation_list_element
&
RLIST_ATOMID_MASK
;
//
c
apturing
atom
coordinates
//
C
apturing
atom
coordinates
#
if
defined
(
FIXED_POINT_CONFORM
)
fixedpt3
atom_to_rotate
;
#
else
float3
atom_to_rotate
;
#
endif
if
((
rotation_list_element
&
RLIST_FIRSTROT_MASK
)
!=
0
)
//
i
f
first
rotation
of
this
atom
if
((
rotation_list_element
&
RLIST_FIRSTROT_MASK
)
!=
0
)
//
I
f
first
rotation
of
this
atom
{
/*atom_to_rotate
=
ref_coords_localcache
[atom_id]
;*/
atom_to_rotate
=
KerConstStatic_ref_coords_const
[atom_id]
;
}
else
...
...
@@ -237,7 +169,7 @@ while(active) {
atom_to_rotate
=
loc_coords[atom_id]
;
}
//
c
apturing
rotation
vectors
and
angle
//
C
apturing
rotation
vectors
and
angle
#
if
defined
(
FIXED_POINT_CONFORM
)
fixedpt3
rotation_unitvec
;
fixedpt3
rotation_movingvec
;
...
...
@@ -248,7 +180,7 @@ while(active) {
float
rotation_angle
;
#
endif
if
((
rotation_list_element
&
RLIST_GENROT_MASK
)
!=
0
)
//
i
f
general
rotation
if
((
rotation_list_element
&
RLIST_GENROT_MASK
)
!=
0
)
//
I
f
general
rotation
{
#
if
defined
(
FIXED_POINT_CONFORM
)
fixedpt
sin_theta,
cos_theta
;
...
...
@@ -274,20 +206,18 @@ while(active) {
rotation_movingvec
=
genotype_xyz
;
}
else
//
i
f
rotating
around
rotatable
bond
else
//
I
f
rotating
around
rotatable
bond
{
uint
rotbond_id
=
(
rotation_list_element
&
RLIST_RBONDID_MASK
)
>>
RLIST_RBONDID_SHIFT
;
/*rotation_unitvec
=
rotbonds_unit_vectors_localcache
[rotbond_id]
;*/
rotation_unitvec
=
KerConstStatic_rotbonds_unit_vectors_const
[rotbond_id]
;
rotation_angle
=
genotype
[6+rotbond_id]
;
/*rotation_movingvec
=
rotbonds_moving_vectors_localcache
[rotbond_id]
;*/
rotation_movingvec
=
KerConstStatic_rotbonds_moving_vectors_const
[rotbond_id]
;
//
i
n
addition
performing
the
first
movement
//which
is
needed
only
if
rotating
around
rotatable
bond
//
I
n
addition
performing
the
first
movement
//
which
is
needed
only
if
rotating
around
rotatable
bond
#
if
defined
(
FIXED_POINT_CONFORM
)
atom_to_rotate.x
=
fixedpt_sub
(
atom_to_rotate.x,
rotation_movingvec.x
)
;
...
...
@@ -298,7 +228,7 @@ while(active) {
#
endif
}
//
p
erforming
rotation
//
P
erforming
rotation
#
if
defined
(
FIXED_POINT_CONFORM
)
fixedpt
quatrot_left_x,
quatrot_left_y,
quatrot_left_z,
quatrot_left_q
;
fixedpt
quatrot_temp_x,
quatrot_temp_y,
quatrot_temp_z,
quatrot_temp_q
;
...
...
@@ -331,9 +261,9 @@ while(active) {
quatrot_left.w
=
cos_angle
;
#
endif
if
((
rotation_list_element
&
RLIST_GENROT_MASK
)
!=
0
)
//
i
f
general
rotation,
//two
rotations
should
be
performed
//
(
multiplying
the
quaternions
)
if
((
rotation_list_element
&
RLIST_GENROT_MASK
)
!=
0
)
//
I
f
general
rotation,
//
two
rotations
should
be
performed
//
(
multiplying
the
quaternions
)
{
#
if
defined
(
FIXED_POINT_CONFORM
)
const
fixedpt4
ref_orientation_quats_const
=
KerConstStatic_ref_orientation_quats_const[Host_RunId]
;
...
...
@@ -349,8 +279,8 @@ while(active) {
const
float
ref_orientation_quats_const_3
=
ref_orientation_quats_const.w
;
#
endif
//
c
alculating
quatrot_left*ref_orientation_quats_const,
//which
means
that
reference
orientation
rotation
is
the
first
//
C
alculating
quatrot_left*ref_orientation_quats_const,
//
which
means
that
reference
orientation
rotation
is
the
first
#
if
defined
(
FIXED_POINT_CONFORM
)
quatrot_temp_q
=
quatrot_left_q
;
quatrot_temp_x
=
quatrot_left_x
;
...
...
@@ -360,7 +290,7 @@ while(active) {
quatrot_temp
=
quatrot_left
;
#
endif
//
t
aking
the
first
element
of
ref_orientation_quats_const
member
//
T
aking
the
first
element
of
ref_orientation_quats_const
member
#
if
defined
(
FIXED_POINT_CONFORM
)
quatrot_left_q
=
fixedpt_mul
(
quatrot_temp_q,
ref_orientation_quats_const_0
)
-
fixedpt_mul
(
quatrot_temp_x,
ref_orientation_quats_const_1
)
...
...
@@ -445,7 +375,7 @@ while(active) {
atom_to_rotate.z
=
dot
(
quatrot_temp,
left4z
)
;
#
endif
//
p
erforming
final
movement
and
storing
values
//
P
erforming
final
movement
and
storing
values
loc_coords[atom_id]
=
atom_to_rotate
+
rotation_movingvec
;
}
//
End
if-statement
not
dummy
rotation
...
...
@@ -474,7 +404,7 @@ while(active) {
}*/
/*
/*
for
(
uchar
pipe_cnt=0
; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
if
(
pipe_cnt
==
0
)
{
char
active_tmp
=
active
;
...
...
@@ -499,9 +429,7 @@ while(active) {
write_channel_altera
(
chan_Conf2Intere_xyz,
tmp
)
;
write_channel_altera
(
chan_Conf2Intrae_xyz,
tmp
)
;
}
*/
*/
for
(
uchar
pipe_cnt=0
; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) {
if
(
pipe_cnt
==
0
)
{
...
...
@@ -528,7 +456,7 @@ while(active) {
float8
tmp
;
#
if
defined
(
FIXED_POINT_CONFORM
)
//
c
onvert
fixedpt3
to
float3
//
C
onvert
fixedpt3
to
float3
float
tmp_x1
=
fixedpt_tofloat
(
tmp_coords[0].x
)
;
float
tmp_y1
=
fixedpt_tofloat
(
tmp_coords[0].y
)
;
float
tmp_z1
=
fixedpt_tofloat
(
tmp_coords[0].z
)
;
...
...
@@ -551,7 +479,7 @@ while(active) {
printf
(
"AFTER Out CONFORM CHANNEL\n"
)
;
#
endif
}
//
End
of
while
(
1
)
}
//
End
of
while
(
active
)
#
if
defined
(
DEBUG_ACTIVE_KERNEL
)
printf
(
" %-20s: %s\n"
,
"Krnl_Conform"
,
"disabled"
)
;
...
...
ofdock_taskpar_alt/device/Krnl_GA.cl
View file @
9c153df7
This diff is collapsed.
Click to expand it.
ofdock_taskpar_alt/device/Krnl_IGL_Arbiter.cl
View file @
9c153df7
//
--------------------------------------------------------------------------
//
IGL_Arbiter
keeps
checking
whether
any
kernel
(
GA
or
any
LSs
)
//
is
sending
genotypes
to
Conform,
as
well
as
whether
//
GA
sent
the
"turn-off"
signal.
//
Its
name
references
the
logic
that
is
producing
genotypes:
//
IC,
GG
and
any
LS.
//
IC
and
GG
are
two
logic
blocks
inside
the
GA
kernel,
//
while
any
LS
logic
is
a
kernel
itself.
//
It
uses
the
valid
signals
to
determine
the
"mode"
value,
//
used
as
a
mux
selector
signal
(
of
genotype
logic-producers
)
in
Conform.
//
Initially
genotypes
passed
through
this
kernel
getting
reordered
and
//
synchronized
with
"mode"
.
//
This
has
been
later
optimized,
so
now
genotypes
go
directly
//
from
producer
logic/kernel
(
IC,
GG,
LSs
)
to
the
consumer
(
Conform
)
kernel.
//
--------------------------------------------------------------------------
__kernel
__attribute__
((
max_global_work_dim
(
0
)))
void
Krnl_IGL_Arbiter
(
/*unsigned
char
DockConst_num_of_genes*/
)
{
...
...
@@ -71,12 +86,11 @@ while(active) {
active
=
Off_valid
?
0x00
:
0x01
;
char
mode
[9]
; // mode for all LS
/*
float
genotypeICGG
[ACTUAL_GENOTYPE_LENGTH]
;
float
genotype
[3][ACTUAL_GENOTYPE_LENGTH]
;
*/
//
get
genotype
from
IC,
GG,
LS1,
LS2,
LS3
//
Determine
"mode"
value
//
This
considers
all
possible
cases
as
all
LS
could
be
//
potentially
producing
genotypes
simultaneously.
//
Be
careful
modifying
the
nested
conditional-statements
below,
//
as
even
a
litle
mistake
may
be
undetectable
in
emulation.
if
(
active
==
0x01
)
{
if
(
IC_valid
==
true
)
{
...
...
@@ -86,7 +100,7 @@ while(active) {
bound_tmp++
;
}
else{
//
Reorder
the
mode
&
genotype
coming
from
LS
//
Reorder
the
mode
&
from
LS
//
**************************************************************************************
//
LS1:
yes
...
...
@@ -1292,45 +1306,20 @@ while(active) {
uchar
bound
=
active
?
bound_tmp
:
1
;
/*
if
((
LS1_end_valid
|
| LS2_end_valid || LS3_end_valid)) {
printf("bound_tmp: %-5u, LS1: %-5s, LS2: %-5s, LS3: %-5s\n", bound_tmp, LS1_end_valid?"yes":"no", LS2_end_valid?"yes":"no", LS3_end_valid?"yes":"no");
}
*/
// send data to Krnl_Conform
//
Send
"mode"
to
Conform
for
(
uchar
j=0
; j<bound; j++) {
char
mode_tmp
=
Off_valid?
0x00:
IC_valid?
'I
'
:
GG_valid?
'G
'
:
mode[j]
;
//printf("IGL: %u\n", mode_tmp);
char2
actmode
=
{active,
mode_tmp}
;
write_channel_altera
(
chan_IGL2Conform_actmode,
actmode
)
;
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
/*
for (uchar i=0; i<DockConst_num_of_genes; i++) {
float gene_tmp = (IC_valid |
|
GG_valid
)
?
genotypeICGG[i]:
genotype[j][i
&
MASK_GENOTYPE]
;
if
(
i
>
2
)
{
gene_tmp
=
gene_tmp
*
DEG_TO_RAD
;
}
write_channel_altera
(
chan_IGL2Conform_genotype,
gene_tmp
)
;
}
*/
#
if
defined
(
DEBUG_KRNL_CONF_ARBITER
)
#
if
defined
(
DEBUG_KRNL_IGL_ARBITER
)
printf
(
"bound: %u, mode: %u\n"
,
bound,
mode_tmp
)
;
#
endif
}
//
Only
for
debugging
/*
//
Only
for
debugging
/*
if
(
LS1_end_active
==
true
)
{
LS1_eval
=
0
;
}
...
...
@@ -1342,9 +1331,8 @@ while(active) {
if
(
LS3_end_active
==
true
)
{
LS3_eval
=
0
;
}
*/