Closed ghost closed 4 years ago
At the moment there is no optimised assembler code specific to core 19 or Xeon W. But you can use the Python script at "msvc\mpir_config.py" to select another processor architecture close to these and achieve optimised performance that should be a lot better than the version without optimisation.
This is the error I got when I ran mpir_config.py
D:\3rd-parties\mpir-master\msvc>python mpir_config.py Traceback (most recent call last): File "mpir_config.py", line 265, in
t = find_src(c_directories) File "mpir_config.py", line 188, in find_src for f in listdir(join(mpir_root_dir, d)): FileNotFoundError: [WinError 3] The system cannot find the path specified: ''
So, how to fix this? PS, the python I am using is v3.7.4.
I need more information before I can advise you on how this can be fixed.
Could you please add the line: print(join(mpir_root_dir, d)) immediately before for f in listdir(join(mpir_root_dir, d)): (i.e. before line 188) in mpir_config.py and then run it again and let me know what is printed out.
The output is an empty string.
This is because of line 36
build_root_dir = dirname(__file__)
which returns from __file__
only the filename of mpir_config.py
without any directory name (please note how I ran this python script) and therefore build_root_dir
is empty, In turn, the following line makes variable mpir_root_dir
empty. Going back to line 188, the argument dir_list
of function find_src
is ('', '', 'fft', 'mpf', 'mpq', 'mpz', 'printf', 'scanf')
. Together with the empty mpir_root_dir
, join
returns nothing but an empty string and that causes the error.
To fix the bug, I suggest changing line 36 to:
import os
print(os.path.realpath(__file__))
to extract directory even if I run mpir_config.py
without directory. Thanks.
PS, for the Xeon W CPU I am using, is it compatible to choose 32. skylake_avx (x64)
in mpir_config.py
, and is the next step after that would simply be open the solution in VS and compile? Thank you.
Thank you for your debugging effort.
This is the first time that the file path detection has failed so I am a bit puzzled about what you are doing that is different. Are you using symbolic links?
Anyway, I have tested your proposed solution and it works even when it is not necessary so I have added it to mpir_config.py
I believe that the skylake_avx version should work on the Xeon W CPU. After running and selecting it in mpir_config.py, it adds this configuration to the VS solution so it will be available when you open Visual Studio. It adds both a DLL and static library project for the chosen architecture.
I first cd
to the directory where mpir_config.py
is, i.e., D:\3rd-parties\mpir-master\msvc
. Then I invoked mpir_config.py
using command python mpir_config.py
without any path in front of mpir_config.py
. I guess that's the reason why dirname
failed the path detection. If, however, I am not in the directory where mpir_config.py
is, but locate this script using some path-searching mechanism, I guess the path from the search result would be prefixed in front of mpir_config.py
and that way dirname
would work as expected. The code modification was inspired by answer to this stackoverflow thread.
There is one more question I would like to ask. I set the environment variable YASMPATH
to C:\Program Files\yasm
where I extracted YASM for VS to, but in VS the command to call vsyasm is ""C:\Program Files\yasm"vsyasm.exe ...
. So it is clear that the problem is the missing of the backslash. I was wondering if the construction of the path to vsyasm.exe
is also part of MPIR. If so, is it possible to add the functionality in the MPIR building script of appending a backslash if there is not one just in case the user missed it in the YASMPATH
environment variable? That would remove unnecessary difficulty of building-up if the user is unaware of this trick. Thank you.
I also invoke mpir_config.py from the msvc directory but with the commnd mpir_config.py (i.e. without the python prefix). So it seems that invoking the Python interpreter in different ways gives a different result. But it now works in both cases so we don't need to worry about it!
On your question about the YASM path, this is not MPIR functionality but part of YASM functionality set by the file vsyasm.props. But I am also a member of the YASM development team and have had a look at this.
I believe that it can be fixed by changing a line in the vsyasm.props file, which I will do this after I have fully tested it. If you want to try it, "$(YASM_PATH)"vsyasm.exe in line 21 in vsyasm.props needs to be: "$(YASM_PATH.TrimEnd('\'))"\vsyasm.exe
I have tried the suggested modification and it works very well. Thank you for letting me know that. Only one problem: There are three vsyasm.exe
: one in the installation directory C:\Program Files\yasm
, one in D:\3rd-parties\mpir-master\msvc
and one in D:\3rd-parties\mpir-master\msvc\vs15
. It is the change in the last one that will work, perhaps because it is closest to the project. Thank you again for the help. This ticket can be closed now.
If you don't define YASM_PATH, it will use the default at C:\Program Files\yasm\, otherwise it will use the location you set by defining YASM_PATH.
Is there any optimized assembly for Core i9 and Xeon W CPU?