Skip to content

Instantly share code, notes, and snippets.

@emchristiansen
emchristiansen / arctape_module.rs
Created July 27, 2023 15:19
ArcTape usage example with Module API
use std::sync::Arc;
use std::sync::Mutex;
use color_eyre::Result;
use dfdx::prelude::BuildOnDevice;
use dfdx::prelude::Linear;
use dfdx::prelude::Module;
use dfdx::prelude::ZeroGrads;
use dfdx::shapes::Rank0;
use dfdx::shapes::Rank2;
@emchristiansen
emchristiansen / arctape.rs
Created July 27, 2023 15:18
ArcTape usage example
use std::sync::Arc;
use std::sync::Mutex;
use color_eyre::Result;
use dfdx::shapes::Rank0;
use dfdx::tensor::AsArray;
use dfdx::tensor::Cpu;
use dfdx::tensor::OwnedTape;
use dfdx::tensor::PutTape;
use dfdx::tensor::SplitTape;
@emchristiansen
emchristiansen / proposed.rs
Created July 26, 2023 21:47
Proposed gradient tape design pattern
use color_eyre::Result;
use dfdx::shapes::Rank0;
use dfdx::tensor::AsArray;
use dfdx::tensor::Cpu;
use dfdx::tensor::NoneTape;
use dfdx::tensor::OwnedTape;
use dfdx::tensor::PutTape;
use dfdx::tensor::SplitTape;
use dfdx::tensor::Tape;
use dfdx::tensor::Tensor;
@emchristiansen
emchristiansen / scratch.rs
Created July 26, 2023 21:24
Demonstration of the difficulty in dealing with gradient tapes
// Demonstration of the difficulty in dealing with gradient tapes for a network
// with multiple inputs and outputs.
use color_eyre::Result;
use dfdx::shapes::Rank0;
use dfdx::tensor::AsArray;
use dfdx::tensor::Cpu;
use dfdx::tensor::PutTape;
use dfdx::tensor::SplitTape;
use dfdx::tensor::Tape;
apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
name: basic
namespace: tidb-cluster
spec:
version: v6.6.0
timezone: UTC
pvReclaimPolicy: Delete
enableDynamicConfiguration: true
[root@basic-pd-0 /]# /root/.tiup/bin/tiup ctl:v6.6.0 pd store
Starting component `ctl`: /root/.tiup/components/ctl/v6.6.0/ctl pd store
{
"count": 3,
"stores": [
{
"store": {
"id": 4,
"address": "basic-tikv-1.basic-tikv-peer.tidb-cluster.svc:20160",
"labels": [
I0323 17:10:05.838447 1 event.go:282] Event(v1.ObjectReference{Kind:"Backup", Namespace:"tidb-cluster", Name:"backup-schedule-2023-03-23t17-10-00", UID:"5b3e45a3-ffb8-45f5-9f6a-749ff7610a56", APIVersion:"pingcap.com/v1alpha1", ResourceVersion:"9642", FieldPath:""}): type: 'Normal' reason: 'SuccessfulDelete' delete Backup tidb-cluster/backup-schedule-2023-03-23t17-10-00 for backupSchedule/backup-schedule successful
E0323 17:10:05.841195 1 backup_status_updater.go:126] Failed to update backup [tidb-cluster/backup-schedule-2023-03-23t17-10-00], error: Operation cannot be fulfilled on backups.pingcap.com "backup-schedule-2023-03-23t17-10-00": StorageError: invalid object, Code: 4, Key: /registry/pingcap.com/backups/tidb-cluster/backup-schedule-2023-03-23t17-10-00, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: 5b3e45a3-ffb8-45f5-9f6a-749ff7610a56, UID in object meta:
E0323 17:10:05.852504 1 backup_status_updater.go:110] error getting updated backup tidb-cluste
apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
name: basic
namespace: tidb-cluster
spec:
version: v6.5.0
timezone: UTC
# pvReclaimPolicy: Retain
pvReclaimPolicy: Delete
I0322 00:17:19.698490 1 backup_schedule_manager.go:389] backup schedule tidb-cluster/backup-schedule gc backup backup-schedule-2023-03-22t00-17-00 success
E0322 00:17:19.698519 1 backup_status_updater.go:126] Failed to update backup [tidb-cluster/backup-schedule-2023-03-22t00-17-00], error: Operation cannot be fulfilled on backups.pingcap.com "backup-schedule-2023-03-22t00-17-00": StorageError: invalid object, Code: 4, Key: /registry/pingcap.com/backups/tidb-cluster/backup-schedule-2023-03-22t00-17-00, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: 14cf9f1c-2481-4708-b06d-b30f8266abd9, UID in object meta:
I0322 00:17:19.698580 1 event.go:282] Event(v1.ObjectReference{Kind:"Backup", Namespace:"tidb-cluster", Name:"backup-schedule-2023-03-22t00-17-00", UID:"14cf9f1c-2481-4708-b06d-b30f8266abd9", APIVersion:"pingcap.com/v1alpha1", ResourceVersion:"12068", FieldPath:""}): type: 'Normal' reason: 'SuccessfulDelete' delete Backup tidb-cluster/backup-schedule-2023
# See:
# https://docs.pingcap.com/tidb-in-kubernetes/stable/backup-to-s3
# https://github.com/pingcap/docs-tidb-operator/blob/master/en/backup-restore-cr.md#backupschedule-cr-fields
apiVersion: pingcap.com/v1alpha1
kind: BackupSchedule
metadata:
name: backup-schedule
namespace: tidb-cluster
spec:
schedule: "* * * * *"