-
Notifications
You must be signed in to change notification settings - Fork 12k
Comparison of Windows Build VS Unix Build (through WSL2) #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The generation differences may be explained by the lack of FMA and F16C/CVT16 on MSVC. #375 should solve that. |
Wouldn't this suggest that Windows should be the less performant of the two? Because in this case he's seeing that windows performs better without the compiler flag optimizations, as I understand it. Also, I'm not sure if comparing Windows to WSL is equivalent to Windows to Unix. Might there be inherent performance losses when using WSL without implementing specific adaptions for WSL? Unrelated to performance, the determinism does seem like an issue. |
@MillionthOdin16 Sorry I messed up, I didn't use the same models for both at the begining, I fixed that and arrived into a different conclusion (I modified the post in consequence) |
Regardless, WSL2 is running in a VM, a small performance penalty is expected. |
@BadisG do you mean that the runs are deterministic? Or that the performance of both are similar enough? Or both? |
@MillionthOdin16 What I meant by "deterministic" runs is that I fixed the seed to 1, and that alone is supposed to give you the exact same output regardless of anything else. But that isn't the case there, the Unix output and the Windows output are differents for a fixed seed, and it's not supposed to behave like this. |
There are always going to be small differences in the generation between different implementations, in this case it is probably because the lack of FMA on MSVC means that some functions use a different path. You should only expect determinism against multiple runs of the same binary. For evaluating generation quality, you should use the perplexity instead. It would be an issue if there are significant differences in the perplexity of different implementations. |
You get different output text because of the temperature setting. To really get deterministic outputs you have to set the temperature nearly to zero (but not exactly zero because then garbage out) even the seed is the same. This seems to be a bug or math calc rounding error or whatever. For deterministic testing outputs, I set mine to |
@PriNova Nah, when you fix the seed (I put seed = 1) you'll get the same output everytime. |
The build flags to enable FMA, F16C, and SSE3 are not in the MSVC. (At least not within the official documentation) However, by using Clang, which can be installed from Visual Studio, the result is the same as a Unix build.
|
@nusu-github wouldn't this work?
"In this example, the /arch:SSE3 flag enables SSE3 support, while the /arch:AVX flag enables F16C and FMA support as part of the AVX instruction set. Note that you should choose the appropriate AVX level (AVX, AVX2, or AVX512) depending on your target CPU." That's a solution proposed by GPT4, not sure if this is possible though |
Unfortunately, this undocumented build flag is not available. |
@nusu-github I'm using this cmd command to compile in MSVC:
What should I write to use clang instead? |
Clang must be installed using Visual Studio Installer. If you already have Clang installed, you can now build.
Also consider the following options if you are looking to speed up the process.
|
@nusu-github thanks I appreciate! But I looked at the CMakeList.txt and I don't think there's clang activated in it, so it will alaways create exe binary through MSVC
Besides, the exe binaries we can download on this repository are likely made by MSVC because it also only recognize the AVX and AVX2 |
@BadisG
When executed correctly, it will look like this
|
@nusu-github thank you so much it worked on my side! Everyone, here's the steps to build your .exe with clang (better than MSVC at the moment)
After the installation you can verify if you have clang installed on your computer by running
You'll get your exe here:
Would be good to get those clang's exe on the binary releases instead of the MSVC's exe from now on as clang is the superior version to compile in windows. |
@slaren I did a new run with the clang build (which has all the same architectures implementations as gcc) and I still have different outputs Windows (clang)
Unix (gcc)
|
@BadisG A quick search suggests that clang and GCC may produce slightly different results with floating point operations. You can try building with clang on WSL2 to see if that's the case, but unless there is a significant difference in the perplexity I don't think that this is an issue. |
@slaren I agree with you, if the perplexity is similar between GCC and Clang I don't see the problem either. I guess I have to test it out to be sure. |
You're right. I always took |
@PriNova -s 0 was in the range of non-random interval last week, I guess they changed it now 😅 |
any update on this? would also like to know if the difference in output is due to the different compilers or something else |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
Uh oh!
There was an error while loading. Please reload this page.
Environment and Context
Hello,
Before jumping to the subject, here's the environnement I'm working with:
Expected Behavior
I did some comparaisons between the Windows build and the Unix build (through WSL2 Ubuntu_2204.1.8.0_x64) to see if I can notice some differences between them.
Deterministic Settings (seed =1)
For both of those builds, I added the same exact settings:
With the contents of STORY.txt as follows:
Test#1: Instruction set architectures
Windows:
WSL2
The Unix-build recognizes all the architectures of my CPU but the Windows-build is missing the F16C, FMA and SSE3 one.
Test#2: Reproducibility of the output
Since I used the exact same settings for both the Windows and Unix builds (refer to "Deterministic Settings (seed=1)"), I should expect to obtain the exact same output from both.
Windows (I'll call this output "WindowsText"):
WSL2 (I'll call this output "UnixText")
It's not the case at all, you will get a different output based on the fact you're using a Windows build or a Unix build.
It mentions the importance of hand-eye coordination in sports like basketball or football, which are common activities that many people can relate to.
UnixText provides a more comprehensive list of benefits. It discusses the improvement of attention span, the development of social skills, and the teaching of patience, which are all valuable skills that were not mentioned in WindowsText.
The structure of UnixText is clearer and more concise, which makes it easier to read and understand.
Test#3: Speed
Windows:
WSL2:
Unix tends to be faster than Windows, which may be due to the absence of F16C, FMA, and SSE3 architectures in the Windows build.
Conclusion
I think the discrepancies between the two operating systems were not only observed by me but also by others, and efforts are underway to address them. Nonetheless, I found it interesting to witness such differences between the two systems.
The text was updated successfully, but these errors were encountered: