CNearestCentroid::CNearestCentroid(CDistance* d, CLabels* trainlab) : CDistanceMachine() { init(); ASSERT(d); ASSERT(trainlab); set_distance(d); set_labels(trainlab); }
CMultitaskCompositeMachine::CMultitaskCompositeMachine( CMachine* machine, CFeatures* train_features, CLabels* train_labels, CTaskGroup* task_group) : CMachine(), m_machine(NULL), m_features(NULL), m_current_task(0), m_task_group(NULL) { set_machine(machine); set_features(train_features); set_labels(train_labels); set_task_group(task_group); register_parameters(); }
CSLEPMachine::CSLEPMachine( float64_t z, CDotFeatures* train_features, CLabels* train_labels) : CLinearMachine(), m_z(1.0) { set_z(z); set_features(train_features); set_labels(train_labels); set_termination(slep_options::get_default_termination()); set_regularization(slep_options::get_default_regularization()); set_tolerance(slep_options::get_default_tolerance()); set_max_iter(slep_options::get_default_max_iter()); }
/*========================================================================*/ void HPM_Print_t(int numthreads) { int i, j, k, nblocks; // uint64_t counts, counts_0, counts_1, counts_2, counts_3; long long counts, counts_0, counts_1, counts_2, counts_3; // uint64_t l1_misses, l1p_misses, node_l1p_misses, node_l2_misses, loads, node_loads, node_l1_misses; // double cycles, ipc, stall_cycles, node_stall_cycles, node_cycles; // double node_fxu_instructions, node_fpu_instructions, node_l1_hits, node_l1p_hits, ddr_hit_fraction; // double fxu_fraction, fpu_fraction, fxu_instructions, fpu_instructions; // double cores_per_process, max_fraction, percent_max_issue_rate; // double l1_hits, l1_hit_fraction, l1p_hits, l1p_hit_fraction, node_l2_hits, l2_hit_fraction; // double ld_bytes_per_cycle, st_bytes_per_cycle; // uint64_t node_punit_counts[MAX_COUNTERS]; // long long node_timebase_sum; // int Ax, Bx, Cx, Dx, Ex; // Personality_t personality; // char filename[132]; // FILE * fp; unsigned int tid, pid, cid; int node_id; tid = PhysicalThreadID(); // between 0 and 3 pid = PhysicalThreadIndex(); // between 0 and 67 cid = pid/4; node_id = EMON_rank_on_card(); L2_Barrier(&id_barrier, numthreads); if ((pid != 0) || (node_id != 0)) return; set_labels(); set_aggregation_mask(); // sets a mask to aggregate by sum (0) or by max (1) if (code_block >= MAX_CODE_BLOCKS) nblocks = MAX_CODE_BLOCKS; else nblocks = code_block; // fp = stderr; // print counts for each thread and the aggregate for every core printf( "\n"); printf( "======================================================================\n"); printf( "Hardware counter report for BGQ - thread and core-specific values.\n"); printf( "======================================================================\n"); for (k=0; k<MAX_CORES; k++) { if (coremask[k]) { printf ("core %d\n", k); for (j=0; j<nblocks; j++) { if (block_starts[j] == block_stops[j]) { printf( "----------------------------------------------------------------\n"); printf( "%s, call count = %d, cycles = %lld :\n", code_block_label[j], block_starts[j], timebase_sum[j]); printf( " -- Processor counters (thread specific) --------------\n"); if (hpm_threads == 1) { for (i=0; i<num_events; i++) { counts = counter_sum[k][j][i]; printf( "%-d %14lld %s\n", hpm_group, counts, label[counter_index[i]]); } } else if (hpm_threads == 2) { printf( " thread0 counts thread2 counts net counts label\n"); for (i=0; i<num_events; i++) { counts_0 = counter_sum[k][j][i]; counts_2 = counter_sum[k][j][i+num_events]; if (mask[counter_index[i]]) { counts = (counts_0 > counts_2) ? counts_0 : counts_2; } else counts = counts_0 + counts_2; printf( "%-d %14lld %14lld %14lld %s\n", hpm_group, counts_0, counts_2, counts, label[counter_index[i]]); } } else if (hpm_threads == 3) { printf( " thread0 counts thread1 counts thread2 counts net counts label\n"); for (i=0; i<num_events; i++) { counts_0 = counter_sum[k][j][i]; counts_2 = counter_sum[k][j][i+num_events]; counts_1 = counter_sum[k][j][i+2*num_events]; if (mask[counter_index[i]]) { counts = (counts_0 > counts_2) ? counts_0 : counts_2; counts = (counts > counts_1) ? counts : counts_1; } else counts = counts_0 + counts_1 + counts_2; printf( "%-d %14lld %14lld %14lld %14lld %s\n", hpm_group, counts_0, counts_1, counts_2, counts, label[counter_index[i]]); } } else if (hpm_threads == 4) { printf( " thread0 counts thread1 counts thread2 counts thread3 counts net counts label\n"); for (i=0; i<num_events; i++) { counts_0 = counter_sum[k][j][i]; counts_2 = counter_sum[k][j][i+num_events]; counts_1 = counter_sum[k][j][i+2*num_events]; counts_3 = counter_sum[k][j][i+3*num_events]; if (mask[counter_index[i]]) { counts = (counts_0 > counts_2) ? counts_0 : counts_2; counts = (counts > counts_1) ? counts : counts_1; counts = (counts > counts_3) ? counts : counts_3; } else counts = counts_0 + counts_1 + counts_2 + counts_3; printf( "%-d %14lld %14lld %14lld %14lld %14lld %s\n", hpm_group, counts_0, counts_1, counts_2, counts_3, counts, label[counter_index[i]]); } } printf( " -- L2 counters (shared for the node) -----------------\n"); printf( "%-d %14lld L2 Hits\n", 100, L2_sum[j][0]); printf( "%-d %14lld L2 Misses\n", 100, L2_sum[j][1]); printf( "%-d %14lld L2 lines prefetched\n", 100, L2_sum[j][2]); printf( "%-d %14lld L2 lines loaded from memory\n", 100, L2_sum[j][3]); printf( "%-d %14lld L2 full lines stored to mem\n", 100, L2_sum[j][4]); printf( "%-d %14lld L2 partial lines stored to mem\n", 100, L2_sum[j][5]); printf( "\n"); } else { printf( "mismatch in starts/stops for code block '%s'\n", code_block_label[j]); printf( " starts = %d\n", block_starts[j]); printf( " stops = %d\n", block_stops[j]); } } printf( "\n"); } } return; }
static INT_PTR CALLBACK options_window_proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { (void)lParam; switch (uMsg) { case WM_INITDIALOG: { SendDlgItemMessage (hDlg, IDC_ENABLE_SMIME, BM_SETCHECK, !!opt.enable_smime, 0L); SendDlgItemMessage (hDlg, IDC_ENCRYPT_DEFAULT, BM_SETCHECK, !!opt.encrypt_default, 0L); SendDlgItemMessage (hDlg, IDC_SIGN_DEFAULT, BM_SETCHECK, !!opt.sign_default, 0L); #ifndef MIME_SEND SendDlgItemMessage (hDlg, IDC_MIME_UI, BM_SETCHECK, !!opt.mime_ui, 0L); #endif enable_disable_opts (hDlg); set_labels (hDlg); ShowWindow (GetDlgItem (hDlg, IDC_GPG_OPTIONS), opt.enable_debug ? SW_SHOW : SW_HIDE); } return 1; case WM_LBUTTONDOWN: { return 1; } case WM_COMMAND: switch (LOWORD (wParam)) { case IDOK: { opt.enable_smime = !!SendDlgItemMessage (hDlg, IDC_ENABLE_SMIME, BM_GETCHECK, 0, 0L); opt.encrypt_default = !!SendDlgItemMessage (hDlg, IDC_ENCRYPT_DEFAULT, BM_GETCHECK, 0, 0L); opt.sign_default = !!SendDlgItemMessage (hDlg, IDC_SIGN_DEFAULT, BM_GETCHECK, 0, 0L); #ifndef MIME_SEND int mime_ui_old = opt.mime_ui; opt.mime_ui = !!SendDlgItemMessage (hDlg, IDC_MIME_UI, BM_GETCHECK, 0, 0L); if (opt.mime_ui != mime_ui_old) { MessageBox (NULL, _("Changing the interface requires a restart of Outlook."), _("GpgOL"), MB_ICONINFORMATION|MB_OK); } #endif write_options (); EndDialog (hDlg, TRUE); break; } case IDC_GPG_CONF: engine_start_confdialog (hDlg); break; case IDC_GPG_OPTIONS: config_dialog_box (hDlg); break; } case WM_SYSCOMMAND: switch (LOWORD (wParam)) { case SC_CLOSE: EndDialog (hDlg, TRUE); } break; } return 0; }
/**@ingroup plp_sink * Prints or displays the signal according to the selected mode. */ int work(void **inp, void **out) { int n,i,j; int mode; float *r_input; _Complex float *c_input; dft_plan_t *plan; strdef(xlabel); if (mode_id != NULL) { if (param_get_int(mode_id,&mode) != 1) { mode = 0; } } else { mode = 0; } memset(signal_lengths,0,sizeof(int)*2*NOF_INPUT_ITF); for (n=0;n<NOF_INPUT_ITF;n++) { if (is_complex && mode != MODE_PSD) { signal_lengths[2*n] = get_input_samples(n)/2; signal_lengths[2*n+1] = signal_lengths[2*n]; } else { signal_lengths[n] = get_input_samples(n); } if (get_input_samples(n) != last_rcv_samples) { last_rcv_samples = get_input_samples(n); #ifdef _COMPILE_ALOE modinfo_msg("Receiving %d samples at tslot %d\n",last_rcv_samples, oesr_tstamp(ctx)); #endif } } #ifdef _COMPILE_ALOE if (print_not_received) { for (n=0;n<NOF_INPUT_ITF;n++) { if (MOD_DEBUG) { ainfo_msg("ts=%d, rcv_len=%d\n",oesr_tstamp(ctx),get_input_samples(n)); } if (!get_input_samples(n)) { printf("ts=%d. Data not received from interface %d\n",oesr_tstamp(ctx),n); } } } #endif #ifdef _COMPILE_ALOE if (oesr_tstamp(ctx)-last_tstamp < interval_ts) { return 0; } last_tstamp = interval_ts; #endif switch(mode) { case MODE_SILENT: break; case MODE_PRINT: for (n=0;n<NOF_INPUT_ITF;n++) { if (inp[n]) { print_signal(inp[n],get_input_samples(n)); } } break; case MODE_SCOPE: #ifdef _COMPILE_ALOE snprintf(xlabel,STR_LEN,"# sample (ts=%d)",oesr_tstamp(ctx)); #else snprintf(xlabel,STR_LEN,"# sample"); #endif if (is_complex) { set_legend(c_legends,2*NOF_INPUT_ITF); } else { set_legend(r_legends,NOF_INPUT_ITF); } set_labels(xlabel,"amp"); for (n=0;n<NOF_INPUT_ITF;n++) { if (inp[n]) { if (is_complex) { c_input = inp[n]; for (i=0;i<signal_lengths[2*n];i++) { pl_signals[2*n*INPUT_MAX_SAMPLES+i] = (double) __real__ c_input[i]; pl_signals[(2*n+1)*INPUT_MAX_SAMPLES+i] = (double) __imag__ c_input[i]; } } else { r_input = inp[n]; for (i=0;i<signal_lengths[n];i++) { pl_signals[n*INPUT_MAX_SAMPLES+i] = (double) r_input[i]; } } } } plp_draw(pl_signals,signal_lengths,0); break; case MODE_PSD: #ifdef _COMPILE_ALOE snprintf(xlabel,STR_LEN,"freq. idx (ts=%d)",oesr_tstamp(ctx)); #else snprintf(xlabel,STR_LEN,"freq. idx"); #endif set_labels(xlabel,"PSD (dB/Hz)"); set_legend(fft_legends,NOF_INPUT_ITF); for (i=0;i<NOF_INPUT_ITF;i++) { if (signal_lengths[i]) { if (fft_size) { signal_lengths[i] = signal_lengths[i]>fft_size?fft_size:signal_lengths[i]; } plan = find_plan(signal_lengths[i]); c_input = inp[i]; r_input = inp[i]; if (!plan) { if ((plan = generate_new_plan(signal_lengths[i])) == NULL) { moderror("Generating plan.\n"); return -1; } } if (is_complex) { dft_run_c2r(plan, c_input, &f_pl_signals[i*INPUT_MAX_SAMPLES]); } else { dft_run_r2r(plan, r_input, &f_pl_signals[i*INPUT_MAX_SAMPLES]); } /*if (!is_complex) { signal_lengths[i] = signal_lengths[i]/2; }*/ for (j=0;j<signal_lengths[i];j++) { pl_signals[i*INPUT_MAX_SAMPLES+j] = (double) f_pl_signals[i*INPUT_MAX_SAMPLES+j]; } } } for (i=NOF_INPUT_ITF;i<2*NOF_INPUT_ITF;i++) { signal_lengths[i] = 0; } plp_draw(pl_signals,signal_lengths,0); break; default: moderror_msg("Unknown mode %d\n",mode); return -1; } return 0; }