From cdd1cb0e8c4fda3671714bb5ad6ba1825cff16d1 Mon Sep 17 00:00:00 2001
From: Puneet Kohli <punkohl@gmail.com>
Date: Sun, 06 May 2018 21:45:26 +0000
Subject: [PATCH] Change matplotlib backend to 'agg' when 'show_plot' is false. This allows the script to be run from command line without any errors (for ex, on a remote machine)

---
 src/gemm.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gemm.c b/src/gemm.c
index 4eb36fb..317fd65 100644
--- a/src/gemm.c
+++ b/src/gemm.c
@@ -92,6 +92,7 @@
 #include <ammintrin.h>
 #include <immintrin.h>
 #include <smmintrin.h>
+#include <cpuid.h>
 
 void asm_cpuid(uint32_t* abcd, uint32_t eax)
 {
@@ -109,17 +110,18 @@
 	abcd[2] = ecx;
 	abcd[3] = edx;
 }
+
 #endif
 
-inline int simd_detect_x86(unsigned int idFeature)
+int simd_detect_x86(unsigned int idFeature)
 {
 	uint32_t regs[4];	// EAX, EBX, ECX, EDX;
 #ifdef _WIN32
 	__cpuid(regs, 0);
 	if (regs[0] > 1U) __cpuid(regs, 1);
 #else
-	asm_cpuid(regs, 0);
-	if (regs[0] > 1U) asm_cpuid(regs, 0);
+	__get_cpuid(0, &regs[0], &regs[1], &regs[2], &regs[3]);
+	if(regs[0] > 1U) __get_cpuid(1, &regs[0], &regs[1], &regs[2], &regs[3]);
 #endif
 
 	if ((regs[2] & idFeature) != idFeature)
@@ -127,7 +129,7 @@
 	return 1;
 }
 
-inline int is_fma_avx() {
+int is_fma_avx() {
 	static int result = -1;
 	if (result == -1) {
 		result = simd_detect_x86(AVXFlag);

--
Gitblit v1.10.0