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

Functions

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

Variables

int recvBufSize = 0x1000000
 
int real_buffer_size = 0
 

Function Documentation

◆ uppercase()

def custom.uppercase (   input_array,
  total_size,
  fpga_ip,
  fpga_port,
  debug_level 
)

Definition at line 41 of file custom.py.

41 def uppercase(input_array, total_size, fpga_ip, fpga_port, debug_level):
42  logging.basicConfig(level=debug_level)
43  bytesToSend = input_array.tostring()
44  # Create a UDP socket at client side
45  UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
46  previous_buffer_size = UDPClientSocket.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF)
47  UDPClientSocket.setsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF, recvBufSize)
48  real_buffer_size = UDPClientSocket.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF)
49  if(real_buffer_size/2 != recvBufSize):
50  logging.warning("set SO_RCVBUF failed! got only: " +str(real_buffer_size/2) + "; trying to continue...")
51  BUFF_SIZE = 1024#65536
52  serverAddressPort = (fpga_ip, fpga_port)
53  cnt = 0;
54  while True:
55  logging.debug("Sending bytes: " + str(cnt*BUFF_SIZE) + " : " + str((cnt+1)*BUFF_SIZE-1))
56  UDPClientSocket.sendto(bytesToSend[cnt*BUFF_SIZE:(cnt+1)*BUFF_SIZE], serverAddressPort)
57  if ((cnt+1)*BUFF_SIZE >= total_size):
58  logging.debug("INFO: Reached size to sent")
59  break;
60  else:
61  cnt = cnt + 1
62  cnt = 0;
63  output_array = np.zeros((total_size,), dtype=input_array.dtype)
64  while True:
65  logging.debug("Receiving bytes: " + str(cnt*BUFF_SIZE) + " : " + str((cnt+1)*BUFF_SIZE-1))
66  msgFromServer = UDPClientSocket.recvfrom(BUFF_SIZE)
67  y = np.frombuffer(msgFromServer[0], dtype=input_array.dtype)
68  logging.debug(output_array[cnt*BUFF_SIZE:(cnt+1)*BUFF_SIZE-1].size)
69  output_array[cnt*BUFF_SIZE:(cnt+1)*BUFF_SIZE] = y
70  if ((cnt+1)*BUFF_SIZE >= total_size):
71  logging.debug("Reached size to receive")
72  break;
73  else:
74  cnt = cnt + 1
75  return output_array
76 
void uppercase(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)
Main process of the Uppercase Application directives.
Definition: uppercase.cpp:335
Here is the call graph for this function:

Variable Documentation

◆ real_buffer_size

int custom.real_buffer_size = 0

Definition at line 39 of file custom.py.

◆ recvBufSize

int custom.recvBufSize = 0x1000000

Definition at line 38 of file custom.py.