anything wrong with this mag_set_d test?

14 views
Skip to first unread message

Stephen Crowley

unread,
Nov 23, 2023, 9:34:20 PM11/23/23
to flint-devel
#include <stdio.h>
#include <arb.h>

void test_mag_set_d(double value) {
    mag_t mag;
    mag_init(mag); // Initialize the mag_t variable

    mag_set_d(mag, value); // Call the function with the provided value

    // Print the result
    printf("mag_set_d with value %f: ", value);
    mag_print(mag);
    printf("\n");

    mag_clear(mag); // Clear the mag_t variable
}

int main() {
    // Test the function with various values
    test_mag_set_d(0.0);
    test_mag_set_d(1.0);
    test_mag_set_d(-1.0);
    test_mag_set_d(123.456);
    test_mag_set_d(-123.456);

    return 0;
}



its giving me

crow@c17:~/a$ ./testSetMag
mag_set_d with value 0.000000: (0)
Illegal instruction (core dumped)

running on an 12th Gen Intel(R) Core(TM) i9-12900H with avx2 and avx512 enabled

crow@c17:~/a$ cat Makefile
BASEDIR=$(dirname $(readlink -f $0))/..
INCLUDES=-I/usr/include/x86_64-linux-gnu -I/usr/include/linux -I/usr/include/flint -I/usr/include -I/usr/include/i386-linux-gnu -I/usr/lib/gcc/x86_64-linux-gnu/11/include/
SOURCES=native/arb_wrap.c native/color.c native/complex.c
JAVA_HOME=$(shell readlink -f /usr/bin/javac | sed "s:bin/javac::")
C_INCLUDES=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I/usr/local/include -I/usr/local/include/flint
CFLAGS=-g -O3 -fPIC -shared -Wno-int-conversion
SWIGFLAGS=-small -v -java -package arb -outdir src/main/java/arb

all: libarblib.so

native/arb_wrap.c: native/*.i
swig $(SWIGFLAGS) $(INCLUDES) native/arb.i

libarblib.so: $(SOURCES)
clang $(CFLAGS) $(SOURCES) $(C_INCLUDES) -olibarblib.so -lflint  

clean:
rm -f libarblib.so *.o native/arb_wrap.c

Stephen Crowley

unread,
Nov 23, 2023, 9:37:25 PM11/23/23
to flint-devel
that was it, rebuilt without avx2 and avx512 and it worked

Illegal instruction (core dumped)

crow@c17:~/a$ ./testSetMag
mag_set_d with value 0.000000: (0)
mag_set_d with value 1.000000: (536870913 * 2^-29)
mag_set_d with value -1.000000: (536870913 * 2^-29)
mag_set_d with value 123.456000: (1035623990 * 2^-23)
mag_set_d with value -123.456000: (1035623990 * 2^-23)

i guess this particular configuration doesnt have avx512 enabled

crow@c17:~/a$ lscpu
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         46 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  20
  On-line CPU(s) list:   0-19
Vendor ID:               GenuineIntel
  Model name:            12th Gen Intel(R) Core(TM) i9-12900H
    CPU family:          6
    Model:               154
    Thread(s) per core:  2
    Core(s) per socket:  14
    Socket(s):           1
    Stepping:            3
    CPU(s) scaling MHz:  9%
    CPU max MHz:         5000.0000
    CPU min MHz:         400.0000
    BogoMIPS:            5836.80
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2
                         ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology no
                         nstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fm
                         a cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
                          3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad f
                         sgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveop
                         t xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hw
                         p_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_
                         clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities
Reply all
Reply to author
Forward
0 new messages