Skip to content

Commit

Permalink
Merge pull request #975 from slaclab/pre-release
Browse files Browse the repository at this point in the history
Release Candidate v6.1.1
  • Loading branch information
slacrherbst authored Sep 21, 2023
2 parents d8af618 + d1c903f commit 64ac9ce
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 79 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/rogue_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
- name: Get Image Information
id: get_image_info
run: |
echo ::set-output name=tag::`git describe --tags`
echo tag=`git describe --tags` >> ${GITHUB_OUTPUT}
- name: Get Ruckus
run: |
Expand Down Expand Up @@ -192,8 +192,7 @@ jobs:
env:
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }}
run: |
echo ::set-output name=token::$CONDA_UPLOAD_TOKEN_TAG
echo ::set-output name=os::linux-64
echo token=${CONDA_UPLOAD_TOKEN_TAG} >> ${GITHUB_OUTPUT}
- name: Build
run: |
Expand Down Expand Up @@ -222,8 +221,8 @@ jobs:
- name: Get Image Information
id: get_image_info
run: |
echo ::set-output name=tag::`git describe --tags`
echo ::set-output name=branch::`echo ${GITHUB_REF} | awk 'BEGIN { FS = "/" } ; { print $3 }'`
echo tag=`git describe --tags` >> ${GITHUB_OUTPUT}
echo branch=`echo ${GITHUB_REF} | awk 'BEGIN { FS = "/" } ; { print $3 }'` >> ${GITHUB_OUTPUT}
# Setup docker build environment
- name: Set up Docker Buildx
Expand Down
1 change: 1 addition & 0 deletions pip_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ gitpython
pygithub
pydm
matplotlib
hwcounter
6 changes: 5 additions & 1 deletion python/pyrogue/_Block.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import threading
import numpy as np
import pyrogue as pr
import rogue.interfaces.memory as rim



def startTransaction(block, *, type, forceWr=False, checkEach=False, variable=None, index=-1, **kwargs):
"""
Helper function for calling the startTransaction function in a block. This helper
Expand Down Expand Up @@ -228,10 +230,12 @@ def set(self, var, value, index=-1):
"""
with self._lock:

if index < 0 and (isinstance(value, list) or isinstance(value,dict)):
if index < 0 and (isinstance(value, list) or isinstance(value, dict)):
changed = True
elif index >= 0:
changed = self._value[index] != value
elif isinstance(value, np.ndarray):
changed = np.array_equal(self._value, value)
else:
changed = self._value != value

Expand Down
1 change: 1 addition & 0 deletions python/pyrogue/_DataReceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self,
self.add(pr.LocalVariable(name='Data',
typeStr=typeStr,
disp='',
groups=['NoState','NoStream'],
value=value,
hidden=hideData,
description='Data Frame Container'))
Expand Down
23 changes: 20 additions & 3 deletions python/pyrogue/_Variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,14 @@ def _setDict(self,d,writeEach,modes,incGroups,excGroups,keys):

for val,i in zip(s,idxSlice):
self.setDisp(val.strip(), write=writeEach, index=i)
else:
self._log.warning(f"Skipping set for Entry {self.name} with mode {self._mode}. Enabled Modes={modes}.")

# Standard set
elif self._mode in modes:
self.setDisp(d,writeEach)
else:
self._log.warning(f"Skipping set for Entry {self.name} with mode {self._mode}. Enabled Modes={modes}.")

def _getDict(self, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=None, properties=False):
"""
Expand Down Expand Up @@ -1042,9 +1046,22 @@ def __init__(self, *,
listData = VariableListData(numValues,valueBits,valueStride)

# Setup C++ Base class
rim.Variable.__init__(self,self._name,self._mode,self._minimum,self._maximum,
offset, bitOffset, bitSize, overlapEn, verify,
self._bulkOpEn, self._updateNotify, self._base, listData, retryCount)
rim.Variable.__init__(
self,
self._name,
self._mode,
self._minimum,
self._maximum,
offset,
bitOffset,
bitSize,
overlapEn,
verify,
self._bulkOpEn,
self._updateNotify,
self._base,
listData,
retryCount)


##############################
Expand Down
3 changes: 2 additions & 1 deletion src/rogue/interfaces/memory/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,8 @@ double rim::Block::getFixed(rim::Variable* var, int32_t index) {
if ((fPoint & (1 << (var->valueBits_ - 1))) != 0) { fPoint = fPoint - (1 << var->valueBits_); }

// Convert to float
tmp = (double)fPoint / pow(2, var->binPoint_);
tmp = (double)fPoint;
tmp = tmp / pow(2, var->binPoint_);
return tmp;
}

Expand Down
109 changes: 56 additions & 53 deletions src/rogue/interfaces/memory/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,65 +43,68 @@ namespace bp = boost::python;
#endif

//! Class factory which returns a pointer to a Variable (VariablePtr)
rim::VariablePtr rim::Variable::create(std::string name,
std::string mode,
double minimum,
double maximum,
uint64_t offset,
std::vector<uint32_t> bitOffset,
std::vector<uint32_t> bitSize,
bool overlapEn,
bool verify,
bool bulkOpEn,
bool updateNotify,
uint32_t modelId,
bool byteReverse,
bool bitReverse,
uint32_t binPoint,
uint32_t numValues,
uint32_t valueBits,
uint32_t valueStride,
uint32_t retryCount) {
rim::VariablePtr v = std::make_shared<rim::Variable>(name,
mode,
minimum,
maximum,
offset,
bitOffset,
bitSize,
overlapEn,
verify,
bulkOpEn,
updateNotify,
modelId,
byteReverse,
bitReverse,
binPoint,
numValues,
valueBits,
valueStride,
retryCount);
rim::VariablePtr rim::Variable::create(
std::string name,
std::string mode,
double minimum,
double maximum,
uint64_t offset,
std::vector<uint32_t> bitOffset,
std::vector<uint32_t> bitSize,
bool overlapEn,
bool verify,
bool bulkOpEn,
bool updateNotify,
uint32_t modelId,
bool byteReverse,
bool bitReverse,
uint32_t binPoint,
uint32_t numValues,
uint32_t valueBits,
uint32_t valueStride,
uint32_t retryCount) {
rim::VariablePtr v = std::make_shared<rim::Variable>(
name,
mode,
minimum,
maximum,
offset,
bitOffset,
bitSize,
overlapEn,
verify,
bulkOpEn,
updateNotify,
modelId,
byteReverse,
bitReverse,
binPoint,
numValues,
valueBits,
valueStride,
retryCount);
return (v);
}

// Setup class for use in python
void rim::Variable::setup_python() {
#ifndef NO_PYTHON
bp::class_<rim::VariableWrap, rim::VariableWrapPtr, boost::noncopyable>("Variable",
bp::init<std::string,
std::string,
bp::object,
bp::object,
uint64_t,
bp::object,
bp::object,
bool,
bool,
bool,
bool,
bp::object,
bp::object,
uint32_t>())
bp::class_<rim::VariableWrap, rim::VariableWrapPtr, boost::noncopyable>(
"Variable",
bp::init<std::string,
std::string,
bp::object,
bp::object,
uint64_t,
bp::object,
bp::object,
bool,
bool,
bool,
bool,
bp::object,
bp::object,
uint32_t>())
.def("_varBytes", &rim::Variable::varBytes)
.def("_offset", &rim::Variable::offset)
.def("_shiftOffsetDown", &rim::Variable::shiftOffsetDown)
Expand Down
5 changes: 3 additions & 2 deletions src/rogue/protocols/packetizer/ControllerV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ void rpp::ControllerV2::transportRx(ris::FramePtr frame) {
tranFrame_[tmpDest]->setLastUser(tmpLuser);
transSof_[tmpDest] = true;
tranCount_[tmpDest] = 0;
if (app_[tmpDest]) { app_[tmpDest]->pushFrame(tranFrame_[tmpDest]); }
if (app_[tmpDest]) {
app_[tmpDest]->pushFrame(tranFrame_[tmpDest]); }
tranFrame_[tmpDest].reset();

// Detect SSI error
Expand Down Expand Up @@ -358,7 +359,7 @@ void rpp::ControllerV2::applicationRx(ris::FramePtr frame, uint8_t tDest) {
fUser,
tDest,
segment,
data[7],
data[7]>>7,
lUser,
data[size - 7],
last);
Expand Down
56 changes: 42 additions & 14 deletions tests/test_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@
import pyrogue.interfaces.simulation
import rogue.interfaces.memory
import time
import hwcounter

#rogue.Logging.setLevel(rogue.Logging.Debug)
#import logging
#logger = logging.getLogger('pyrogue')
#logger.setLevel(logging.DEBUG)

MaxCycles = { 'remoteSetRate' : 8.0e9,
'remoteSetNvRate' : 7.0e9,
'remoteGetRate' : 6.0e9,
'localSetRate' : 8.0e9,
'localGetRate' : 6.0e9,
'linkedSetRate' : 9.0e9,
'linkedGetRate' : 8.0e9 }

class TestDev(pr.Device):

def __init__(self,**kwargs):
Expand Down Expand Up @@ -98,57 +107,76 @@ def test_rate():

with DummyTree() as root:
count = 100000
resultRate = {}
resultCycles = {}

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemote.set(i)
remoteSetRate = 1/((time.time()-stime) / count)
resultCycles['remoteSetRate'] = float(hwcounter.count_end() - scount)
resultRate['remoteSetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemoteNoVerify.set(i)
remoteSetNvRate = 1/((time.time()-stime) / count)
resultCycles['remoteSetNvRate'] = float(hwcounter.count_end() - scount)
resultRate['remoteSetNvRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemote.get()
remoteGetRate = 1/((time.time()-stime) / count)
resultCycles['remoteGetRate'] = float(hwcounter.count_end() - scount)
resultRate['remoteGetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLocal.set(i)
localSetRate = 1/((time.time()-stime) / count)
resultCycles['localSetRate'] = float(hwcounter.count_end() - scount)
resultRate['localSetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLocal.get()
localGetRate = 1/((time.time()-stime) / count)
resultCycles['localGetRate'] = float(hwcounter.count_end() - scount)
resultRate['localGetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLink.set(i)
linkedSetRate = 1/((time.time()-stime) / count)
resultCycles['linkedSetRate'] = float(hwcounter.count_end() - scount)
resultRate['linkedSetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLink.get(i)
linkedGetRate = 1/((time.time()-stime) / count)
resultCycles['linkedGetRate'] = float(hwcounter.count_end() - scount)
resultRate['linkedGetRate'] = int(1/((time.time()-stime) / count))

passed = True

for k,v in MaxCycles.items():

print(f"{k} cyles {resultCycles[k]:.2e}, maximum {v:.2e}, rate {resultRate[k]}")

print(f"Remote Set Rate = {remoteSetRate:.0f}")
print(f"Remote Set Nv Rate = {remoteSetNvRate:.0f}")
print(f"Remote Get Rate = {remoteGetRate:.0f}")
print(f"Local Set Rate = {localSetRate:.0f}")
print(f"Local Get Rate = {localGetRate:.0f}")
print(f"Linked Set Rate = {linkedSetRate:.0f}")
print(f"Linked Get Rate = {linkedGetRate:.0f}")
if resultCycles[k] > v:
passed = False

if passed is False:
raise AssertionError('Rate check failed')

if __name__ == "__main__":
test_rate()

0 comments on commit 64ac9ce

Please sign in to comment.