{
dayjs(Number(value.time.start * 1000n)),
'minutes',
)}{' '}
- min × {value.definition.ntasks.toString()} tasks ×
+ min × [ {value.definition.ntasks.toString()} tasks ×
- ( {value.definition.gpusPerTask.toString()} GPU/task ×{' '}
- {formatCredit(value.provider.providerPrices.gpuPricePerMin)} credits/(GPU.min)
-
-
- + {value.definition.cpusPerTask.toString()} CPU/task ×{' '}
+ ( {value.definition.cpusPerTask.toString()} CPU/task ×{' '}
{formatCredit(value.provider.providerPrices.cpuPricePerMin)} credits/(CPU.min)
@@ -381,6 +377,10 @@ const StatusPage: NextPage = withConnectionRequired(() => {
})}{' '}
credits/(GB.min) )
+
+ + {value.definition.gpus.toString()} GPU × {formatCredit(value.provider.providerPrices.gpuPricePerMin)}{' '}
+ credits/(GPU.min) ]
+
)}
diff --git a/src/app/texttoimage/page.tsx b/src/app/texttoimage/page.tsx
index 65c0a293..e7ba827a 100644
--- a/src/app/texttoimage/page.tsx
+++ b/src/app/texttoimage/page.tsx
@@ -72,8 +72,8 @@ const TextToImagePage: NextPage = () => {
jobName: `${WorkloadType.TEXTTOIMAGE} - ${generate({ exactly: 3, maxLength: 4 })?.join(' ') ?? ''}`,
details: {
nTasks: 4,
- gpuPerTask: 1,
- cpuPerTask: 8,
+ gpusPerTask: 1,
+ cpusPerTask: 8,
memPerCpu: 8000,
ttiModel: TextToImageModel['sd-2-1'],
steps: '150',
@@ -119,8 +119,8 @@ const TextToImagePage: NextPage = () => {
Generate
diff --git a/src/app/unity/page.tsx b/src/app/unity/page.tsx
index b379292d..4b49836f 100644
--- a/src/app/unity/page.tsx
+++ b/src/app/unity/page.tsx
@@ -58,8 +58,8 @@ const schema = (maxAmount: bigint, minAmount: bigint, ignoreBalance: boolean) =>
archiveLink: y.string().required(),
binaryPath: y.string().required(),
additionalArgs: y.string().notRequired(),
- gpuPerTask: y.number().integer().min(0).max(2),
- cpuPerTask: y.number().integer().min(0).max(16),
+ gpusPerTask: y.number().integer().min(0).max(2),
+ cpusPerTask: y.number().integer().min(0).max(16),
memPerCpu: y
.number()
.integer()
@@ -82,8 +82,8 @@ const UnityPage: NextPage = () => {
jobName: `${WorkloadType.URS} - ${generate({ exactly: 3, maxLength: 4 })?.join(' ') ?? ''}`,
details: {
nTasks: 1,
- gpuPerTask: 1,
- cpuPerTask: 4,
+ gpusPerTask: 1,
+ cpusPerTask: 4,
memPerCpu: 4096,
binaryPath: '',
archiveLink: '',
@@ -133,11 +133,11 @@ const UnityPage: NextPage = () => {
GPU(s)
-
+
CPU(s)
-
+
Memory (MB) per CPU
@@ -146,9 +146,9 @@ const UnityPage: NextPage = () => {
Render
diff --git a/src/app/upscaling/page.tsx b/src/app/upscaling/page.tsx
index 2ef74ef3..932bd2b1 100644
--- a/src/app/upscaling/page.tsx
+++ b/src/app/upscaling/page.tsx
@@ -75,8 +75,8 @@ const NewPage: NextPage = () => {
labels: [],
details: {
nTasks: 1,
- gpuPerTask: 1,
- cpuPerTask: 8,
+ gpusPerTask: 1,
+ cpusPerTask: 8,
memPerCpu: 8000,
isVideo: false,
isAnime: false,
diff --git a/src/components/ui/containers/HardwareRecap/HardwareRecap.tsx b/src/components/ui/containers/HardwareRecap/HardwareRecap.tsx
index 05560fb7..55b83e42 100644
--- a/src/components/ui/containers/HardwareRecap/HardwareRecap.tsx
+++ b/src/components/ui/containers/HardwareRecap/HardwareRecap.tsx
@@ -38,7 +38,28 @@ const HardwareRecap: FC = ({ defaultDuration, gpuQty = 0, cp
});
}, [defaultDuration]);
- const { data: provider } = useGetProviderPrices('0x75761B17c3088ce5Cd8e02575c6DAa438FFA6e12');
+ const { data, error } = useGetProviderPrices('0x75761B17c3088ce5Cd8e02575c6DAa438FFA6e12');
+
+ // TODO: HACK: Return fake data on error
+ const provider = useMemo(() => {
+ if (error || !data) {
+ return {
+ cpuPricePerMin: 950000000000000000n,
+ gpuPricePerMin: 8500000000000000000n,
+ memPricePerMin: 80000000000000n,
+ };
+ }
+
+ // Return fake also if everything is zero
+ if (!data.cpuPricePerMin && !data.gpuPricePerMin && !data.memPricePerMin) {
+ return {
+ cpuPricePerMin: 950000000000000000n,
+ gpuPricePerMin: 8500000000000000000n,
+ memPricePerMin: 80000000000000n,
+ };
+ }
+ return data;
+ }, [data, error]);
const { setValue, formState } = useFormContext();
@@ -60,8 +81,6 @@ const HardwareRecap: FC = ({ defaultDuration, gpuQty = 0, cp
setOpen(!!formState.errors.credit);
}, [formState.errors]);
- if (!provider) return null;
-
const rows = [
...(gpuQty !== 0
? [
diff --git a/src/graphql/external/sbatchServiceClient/generated/Types.ts b/src/graphql/external/sbatchServiceClient/generated/Types.ts
index cf12094c..ad9e66a1 100644
--- a/src/graphql/external/sbatchServiceClient/generated/Types.ts
+++ b/src/graphql/external/sbatchServiceClient/generated/Types.ts
@@ -267,17 +267,19 @@ export type JobResources = {
*
* Can be greater or equal to 1.
*
- * Go name: "CpusPerTask".
+ * Go name: "CPUsPerTask".
*/
cpusPerTask: Scalars['Int']['input'];
/**
- * Allocated GPUs per task.
+ * Allocated GPUs for the whole job.
+ *
+ * Tasks can consume the GPUs by setting `GPUsPerTask` at step level.
*
* Can be greater or equal to 0.
*
- * Go name: "GpusPerTask".
+ * Go name: "GPUs".
*/
- gpusPerTask: Scalars['Int']['input'];
+ gpus: Scalars['Int']['input'];
/**
* Allocated memory (MB) per task.
*
@@ -873,7 +875,7 @@ export type StepRunResources = {
*
* If null, defaults to the job resources.
*
- * Go name: "CpusPerTask".
+ * Go name: "CPUsPerTask".
*/
cpusPerTask?: InputMaybe;
/**
@@ -881,9 +883,9 @@ export type StepRunResources = {
*
* Can be greater or equal to 0.
*
- * If null, defaults to the job resources.
+ * If null, defaults to 0.
*
- * Go name: "GpusPerTask".
+ * Go name: "GPUsPerTask".
*/
gpusPerTask?: InputMaybe;
/**
diff --git a/src/graphql/external/sbatchServiceClient/generated/introspection.json b/src/graphql/external/sbatchServiceClient/generated/introspection.json
index 39309065..03963225 100644
--- a/src/graphql/external/sbatchServiceClient/generated/introspection.json
+++ b/src/graphql/external/sbatchServiceClient/generated/introspection.json
@@ -386,15 +386,15 @@
"inputFields": [
{
"name": "cpusPerTask",
- "description": "Allocated CPUs per task.\n\nCan be greater or equal to 1.\n\nGo name: \"CpusPerTask\".",
+ "description": "Allocated CPUs per task.\n\nCan be greater or equal to 1.\n\nGo name: \"CPUsPerTask\".",
"type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } },
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
- "name": "gpusPerTask",
- "description": "Allocated GPUs per task.\n\nCan be greater or equal to 0.\n\nGo name: \"GpusPerTask\".",
+ "name": "gpus",
+ "description": "Allocated GPUs for the whole job.\n\nTasks can consume the GPUs by setting `GPUsPerTask` at step level.\n\nCan be greater or equal to 0.\n\nGo name: \"GPUs\".",
"type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } },
"defaultValue": null,
"isDeprecated": false,
@@ -1248,7 +1248,7 @@
"inputFields": [
{
"name": "cpusPerTask",
- "description": "Allocated CPUs per task.\n\nCan be greater or equal to 1.\n\nIf null, defaults to the job resources.\n\nGo name: \"CpusPerTask\".",
+ "description": "Allocated CPUs per task.\n\nCan be greater or equal to 1.\n\nIf null, defaults to the job resources.\n\nGo name: \"CPUsPerTask\".",
"type": { "kind": "SCALAR", "name": "Int", "ofType": null },
"defaultValue": null,
"isDeprecated": false,
@@ -1256,7 +1256,7 @@
},
{
"name": "gpusPerTask",
- "description": "Allocated GPUs per task.\n\nCan be greater or equal to 0.\n\nIf null, defaults to the job resources.\n\nGo name: \"GpusPerTask\".",
+ "description": "Allocated GPUs per task.\n\nCan be greater or equal to 0.\n\nIf null, defaults to 0.\n\nGo name: \"GPUsPerTask\".",
"type": { "kind": "SCALAR", "name": "Int", "ofType": null },
"defaultValue": null,
"isDeprecated": false,
diff --git a/src/graphql/external/statsClient/generated/Types.ts b/src/graphql/external/statsClient/generated/Types.ts
index 47010e98..8fd17202 100644
--- a/src/graphql/external/statsClient/generated/Types.ts
+++ b/src/graphql/external/statsClient/generated/Types.ts
@@ -52,8 +52,8 @@ export type JobCost = {
};
export type JobDefinition = {
- cpuPerTask: Scalars['Int']['output'];
- gpuPerTask: Scalars['Int']['output'];
+ cpusPerTask: Scalars['Int']['output'];
+ gpus: Scalars['Int']['output'];
memPerCpu: Scalars['Int']['output'];
ntasks: Scalars['Int']['output'];
};
diff --git a/src/graphql/external/statsClient/generated/introspection.json b/src/graphql/external/statsClient/generated/introspection.json
index 7d56b52f..5cd12f03 100644
--- a/src/graphql/external/statsClient/generated/introspection.json
+++ b/src/graphql/external/statsClient/generated/introspection.json
@@ -315,7 +315,7 @@
"description": null,
"fields": [
{
- "name": "cpuPerTask",
+ "name": "cpusPerTask",
"description": null,
"args": [],
"type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } },
@@ -323,7 +323,7 @@
"deprecationReason": null
},
{
- "name": "gpuPerTask",
+ "name": "gpus",
"description": null,
"args": [],
"type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } },
diff --git a/src/graphql/internal/client/generated/FullJobSummaryFragment.generated.ts b/src/graphql/internal/client/generated/FullJobSummaryFragment.generated.ts
index 2fba07cd..e906a126 100644
--- a/src/graphql/internal/client/generated/FullJobSummaryFragment.generated.ts
+++ b/src/graphql/internal/client/generated/FullJobSummaryFragment.generated.ts
@@ -1,5 +1,4 @@
import { gql } from '@apollo/client';
-import type * as Types from './Types';
export type FullJobSummaryFragmentFragment = {
customerAddr: any;
@@ -12,8 +11,8 @@ export type FullJobSummaryFragmentFragment = {
cost: { delegateSpendingAuthority: boolean; finalCost: string; maxCost: string; pendingTopUp: string };
definition: {
batchLocationHash: string;
- cpuPerTask: string;
- gpuPerTask: string;
+ cpusPerTask: string;
+ gpusPerTask: string;
memPerCpu: string;
ntasks: string;
storageType: number;
@@ -42,8 +41,8 @@ export const FullJobSummaryFragmentFragmentDoc = /*#__PURE__*/ gql`
customerAddr
definition {
batchLocationHash
- cpuPerTask
- gpuPerTask
+ cpusPerTask
+ gpusPerTask
memPerCpu
ntasks
storageType
diff --git a/src/graphql/internal/client/generated/Types.ts b/src/graphql/internal/client/generated/Types.ts
index 2fc7db9a..0a03e014 100644
--- a/src/graphql/internal/client/generated/Types.ts
+++ b/src/graphql/internal/client/generated/Types.ts
@@ -67,7 +67,7 @@ export type JobInput = {
export type JobResourcesInput = {
cpusPerTask: Scalars['Int']['input'];
- gpusPerTask: Scalars['Int']['input'];
+ gpus: Scalars['Int']['input'];
memPerCpu: Scalars['Int']['input'];
tasks: Scalars['Int']['input'];
};
diff --git a/src/graphql/internal/client/generated/introspection.json b/src/graphql/internal/client/generated/introspection.json
index 57a44b3b..11b09ee3 100644
--- a/src/graphql/internal/client/generated/introspection.json
+++ b/src/graphql/internal/client/generated/introspection.json
@@ -430,7 +430,7 @@
"deprecationReason": null
},
{
- "name": "gpusPerTask",
+ "name": "gpus",
"description": null,
"type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } },
"defaultValue": null,
diff --git a/src/graphql/internal/types/objects/Job.ts b/src/graphql/internal/types/objects/Job.ts
index 8ddc4d0c..52e1ef35 100644
--- a/src/graphql/internal/types/objects/Job.ts
+++ b/src/graphql/internal/types/objects/Job.ts
@@ -85,7 +85,7 @@ export class JobResources implements JobResourcesGQL {
cpusPerTask!: number;
@Field(() => Int)
- gpusPerTask!: number;
+ gpus!: number;
@Field(() => Int)
memPerCpu!: number;
diff --git a/src/graphql/internal/types/objects/JobSummary.ts b/src/graphql/internal/types/objects/JobSummary.ts
index 4a88bcef..e586aaae 100644
--- a/src/graphql/internal/types/objects/JobSummary.ts
+++ b/src/graphql/internal/types/objects/JobSummary.ts
@@ -31,7 +31,7 @@ export class Affinity {
@ObjectType()
export class JobDefinition {
@Field(() => BigIntScalar)
- gpusPerTask!: bigint;
+ gpus!: bigint;
@Field(() => BigIntScalar)
memPerCpu!: bigint;
diff --git a/src/hooks/useHandleJob.ts b/src/hooks/useHandleJob.ts
index e20ac24f..6b49a3e5 100644
--- a/src/hooks/useHandleJob.ts
+++ b/src/hooks/useHandleJob.ts
@@ -74,7 +74,7 @@ export default function useHandleJob(
requestNewJob({
args: [
{
- gpusPerTask: BigInt(job.resources.gpusPerTask),
+ gpus: BigInt(job.resources.gpus),
cpusPerTask: BigInt(job.resources.cpusPerTask),
ntasks: BigInt(job.resources.tasks),
memPerCpu: BigInt(job.resources.memPerCpu),
@@ -132,6 +132,7 @@ export default function useHandleJob(
debouncedAmount,
debouncedName,
requestJob,
+ labels,
],
);
return {
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 88c28cd9..f5624524 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -19,8 +19,8 @@ resources:
cpusPerTask: 1
## Memory (MB) per cpu physical thread.
memPerCpu: 200
- ## GPU (graphical process unit) per process.
- gpusPerTask: 0
+ ## GPU (graphical process unit) for the whole job.
+ gpus: 0
## The job content
steps:
diff --git a/src/lib/types/DetailsData.ts b/src/lib/types/DetailsData.ts
index 8fa07551..8093baac 100644
--- a/src/lib/types/DetailsData.ts
+++ b/src/lib/types/DetailsData.ts
@@ -38,9 +38,9 @@ export default class DetailsData {
command?: string;
- gpuPerTask?: number;
+ gpusPerTask?: number;
- cpuPerTask?: number;
+ cpusPerTask?: number;
memPerCpu?: number;
diff --git a/src/lib/web3/constants/contracts.ts b/src/lib/web3/constants/contracts.ts
index b0692316..ecfc7c22 100644
--- a/src/lib/web3/constants/contracts.ts
+++ b/src/lib/web3/constants/contracts.ts
@@ -8,14 +8,14 @@ import ChainId from '@lib/web3/lib/ChainId';
const mainnet: { [contractName: string]: Address } = {
Credit: '0x43f185708de9e18D514F317Ca5587F96847A3dbe',
- FaucetCredit: '0x040811a6A4d8160a920e3FCDc5368fF3e6D1bc69',
- FaucetNative: '0x712b942336942441E711A454EEb4950E5063Ef33',
- MetaScheduler: '0x7524fBB0c1e099A4A472C5A7b0B1E1E3aBd3fE97',
- ProviderManager: '0x64D5a36De73f9789009060FE44d71D9C0903F1EF',
- Tools: '0x5FbD484a91ea7399d08C8aCb19AB17976AE6DA04',
- Constants: '0xf0945FB84D0D882d087a53d2B0B544E281F3D9A7',
- ProviderJobQueues: '0xFf62C3141e21A97152e7662B4e469F6681F9368a',
- JobRepository: '0x3860F9Ca87dF098067D10d3C4A6043fd50c5F1dd',
+ FaucetCredit: '0x5fB6FFc12BAc330e9683B8908015850A5FB554DB',
+ FaucetNative: '0xB12F570F7B81884a5Aa2D74aCEf3cA238b78A69c',
+ MetaScheduler: '0x68A606C58fA06fF6872c80d71A71Ab7506eCa44B',
+ ProviderManager: '0xb31c40ea5766Cd20D322D7BB7E0a5bF5534aA558',
+ Tools: '0x226D47E310C1f2F9028a252e56C8183e661df591',
+ Constants: '0xb1E887f7208cD88AC304A461DA92F8e4fa2dfB67',
+ ProviderJobQueues: '0xBEe29A9C99A15bB5814c3348d245880B08075B3C',
+ JobRepository: '0xFBBf852fC433fCBa1a71B92bFA26Aa8A6027C0fc',
};
type addressBook = typeof mainnet;
diff --git a/src/utils/job/computeCostPerMin.ts b/src/utils/job/computeCostPerMin.ts
index a19f3d97..66a6dfcf 100644
--- a/src/utils/job/computeCostPerMin.ts
+++ b/src/utils/job/computeCostPerMin.ts
@@ -19,9 +19,9 @@ import type { FullJobSummary } from '@graphql/internal/queries/ListJobsQuery';
export function computeCostPerMin(summary: FullJobSummary): bigint {
if (!summary.provider) return 0n;
const tasks = summary.definition.ntasks;
- const gpuCost = summary.definition.gpusPerTask * summary.provider.providerPrices.gpuPricePerMin;
+ const gpuCost = summary.definition.gpus * summary.provider.providerPrices.gpuPricePerMin;
const cpuCost = summary.definition.cpusPerTask * summary.provider.providerPrices.cpuPricePerMin;
const memCost =
summary.definition.memPerCpu * summary.definition.cpusPerTask * summary.provider.providerPrices.memPricePerMin;
- return tasks * (gpuCost + cpuCost + memCost);
+ return tasks * (cpuCost + memCost) + gpuCost;
}
diff --git a/src/utils/resolveJobForm.ts b/src/utils/resolveJobForm.ts
index f50f8d2e..3a125dd0 100644
--- a/src/utils/resolveJobForm.ts
+++ b/src/utils/resolveJobForm.ts
@@ -47,9 +47,9 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
// env: [{ key: 'DISPLAY', value: ':99' }],
resources: {
tasks: details.nTasks!,
- cpusPerTask: details.cpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
memPerCpu: details.memPerCpu!,
- gpusPerTask: 1,
+ gpus: details.nTasks!, // 1 * ntasks
},
input: details.inputData
? {
@@ -91,7 +91,7 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
run: {
resources: {
tasks: 1,
- cpusPerTask: details.cpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
memPerCpu: details.memPerCpu!,
gpusPerTask: 0,
},
@@ -130,7 +130,7 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
run: {
resources: {
tasks: 1,
- cpusPerTask: details.cpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
memPerCpu: details.memPerCpu!,
gpusPerTask: 0,
},
@@ -158,7 +158,7 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
run: {
resources: {
tasks: 1,
- cpusPerTask: details.cpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
memPerCpu: details.memPerCpu!,
gpusPerTask: 1,
},
@@ -201,9 +201,9 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
],
resources: {
tasks: 1,
- cpusPerTask: details.cpuPerTask!,
- memPerCpu: Math.round(details.memPerCpu! / details.cpuPerTask!),
- gpusPerTask: details.gpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
+ memPerCpu: Math.round(details.memPerCpu! / details.cpusPerTask!),
+ gpus: details.gpusPerTask!,
},
input: {
http: {
@@ -241,9 +241,9 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
env: details.envVars,
resources: {
tasks: 1,
- cpusPerTask: details.cpuPerTask!,
- memPerCpu: Math.round(details.memPerCpu! / details.cpuPerTask!),
- gpusPerTask: details.gpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
+ memPerCpu: Math.round(details.memPerCpu! / details.cpusPerTask!),
+ gpus: details.gpusPerTask!,
},
input: details.inputData
? {
@@ -294,9 +294,9 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
disableCpuBinding: details.disableCpuBinding,
resources: {
tasks: 1,
- cpusPerTask: details.cpuPerTask!,
+ cpusPerTask: details.cpusPerTask!,
memPerCpu: details.memPerCpu!,
- gpusPerTask: details.gpuPerTask!,
+ gpusPerTask: details.gpusPerTask!,
},
command: dedent(details.command!),
},
@@ -311,7 +311,7 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
tasks: details.isVideo ? 4 : 1,
cpusPerTask: 8,
memPerCpu: 8000,
- gpusPerTask: 1,
+ gpus: details.isVideo ? 4 : 1,
},
env: [
{ key: 'IS_VIDEO', value: details.isVideo!.toString() },
@@ -489,7 +489,7 @@ export async function resolveJobForm(type: WorkloadType, details: DetailsData):
tasks: 4,
cpusPerTask: 8,
memPerCpu: 8000,
- gpusPerTask: 1,
+ gpus: 4,
},
env: [
{