Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
configuration for OMP_NUM_THREADS and WEB_SERVER_WORKERS
Browse files Browse the repository at this point in the history
  • Loading branch information
sh1ng authored and achraf-mer committed Jun 13, 2022
1 parent 323c8ac commit 7e45ef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions aws-sagemaker-hosted-scorer-cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ docker run \

(the number of web server workers can be configured by setting the environment variable: `WEB_SERVER_WORKERS` in the docker run command)

Recommended parameters:
* `OMP_NUM_THREADS=8` and can be increased for long size texts.
* `cores/(2*OMP_NUM_THREADS) <= WEB_SERVER_WORKERS <= cores/OMP_NUM_THREADS`
* `OMP_NUM_THREADS*WEB_SERVER_WORKERS` MUST NOT exceed `cores`

Step 3: Use the following curl command to test the container locally:

```
Expand Down
4 changes: 1 addition & 3 deletions aws-sagemaker-hosted-scorer-cpp/py/scorer/mojo_cpp_scorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def get_prediction(self, d_frame):

@staticmethod
def _set_omp_threads():
os.environ['OMP_NUM_THREADS'] = str(max(1, int(os.cpu_count()/2)))
os.environ['OMP_SCHEDULE'] = 'STATIC'
os.environ['OMP_PROC_BIND'] = 'CLOSE'
os.environ['OMP_NUM_THREADS'] = str(min(8, int(os.cpu_count())/2))


class ScorerError(Exception):
Expand Down

0 comments on commit 7e45ef2

Please sign in to comment.