cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
vision Namespace Reference

Functions

def median_blur (input_array, total_size, fpga_ip, fpga_port, debug_level)
 

Variables

int recvBufSize = 0x1000000
 
int real_buffer_size = 0
 

Function Documentation

◆ median_blur()

def vision.median_blur (   input_array,
  total_size,
  fpga_ip,
  fpga_port,
  debug_level 
)

Definition at line 42 of file vision.py.

42 def median_blur(input_array, total_size, fpga_ip, fpga_port, debug_level):
43  logging.basicConfig(level=debug_level)
44  bytesToSend = input_array.tostring()
45  # Create a UDP socket at client side
46  UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
47  previous_buffer_size = UDPClientSocket.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF)
48  UDPClientSocket.setsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF, recvBufSize)
49  real_buffer_size = UDPClientSocket.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF)
50  if(real_buffer_size/2 != recvBufSize):
51  logging.warning("set SO_RCVBUF failed! got only: " +str(real_buffer_size/2) + "; trying to continue...")
52  BUFF_SIZE = 1024#65536
53  serverAddressPort = (fpga_ip, fpga_port)
54  cnt = 0;
55  while True:
56  logging.debug("Sending bytes: " + str(cnt*BUFF_SIZE) + " : " + str((cnt+1)*BUFF_SIZE-1))
57  UDPClientSocket.sendto(bytesToSend[cnt*BUFF_SIZE:(cnt+1)*BUFF_SIZE], serverAddressPort)
58  if ((cnt+1)*BUFF_SIZE >= total_size):
59  logging.debug("INFO: Reached size to sent")
60  break;
61  else:
62  cnt = cnt + 1
63  cnt = 0;
64  output_array = np.zeros((total_size,))
65  while True:
66  logging.debug("Receiving bytes: " + str(cnt*BUFF_SIZE) + " : " + str((cnt+1)*BUFF_SIZE-1))
67  msgFromServer = UDPClientSocket.recvfrom(BUFF_SIZE)
68  y = np.frombuffer(msgFromServer[0], dtype=input_array.dtype)
69  logging.debug(output_array[cnt*BUFF_SIZE:(cnt+1)*BUFF_SIZE-1].size)
70  output_array[cnt*BUFF_SIZE:(cnt+1)*BUFF_SIZE] = y
71  if ((cnt+1)*BUFF_SIZE >= total_size):
72  logging.debug("Reached size to receive")
73  break;
74  else:
75  cnt = cnt + 1
76  return output_array
77 
void median_blur(ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NetworkWord > &siSHL_This_Data, stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &soNrc_meta, ap_uint< 32 > *po_rx_ports, stream< DmCmd > &soMemWrCmdP0, stream< DmSts > &siMemWrStsP0, stream< Axis< 512 > > &soMemWriteP0, membus_t *lcl_mem0, membus_t *lcl_mem1)
Main process of the MedianBlur Application directives.
Here is the call graph for this function:

Variable Documentation

◆ real_buffer_size

int vision.real_buffer_size = 0

Definition at line 40 of file vision.py.

◆ recvBufSize

int vision.recvBufSize = 0x1000000

Definition at line 39 of file vision.py.