minGWがopenMPをサポートしない

조회 수: 7 (최근 30일)
Tatsuya Yoshida
Tatsuya Yoshida 2024년 6월 26일
편집: Alan 2024년 7월 4일
R2017bでMinGW -w64 コンパイラを使用してCのMEXファイルをコンパイルしていますが、codegenでCコードを生成すると、コマンドウィンドウに「Warning: 選択したコンパイラは OpenMP ライブラリをサポートしません。このループは並列処理されません。」というメッセージが表示されます。MEX関数の生成は成功しています。
R2018aはR2017bと同じバージョンのMinGW -w64 コンパイラを使用するため、同様な操作を行うとエラーメッセージが表示されることなくMEX関数を生成できます。
R2017bで並列処理できるようにコンパイルすることはできますか。

답변 (1개)

Alan
Alan 2024년 7월 4일
편집: Alan 2024년 7월 4일
Hi Tatsuya,
I do not speak Japanese, so I am answering in English. So, I apologize in advances for any unintended tone or misinterpretation.
I was able to generate Mex files from C-code without the warning you mentioned. You could try updating MATLAB R2017b and the MATLAB Support for MinGW-w64 C/C++ Compiler” feature to the latest versions. Here are the versions I used:
  • MATLAB Version: 9.3.0.713579 (R2017b)
  • MATLAB Support for MinGW-w64 C/C++ Compiler (Version 17.2.0)
After that, you could make sure that the mex command is actually using the installed MinGW by executingmex -setup”. The output should look similar to this:
After confirming that the correct compiler is being used, execute the following command to generate Mex with OpenMP support:
mex file_name.c COMPFLAGS="/openmp $COMPFLAGS"
Also, make sure that the path to your C file does not contain any blank spaces, as this could cause problems during compilation.
Happy to help.

제품


릴리스

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!