Closed jdx-gh closed 1 year ago
There are similar issues in main.cpp in lines 942, 973 and 2588.
hm are you sure you're using 64 bit compiler?
size_t
is memory address size, and so on a 64bit machine it has to be, well. 64 bits = 8 bytes.
I am sure:
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\Tools\MSYS\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/Tools/MSYS/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-11.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev8, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\ -Wl,--stack,12582912'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Rev8, Built by MSYS2 project)
The following test program:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("sizeof(int): %d\n", sizeof(int));
printf("sizeof(long): %d\n", sizeof(long));
printf("sizeof(long long): %d\n", sizeof(long long));
printf("sizeof(size_t): %d\n", sizeof(size_t));
return 0;
}
displays
sizeof(int): 4
sizeof(long): 4
sizeof(long long): 8
sizeof(size_t): 8
Of course there is a mistake in my original post: sizeof(size_t) is indeed 8, but sizeof(unsigned long) is 4. Either way, the compiler is right – different types of different size are compared.
Regarding WSL – what about Ubuntu running on VirtualBox (I've got such a setup)? Shouldn't performance of both solutions be pretty much the same? Perhaps Cygwin? Anyway, I am trying to help my sister who is a biologist but is not fluent in programming, operating systems and similar things. I just want to provide her one native binary which does not require additional stuff, possibly optimized for her CPU.
I can see that util/sysutil.cpp is a bigger problem – it requires some time to port it to Windows/MinGW64. I you are interested I can post my changes later today (or tomorrow).
Ok, I see. I tried compiling with Cygwin about a year ago and the performance was pretty bad compared to Ubuntu on the same machine. I also tried to produce a native win binary with minGW and MSVC, but i ran into too many compilation errors. so I gave up. Not sure whether situation improved since then, but I'm afraid not. Maybe your sister could just try VirtualBox and check whether performance will be acceptable for her purposes?.But of course, if you are willing to invest time in Windows porting, your contribution will be much appreciated!
Regarding types: yes. unsigned long
is the problem here. I don't quite understand why I have to explain to the compiler that it is perfectly safe to convert constant 1
to size_t
(or any int type for that matter)? It seems that template type deduction fails miserably in this case, so presumably std::max<size_t>()
will fix it.
The problem has been fixed so I believe the ticket can be closed.
Windows 10 64 bit, MSYS2/gcc 11.2.0 Configure command:
cmake -G "MSYS Makefiles" -DSTATIC_BUILD=ON -DUSE_GMP=ON ..
Compilation fails with the following message:
Of course the compiler is right because "pears and apples" are tried to be compared here. AFAIR on 64-bit machines size_t is defined as unsigned int (4 bytes) while 1 in line 121 is explicitly casted to unsigned long (8 bytes).
I believe line 121 should be:
size_t group_size = opts.num_threads / std::max(groups_per_rank, static_cast<size_t>(1));