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#include <stdio.h> 10#include <string.h> 11#include <stdlib.h> 12 13#include <barrelfish/barrelfish.h> 14 15#include <xeon_phi/xeon_phi.h> 16#include <xeon_phi/xeon_phi_client.h> 17 18 19#include "common.h" 20#include "benchmark.h" 21 22 23 24int main(int argc, 25 char **argv) 26{ 27 errval_t err; 28 29 debug_printf("XEON PHI BENCH STARTED (HOST).\n"); 30 31 xeon_phi_client_set_callbacks(&callbacks); 32 33 coreid_t core = XPHI_BENCH_CORE_CARD; 34 char *name = "k1om/sbin/benchmarks/xphi_ump_bench"; 35 36 debug_printf("spawning %s on [%u, %u]\n", name, 0, core); 37 38 xphi_dom_id_t domid; 39 err = xeon_phi_client_spawn(XPHI_BENCH_XPHI_ID, core, name, argv, NULL_CAP, 40 0, &domid); 41 EXPECT_SUCCESS(err, "xeon_phi_client_spawn"); 42 43 // wait until client ready 44 for (uint32_t i = 0; i < 1000000; ++i) { 45 thread_yield(); 46 } 47 48 alloc_local(); 49 50 debug_printf("opening channel to client %lx...\n", domid); 51 err = xeon_phi_client_chan_open(XPHI_BENCH_XPHI_ID, domid, 0, local_frame, 2); 52 EXPECT_SUCCESS(err, "xeon_phi_client_chan_open"); 53 54 wait_for_connection(); 55 56#if XPHI_BENCH_INITIATOR_HOST 57#ifndef XPHI_BENCH_THROUGHPUT 58 debug_printf("---------------- normal run -----------------\n"); 59 xphi_bench_start_initator_rtt(&xphi_uc); 60 debug_printf("---------------- reversed run -----------------\n"); 61 xphi_bench_start_initator_rtt(&xphi_uc_rev); 62#else 63#ifdef XPHI_BENCH_SEND_SYNC 64 debug_printf("---------------- normal run -----------------\n"); 65 xphi_bench_start_initator_sync(&xphi_uc); 66 debug_printf("---------------- reversed run -----------------\n"); 67 xphi_bench_start_initator_sync(&xphi_uc_rev); 68#else 69 debug_printf("---------------- normal run -----------------\n"); 70 xphi_bench_start_initator_async(&xphi_uc); 71 debug_printf("---------------- reversed run -----------------\n"); 72 xphi_bench_start_initator_async(&xphi_uc_rev); 73#endif 74#endif 75#else 76 debug_printf("---------------- normal run -----------------\n"); 77 xphi_bench_start_echo(&xphi_uc); 78 debug_printf("---------------- reversed run -----------------\n"); 79 xphi_bench_start_echo(&xphi_uc_rev); 80#endif 81 82} 83 84