1

I converted my py code to c with cython, and I compiled to a executable application in ubuntu environment as below:

cython mmd_ai_release.py --embed
gcc `python3.7-config --cflags --ldflags` mmd_ai_release.c -o ai_module -v -I /usr/include/python3.7/ -L /usr/lib/python3.7 -lpython3.7

I can get the executable software, and I can run it successfully, but the application was invoked many times in one call as below, I cannot make sure who called it, and how to prevent the wrong invoking. Anyone can help me for it?

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                     
 9970 xx        20   0 2949576 706176 125276 R  80.8  1.1   0:02.44 ai_module                                                                                   
 9991 xx        20   0 2316072 211048 112616 R  53.0  0.3   0:01.60 ai_module 

The print info in the Terminal is as below:

usage: ai_module [-h] [--input INPUT_FILEPATH] [--label LABEL_FILE] [--output OUTPUT_FILEPATH]
ai_module: error: unrecognized arguments: -c from multiprocessing.semaphore_tracker import main;main(5)
usage: ai_module [-h] [--input INPUT_FILEPATH] [--label LABEL_FILE] [--output OUTPUT_FILEPATH]
ai_module: error: unrecognized arguments: -c from multiprocessing.semaphore_tracker import main;main(4)
usage: ai_module [-h] [--input INPUT_FILEPATH] [--label LABEL_FILE] [--output OUTPUT_FILEPATH]
  • Does this answer your question? [Compiling Executable with dask or joblib multiprocessing with cython results in errors](https://stackoverflow.com/questions/47325297/compiling-executable-with-dask-or-joblib-multiprocessing-with-cython-results-in) – ead Apr 22 '20 at 06:30
  • If the above link doesn't solve your question, you should provide a [mcve], because without code it is hard to tell what is going wrong -only guess. – ead Apr 22 '20 at 06:31
  • I followed the suggestion in https://stackoverflow.com/questions/47325297/compiling-executable-with-dask-or-joblib-multiprocessing-with-cython-results-in And the scenario seems similar as my issue -- "error: unrecognized arguments: -c from multiprocessing.semaphore_tracker import" But I followed the modification as below, it seems it can solve my issue. import multiprocessing import sys if __name__ == '__main__': setattr(sys, 'frozen', True) multiprocessing.freeze_support() args = parse_args() ... – Xiaofeng Lei Apr 22 '20 at 15:51

0 Answers0