int main(int argc, char** argv) { madness::World& world = madness::initialize(argc,argv); std::size_t m = 20; std::size_t n = 10; std::size_t M = 200; std::size_t N = 100; std::shared_ptr<TiledArray::Pmap> blocked_pmap(new TiledArray::detail::BlockedPmap(world, m * n)); std::vector<ProcessID> blocked_map = make_map(m, n, blocked_pmap); std::shared_ptr<TiledArray::Pmap> cyclic_pmap(new TiledArray::detail::CyclicPmap(world, m, n, M, N)); std::vector<ProcessID> cyclic_map = make_map(m, n, cyclic_pmap); std::shared_ptr<TiledArray::Pmap> hash_pmap(new TiledArray::detail::HashPmap(world, m * n)); std::vector<ProcessID> hash_map = make_map(m, n, hash_pmap); if(world.rank() == 0) { std::cout << "Block\n"; print_map(m, n, blocked_map); std::cout << "\n"; } print_local(world, blocked_pmap); world.gop.fence(); if(world.rank() == 0) { std::cout << "\n\nCyclic\n"; print_map(m, n, cyclic_map); std::cout << "\n"; } print_local(world, cyclic_pmap); world.gop.fence(); if(world.rank() == 0) { std::cout << "\n\nHash\n"; print_map(m, n, hash_map); std::cout << "\n"; } print_local(world, hash_pmap); madness::finalize(); return 0; }
static gint compare (GnomePilotConduitSyncAbs *conduit, EAddrLocalRecord *local, GnomePilotRecord *remote, EAddrConduitContext *ctxt) { GnomePilotRecord local_pilot; int retval = 0; LOG (g_message ("compare: local=%s remote=%s...\n", print_local (local), print_remote (remote))); g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); local_pilot = local_record_to_pilot_record (local, ctxt); if (remote->length != local_pilot.length || memcmp (local_pilot.record, remote->record, remote->length)) retval = 1; if (retval == 0) LOG (g_message ( " equal" )); else LOG (g_message ( " not equal" )); return retval; }
static gint replace_record (GnomePilotConduitSyncAbs *conduit, EAddrLocalRecord *local, GnomePilotRecord *remote, EAddrConduitContext *ctxt) { EContact *new_contact; EBookChange *ebc; char *old_id; int retval = 0; g_return_val_if_fail (remote != NULL, -1); LOG (g_message ("replace_record: replace %s with %s\n", print_local (local), print_remote (remote))); old_id = e_contact_get (local->contact, E_CONTACT_UID); ebc = g_hash_table_lookup (ctxt->changed_hash, old_id); new_contact = ecard_from_remote_record (ctxt, remote, local->contact); g_object_unref (local->contact); local->contact = new_contact; if (ebc && ebc->change_type == E_BOOK_CHANGE_CARD_DELETED) { if (!e_book_add_contact (ctxt->ebook, local->contact, NULL)) { WARN (G_STRLOC ": failed to add card\n"); return -1; } } else { if (!e_book_commit_contact (ctxt->ebook, local->contact, NULL)) { WARN (G_STRLOC ": failed to commit card\n"); return -1; } } /* Adding a record causes wombat to assign a new uid so we must tidy */ if (ebc && ebc->change_type == E_BOOK_CHANGE_CARD_DELETED) { const char *uid = e_contact_get_const (local->contact, E_CONTACT_UID); gboolean arch; arch = e_pilot_map_uid_is_archived (ctxt->map, uid); e_pilot_map_insert (ctxt->map, remote->ID, uid, arch); ebc = g_hash_table_lookup (ctxt->changed_hash, old_id); if (ebc) { g_hash_table_remove (ctxt->changed_hash, old_id); g_object_unref (ebc->contact); g_object_ref (local->contact); ebc->contact = local->contact; /* FIXME We should possibly be duplicating the uid */ g_hash_table_insert (ctxt->changed_hash, (gpointer) uid, ebc); } } return retval; }
void InstructionPrinter::do_StoreLocal(StoreLocal* x) { print_local(x); tty->print(" := "); print_value(x->value()); if (x->is_eliminated()) { tty->print(" (eliminated)"); } }
static gint prepare (GnomePilotConduitSyncAbs *conduit, EAddrLocalRecord *local, GnomePilotRecord *remote, EAddrConduitContext *ctxt) { LOG (g_message ( "prepare: encoding local %s\n", print_local (local) )); *remote = local_record_to_pilot_record (local, ctxt); return 0; }
static gint delete_record (GnomePilotConduitSyncAbs *conduit, EAddrLocalRecord *local, EAddrConduitContext *ctxt) { GError *error = NULL; int retval = 0; g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (local->contact != NULL, -1); LOG (g_message ( "delete_record: delete %s\n", print_local (local) )); e_pilot_map_remove_by_uid (ctxt->map, e_contact_get_const (local->contact, E_CONTACT_UID)); if (!e_book_remove_contact (ctxt->ebook, e_contact_get_const (local->contact, E_CONTACT_UID), &error) && error->code != E_BOOK_ERROR_CONTACT_NOT_FOUND) { WARN ("delete_record: failed to delete card in ebook\n"); g_error_free (error); retval = -1; } return retval; }
static gint replace_record (GnomePilotConduitSyncAbs *conduit, EMemoLocalRecord *local, GnomePilotRecord *remote, EMemoConduitContext *ctxt) { ECalComponent *new_comp; int retval = 0; g_return_val_if_fail (remote != NULL, -1); LOG (g_message ("replace_record: replace %s with %s\n", print_local (local), print_remote (remote))); new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->timezone, &(ctxt->ai)); g_object_unref (local->comp); local->comp = new_comp; if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), CALOBJ_MOD_ALL, NULL)) return -1; return retval; }
void InstructionPrinter::do_LoadLocal(LoadLocal* x) { print_local(x); }