mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2016-12-22, 20:01   #1
packetnathan
 
Dec 2016

1 Posts
Exclamation AArch64 Compiling

I'm attempting to compile mprime on an aarch64-based system and am running into some issues.

- Can you provide the source code for factor64.c so that it can be compiled for aarch64?
- Can you provide guidance on where the fldcw and fnstcw instructions are being referenced when compiling gwnum? Presumably cctraipy.s is being generated in one of the compilation steps but I'm not seeing it.

It appears as though mprime or some supporting libraries rely specifically on instructions that aren't available in the ARMv8 CPU architecture, specifically fnstcw and fldcw.

Code:
root@aarch64-test:~/p95v2810/gwnum# make clean && make -f makeaarch64
gcc -I.. -DAARCH64 -O2 -c cpuid.c
gcc -I.. -DAARCH64 -O2 -c gwnum.c
gcc -I.. -DAARCH64 -O2 -c gwtables.c
gcc -I.. -DAARCH64 -O2 -c gwthread.c
gcc -I.. -DAARCH64 -O2 -c gwini.c
gwini.c: In function ‘writeIniFile’:
gwini.c:148:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   (void) _write (fd, buf, (unsigned int) strlen (buf));
   ^
gcc -I.. -DAARCH64 -O2 -c gwutil.c
g++ -I.. -I../qd -DAARCH64 -O2 -c gwdbldbl.cpp
/tmp/cctraipy.s: Assembler messages:
/tmp/cctraipy.s:4374: Error: unknown mnemonic `fnstcw' -- `fnstcw [x29,116]'
/tmp/cctraipy.s:4383: Error: unknown mnemonic `fldcw' -- `fldcw [x29,118]'
/tmp/cctraipy.s:4716: Error: unknown mnemonic `fldcw' -- `fldcw [x29,116]'
/tmp/cctraipy.s:4928: Error: unknown mnemonic `fnstcw' -- `fnstcw [x29,52]'
/tmp/cctraipy.s:4937: Error: unknown mnemonic `fldcw' -- `fldcw [x29,54]'
/tmp/cctraipy.s:4998: Error: unknown mnemonic `fldcw' -- `fldcw [x29,52]'
<snip>
makeaarch64:32: recipe for target 'gwdbldbl.o' failed
make: *** [gwdbldbl.o] Error 1
It also seems as though factor64.o is provided without the source code and as such ld can't use it since it needs a different ELF loader obviously.

Code:
/usr/bin/ld: factor64.o: Relocations in generic ELF (EM: 62)
factor64.o: error adding symbols: File in wrong format
packetnathan is offline   Reply With Quote
Old 2016-12-22, 22:50   #2
fivemack
(loop (#_fork))
 
fivemack's Avatar
 
Feb 2006
Cambridge, England

2×3,191 Posts
Default

The fnstcw and fldcw instructions manipulate the control word for the x87 FPU, to determine whether instructions will work in single, double or extended precision, as well as the rounding mode and the infinity control; the rounding mode is fairly critical for getting double-double-precision to work.

The instructions are generated in qd/dd.h around line 260

There is nothing analogous to the precision control in AArch64, though fiddling with the FPCR will let you set flush-to-zero, NaN propagation, and the rounding mode:

Code:
MRS <Xt>, FPCR; Read FPCR into Xt
MSR FPCR, <Xt>; Write Xt to FPCR
fivemack is offline   Reply With Quote
Old 2016-12-23, 01:36   #3
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

735310 Posts
Default

The rather harmless gwini.c warning should be fixed in 29.1 although source is not available yet.

Factor64.o is created from MASM source. I can give you the source code, but MASM only runs under windows. I then use Agner Fog's objconv program to convert from Windows COFF object file format to ELF file format. The easiest solution would be to see if there are any options in Agner Fog's program to create an object file you can use.

In version 29.1, I've started using HJWasm which is an open source MASM replacement. Thus, in version 29.1 and later I can provide the MASM sources for you to assemble in a variety of environments. See if HJWasm works for you. If it does that provides us with a path forward.

Version 29.1 also uses the hwloc library -- I don't know if a version of that library is available for your architecture.
Prime95 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling mfaktc on Mac OS X dozba GPU Computing 23 2017-10-03 19:50
Compiling GNFS sievers on AArch64 platform wombatman Programming 11 2017-03-11 03:12
compiling GMP-ECM ATH GMP-ECM 69 2017-01-04 12:03
compiling mprime ATH Software 9 2015-02-15 12:59
Compiling 24.14 CBoland Software 6 2007-08-01 00:11

All times are UTC. The time now is 03:50.

Wed Mar 3 03:50:37 UTC 2021 up 90 days, 1 min, 0 users, load averages: 1.77, 1.59, 1.47

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.