Skip to content

Commit

Permalink
Add a copy protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Nov 21, 2023
1 parent 438c188 commit e96da58
Show file tree
Hide file tree
Showing 4 changed files with 713 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import uk.ac.manchester.spinnaker.front_end.download.request.Placement;
import uk.ac.manchester.spinnaker.front_end.dse.FastExecuteDataSpecification;
import uk.ac.manchester.spinnaker.front_end.dse.HostExecuteDataSpecification;
import uk.ac.manchester.spinnaker.front_end.dse.FastCopyExecuteDataSpecification;
import uk.ac.manchester.spinnaker.front_end.iobuf.IobufRequest;
import uk.ac.manchester.spinnaker.front_end.iobuf.IobufRetriever;
import uk.ac.manchester.spinnaker.machine.Machine;
Expand Down Expand Up @@ -209,6 +210,22 @@ FastExecuteDataSpecification create(TransceiverInterface txrx,
*/
static FastDSEFactory fastFactory = FastExecuteDataSpecification::new;

@FunctionalInterface
interface FastCopyDSEFactory {
FastCopyExecuteDataSpecification create(TransceiverInterface txrx,
Machine machine, List<Gather> gatherers, File reportDir,
DSEDatabaseEngine db)
throws IOException, SpinnmanException, StorageException,
ExecutionException, InterruptedException, URISyntaxException;
}

/**
* Makes {@link FastCopyExecuteDataSpecification} instances. Allows for
* injection of debugging tooling.
*/
static FastCopyDSEFactory fastCopyFactory =
FastCopyExecuteDataSpecification::new;

/**
* Run the data specifications in parallel.
*
Expand Down Expand Up @@ -304,6 +321,54 @@ public void runDSEForAppCoresUploadingViaMonitorStreaming(
}
}

/**
* Run the data specifications in parallel using the copy method.
*
* @param gatherers
* List of descriptions of gatherers.
* @param machine
* Description of overall machine.
* @param dsFile
* Path to the dataspec database
* @param runFolder
* Directory containing per-run information.
* @param reportFolder
* Directory containing reports. If {@link Optional#empty()}, no
* report will be written.
* @throws IOException
* If the communications fail.
* @throws SpinnmanException
* If a BMP is uncontactable or SpiNNaker rejects a message.
* @throws StorageException
* If the database is in an illegal state.
* @throws ExecutionException
* If there was a problem in the parallel queue.
* @throws InterruptedException
* If the wait for everything to complete is interrupted.
* @throws URISyntaxException
* If a proxy URI is provided but invalid.
*/
@Command(name = "dse_copy_app_mon", description = DSE_MON_DESC)
public void runDSEForAppCoresUploadingViaCopyMonitorStreaming(
@Mixin GatherersParam gatherers,
@Mixin MachineParam machine,
@Mixin DsFileParam dsFile,
@Mixin RunFolderParam runFolder,
@Parameters(description = REPORT, arity = "0..1", index = "3")
Optional<File> reportFolder)
throws IOException, SpinnmanException, StorageException,
ExecutionException, InterruptedException, URISyntaxException {
setLoggerDir(runFolder.get());
var db = getDataSpecDB(dsFile.get());
var job = getJob(db);

try (var txrx = getTransceiver(machine.get(), job);
var dseExec = fastCopyFactory.create(txrx, machine.get(),
gatherers.get(), reportFolder.orElse(null), db)) {
dseExec.loadCores();
}
}

/**
* Retrieve IOBUFs in parallel.
*
Expand Down
Loading

0 comments on commit e96da58

Please sign in to comment.