cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_lithops.py
Go to the documentation of this file.
1 # *****************************************************************************
2 # * cloudFPGA
3 # * Copyright 2016 -- 2022 IBM Corporation
4 # * Licensed under the Apache License, Version 2.0 (the "License");
5 # * you may not use this file except in compliance with the License.
6 # * You may obtain a copy of the License at
7 # *
8 # * http://www.apache.org/licenses/LICENSE-2.0
9 # *
10 # * Unless required by applicable law or agreed to in writing, software
11 # * distributed under the License is distributed on an "AS IS" BASIS,
12 # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # * See the License for the specific language governing permissions and
14 # * limitations under the License.
15 # *----------------------------------------------------------------------------
16 
17 import sys
18 import os
19 
20 from multiprocessing import Pool
21 from lithops.multiprocessing import Pool
22 #import lithops
23 
24 
25 input = ["HelloWorld", "HowAreYouToday?", "HelloWorld", "HowAreYouToday?", "HelloWorld", "HowAreYdsf4f43f4rf4f4f4ouToday?"]
26 output = "111111111111111111111111111111111111111111111111"
27 
28 def my_function(input):
29  trieres_lib=os.environ['cFpRootDir'] + "/HOST/custom/uppercase/languages/python/build"
30  sys.path.append(trieres_lib)
31  import _trieres
32  out, output = _trieres.uppercase("127.0.0.1", "2718", input, True)
33  return output
34 
35 with Pool() as pool:
36  async_result = pool.map_async(my_function, input)
37  try:
38  result = async_result.get(timeout=30)
39  print(result)
40  except TimeoutError:
41  print("Timed out!")
42 
43 
44 #if __name__ == '__main__':
45 # fexec = lithops.FunctionExecutor()
46 # fexec.map(my_function, input)
47 # result = fexec.get_result()
48 # print(result)
49 # fexec.plot(dst='lithops-plots')
def my_function(input)
Definition: test_lithops.py:28