WiiFilesystemNode::WiiFilesystemNode(const Common::String &p, const struct stat *st) { if (p.empty()) { initRootNode(); return; } _path = Common::normalizePath(p, '/'); // "sd:" is not a valid directory, but "sd:/" is if (_path.lastChar() == ':') _path += '/'; _displayName = lastPathComponent(_path, '/'); setFlags(st); }
WiiFilesystemNode::WiiFilesystemNode(const Common::String &p) { if (p.empty()) { initRootNode(); return; } _path = Common::normalizePath(p, '/'); WiiFilesystemFactory::instance().mountByPath(_path); // "sd:" is not a valid directory, but "sd:/" is if (_path.lastChar() == ':') _path += '/'; _displayName = lastPathComponent(_path, '/'); struct stat st; if(stat(_path.c_str(), &st) != -1) setFlags(&st); else clearFlags(); }
WiiFilesystemNode::WiiFilesystemNode() { initRootNode(); }
/* Main() function for: Sequential, OpenMP, UPC, and Shmem * * Notes on execution model: * - under openMP, global vars are all shared * - under UPC, global vars are private unless explicitly shared * - UPC is SPMD starting with main, OpenMP goes SPMD after * parsing parameters */ int main(int argc, char *argv[]) { #ifdef THREAD_METADATA memset(t_metadata, 0x00, MAX_OMP_THREADS * sizeof(thread_metadata)); #endif memset(thread_info, 0x00, MAX_OMP_THREADS * sizeof(per_thread_info)); memset(steal_buffer_locks, 0x00, MAX_SHMEM_THREADS * sizeof(long)); hclib::launch([argc, argv] { pe = hclib::pe_for_locale(hclib::shmem_my_pe()); npes = hclib::shmem_n_pes(); /* determine benchmark parameters (all PEs) */ uts_parseParams(argc, argv); #ifdef UTS_STAT if (stats) { initHist(); } #endif double t1, t2, et; /* show parameter settings */ if (pe == 0) { uts_printParams(); } Node root; initRootNode(&root, type); hclib::shmem_barrier_all(); /* time parallel search */ t1 = uts_wctime(); int n_omp_threads; /********** SPMD Parallel Region **********/ int first = 1; n_omp_threads = hclib::num_workers(); assert(n_omp_threads <= MAX_OMP_THREADS); Node child; retry: initNode(&child); hclib::finish([&first, &root, &child] { if (first) { if (pe == 0) { genChildren(&root, &child); } } else { genChildren(&root, &child); } }); first = 0; if (n_buffered_steals > 0) { hclib::shmem_set_lock(&steal_buffer_locks[pe]); if (n_buffered_steals > 0) { n_buffered_steals--; memcpy(&root, &steal_buffer[n_buffered_steals], sizeof(root)); hclib::shmem_clear_lock(&steal_buffer_locks[pe]); goto retry; } else { hclib::shmem_clear_lock(&steal_buffer_locks[pe]); } } const int got_more_work = remote_steal(&root); if (got_more_work == 1) { goto retry; } hclib::shmem_barrier_all(); t2 = uts_wctime(); et = t2 - t1; int i; for (i = 0; i < MAX_OMP_THREADS; i++) { n_nodes += thread_info[i].n_nodes; n_leaves += thread_info[i].n_leaves; } hclib::shmem_barrier_all(); if (pe != 0) { hclib::shmem_int_add(&n_nodes, n_nodes, 0); hclib::shmem_int_add(&n_leaves, n_leaves, 0); } hclib::shmem_barrier_all(); if (pe == 0) { showStats(et); } /********** End Parallel Region **********/ #ifdef THREAD_METADATA int p; for (p = 0; p < npes; p++) { if (p == pe) { printf("\n"); int i; for (i = 0; i < n_omp_threads; i++) { printf("PE %d, thread %d: %lu tasks\n", p, i, t_metadata[i].ntasks); } } hclib::shmem_barrier_all(); } #endif }); return 0; }