Closed entest-hai closed 2 years ago
@entest-hai Acknowledge this, and thanks for details reproduction. our team looking into it
@entest-hai Can you share your how you got numpy installed on your aws lambda function...Did you unzip the numpy .whl
, zipped it and uploaded the zip to lambda?
@tbbharaj I used ecr image to deploy lambda functions. For the ARM, I built the ecr image from an ARM EC2 instance. Here is the Dockerfile
FROM public.ecr.aws/lambda/python:3.8
# create code dir inside container
RUN mkdir ${LAMBDA_TASK_ROOT}/source
# copy code to container
COPY . ${LAMBDA_TASK_ROOT}/source
# copy handler function to container
COPY ./handler.py ${LAMBDA_TASK_ROOT}
# install dependencies for running time environment
RUN pip3 install -r ./source/requirements.txt --target "${LAMBDA_TASK_ROOT}"
# set the CMD to your handler
CMD [ "handler.lambda_handler" ]
requirements.txt has only one line
numpy==1.22.1
Here is my repository for this experiment Graviton FFT
The above single-thread program runs 2.2x faster on Graviton3 than on Graviton2:
c6g: single thread running time 946.2721347808838 ms
c7g: single thread running time 431.43606185913086 ms
c5: single thread running time 713.0439281463623 ms
Graviton3 has a 2x wider FP unit than Graviton2.
@sebpop recently, as CodeBuild support ARM Graviton, I tested again by using the CodeBuild Graviton instance, and Graviton run faster about 34% than x86. So I would like to close this.
Setting
""" import json import numpy as np from concurrent.futures import ThreadPoolExecutor from datetime import datetime
def single_thread_fft(sig): """ normal fft """ start_time = datetime.now() for x in sig: np.fft.fft(x, axis=0) end_time = datetime.now() delta_time = end_time.timestamp() - start_time.timestamp() print("single thread running time {0} ms".format(delta_time * 1000)) return delta_time
def multi_thread_fft(sig): """ thread fft """ start_time = datetime.now() with ThreadPoolExecutor(max_workers=4) as executor: for x in sig: executor.submit(np.fft.fft, x, axis=0) end_time = datetime.now() delta_time = end_time.timestamp() - start_time.timestamp() print("multi thread running time {0} ms".format(delta_time * 1000)) return delta_time
def lambda_handler(event, context): """ Lambda handler """
signal for one channel
"""