download=True) mpi.barrier(comm) trainloader, testloader = dataloader.load_dataset( args.dataset, args.datapath, args.batch_size, args.threads, args.raw_data, args.data_split, args.split_idx, args.trainloader, args.testloader) #-------------------------------------------------------------------------- # Start the computation #-------------------------------------------------------------------------- crunch(surf_file, net, w, s, d, trainloader, 'train_loss', 'train_acc', comm, rank, args) # crunch(surf_file, net, w, s, d, testloader, 'test_loss', 'test_acc', comm, rank, args) #-------------------------------------------------------------------------- # Plot figures #-------------------------------------------------------------------------- if args.plot and rank == 0: if args.y and args.proj_file: plot_2D.plot_contour_trajectory(surf_file, dir_file, args.proj_file, 'train_loss', args.show) elif args.y: plot_2D.plot_2d_contour(surf_file, 'train_loss', args.vmin, args.vmax, args.vlevel, args.show) else: plot_1D.plot_1d_loss_err(surf_file, args.xmin, args.xmax, args.loss_max, args.log, args.show)
#-------------------------------------------------------------------------- # Setup dataloader #-------------------------------------------------------------------------- # download CIFAR10 if it does not exit if rank == 0 and args.dataset == 'cifar10': torchvision.datasets.CIFAR10(root=args.dataset + '/data', train=True, download=True) mpi4pytorch.barrier(comm) trainloader, testloader = dataloader.load_dataset(args.dataset, args.datapath, args.batch_size, args.threads, args.raw_data, args.data_split, args.split_idx, args.trainloader, args.testloader) #-------------------------------------------------------------------------- # Start the computation #-------------------------------------------------------------------------- crunch(surf_file, net, w, s, d, trainloader, 'train_loss', 'train_acc', comm, rank, args) # crunch(surf_file, net, w, s, d, testloader, 'test_loss', 'test_acc', comm, rank, args) #-------------------------------------------------------------------------- # Plot figures #-------------------------------------------------------------------------- if args.plot and rank == 0: if args.y and args.proj_file: plot_2D.plot_contour_trajectory(surf_file, dir_file, args.proj_file, 'train_loss', args.show) elif args.y: plot_2D.plot_2d_contour(surf_file, 'train_loss', args.vmin, args.vmax, args.vlevel, args.show) else: plot_1D.plot_1d_loss_err(surf_file, args.xmin, args.xmax, args.loss_max, args.log, args.show)