1/* 2 * Copyright (c) 2007-12 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#include <stdio.h> 11#include <string.h> 12#include <stdlib.h> 13 14#include <barrelfish/barrelfish.h> 15#include <barrelfish/dispatch.h> 16 17#include <xeon_phi/xeon_phi.h> 18#include <xeon_phi/xeon_phi_client.h> 19 20 21#include "benchmark.h" 22#include "common.h" 23 24 25int main(int argc, 26 char **argv) 27{ 28 errval_t err; 29 30 debug_printf("Xeon Phi Test started on the card.\n"); 31 32 err = xeon_phi_client_init(disp_xeon_phi_id()); 33 EXPECT_SUCCESS(err, "xeon_phi_client_init"); 34 35 xeon_phi_client_set_callbacks(&callbacks); 36 37 alloc_local(); 38 39 wait_for_connection(); 40 41 char iface[30]; 42 snprintf(iface, 30, "xphi_ump_bench.%u", XPHI_BENCH_CORE_HOST); 43 44 debug_printf("sending open to host domain..\n"); 45 err = xeon_phi_client_chan_open(disp_xeon_phi_id(), domainid, 0, local_frame, 2); 46 EXPECT_SUCCESS(err, "xeon_phi_client_init"); 47 48#if XPHI_BENCH_INITIATOR_HOST 49 debug_printf("giving time for host to initialize...\n"); 50 for (uint32_t i = 0; i < 10; ++i) { 51 delay_ms(4000); 52 thread_yield(); 53 } 54#endif 55 56#if XPHI_BENCH_INITIATOR_HOST 57 debug_printf("---------------- normal run -----------------\n"); 58 xphi_bench_start_echo(&xphi_uc); 59 debug_printf("---------------- reversed run -----------------\n"); 60 xphi_bench_start_echo(&xphi_uc_rev); 61#else 62#ifndef XPHI_BENCH_THROUGHPUT 63 debug_printf("---------------- normal run -----------------\n"); 64 xphi_bench_start_initator_rtt(&xphi_uc); 65 debug_printf("---------------- reversed run -----------------\n"); 66 xphi_bench_start_initator_rtt(&xphi_uc_rev); 67#else 68#ifdef XPHI_BENCH_SEND_SYNC 69 debug_printf("---------------- normal run -----------------\n"); 70 xphi_bench_start_initator_sync(&xphi_uc); 71 debug_printf("---------------- reversed run -----------------\n"); 72 xphi_bench_start_initator_sync(&xphi_uc_rev); 73#else 74 debug_printf("---------------- normal run -----------------\n"); 75 xphi_bench_start_initator_async(&xphi_uc); 76 debug_printf("---------------- reversed run -----------------\n"); 77 xphi_bench_start_initator_async(&xphi_uc_rev); 78#endif 79#endif 80#endif 81} 82 83