pcm-coordinator/adaptor/pcm_slurm/service/tianhe/converter.go

135 lines
5.0 KiB
Go

package tianhe
/*
#cgo LDFLAGS: -lslurm
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include<slurm/slurm.h>
#include <slurm/slurmdb.h>
#include<slurm/slurm_errno.h>
inline uint8_t uint8_ptr(uint8_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline int8_t int8_ptr(int8_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline uint16_t uint16_ptr(uint16_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline int16_t int16_ptr(int16_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline uint32_t uint32_ptr(uint32_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline int32_t int32_ptr(int32_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline uint64_t uint64_ptr(uint64_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
inline int64_t int64_ptr(int16_t* pointer) {
if (NULL == pointer) {
return -1;}
return *pointer;
}
*/
import "C"
import pbslurm "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/gen/idl"
func Job_info_convert_c_to_go(c_struct *C.struct_job_info) pbslurm.JobInfo {
var go_struct pbslurm.JobInfo
go_struct.Account = C.GoString(c_struct.account)
go_struct.AllocNode = C.GoString(c_struct.alloc_node)
go_struct.AllocSid = uint32(c_struct.alloc_sid)
go_struct.ArrayJobId = uint32(c_struct.array_job_id)
go_struct.ArrayTaskId = uint32(c_struct.array_task_id)
go_struct.AssocId = uint32(c_struct.assoc_id)
go_struct.BatchFlag = uint32(c_struct.batch_flag)
go_struct.BatchHost = C.GoString(c_struct.batch_host)
go_struct.BoardsPerNode = uint32(c_struct.boards_per_node)
go_struct.BatchScript = C.GoString(c_struct.batch_script)
go_struct.Command = C.GoString(c_struct.command)
go_struct.Comment = C.GoString(c_struct.comment)
go_struct.Contiguous = uint32(c_struct.contiguous)
go_struct.CoresPerSocket = uint32(c_struct.cores_per_socket)
go_struct.CpusPerTask = uint32(c_struct.cpus_per_task)
go_struct.Dependency = C.GoString(c_struct.dependency)
go_struct.DerivedEc = uint32(c_struct.derived_ec)
go_struct.EligibleTime = int64(c_struct.eligible_time)
go_struct.EndTime = int64(c_struct.end_time)
go_struct.ExcNodes = C.GoString(c_struct.exc_nodes)
go_struct.ExcNodeInx = int32(C.int32_ptr(c_struct.exc_node_inx))
go_struct.ExitCode = uint32(c_struct.exit_code)
go_struct.Features = C.GoString(c_struct.features)
go_struct.GroupId = uint32(c_struct.group_id)
go_struct.Gres = C.GoString(c_struct.gres)
go_struct.JobId = uint32(c_struct.job_id)
go_struct.JobState = uint32(c_struct.job_state)
go_struct.Licenses = C.GoString(c_struct.licenses)
go_struct.MaxCpus = uint32(c_struct.max_cpus)
go_struct.MaxNodes = uint32(c_struct.max_nodes)
go_struct.Name = C.GoString(c_struct.name)
go_struct.Network = C.GoString(c_struct.network)
go_struct.Nodes = C.GoString(c_struct.nodes)
go_struct.Nice = uint32(c_struct.nice)
go_struct.NodeInx = int32(C.int32_ptr(c_struct.node_inx))
go_struct.NtasksPerCore = uint32(c_struct.ntasks_per_core)
go_struct.NtasksPerNode = uint32(c_struct.ntasks_per_node)
go_struct.NtasksPerSocket = uint32(c_struct.ntasks_per_socket)
go_struct.NtasksPerBoard = uint32(c_struct.ntasks_per_board)
go_struct.NumCpus = uint32(c_struct.num_cpus)
go_struct.NumNodes = uint32(c_struct.num_nodes)
go_struct.Partition = C.GoString(c_struct.partition)
go_struct.PnMinMemory = uint32(c_struct.pn_min_memory)
go_struct.PnMinCpus = uint32(c_struct.pn_min_cpus)
go_struct.PnMinTmpDisk = uint32(c_struct.pn_min_tmp_disk)
go_struct.PreemptTime = int64(c_struct.preempt_time)
go_struct.PreSusTime = int64(c_struct.pre_sus_time)
go_struct.Priority = uint32(c_struct.priority)
go_struct.Profile = uint32(c_struct.profile)
go_struct.Qos = C.GoString(c_struct.qos)
go_struct.ReqNodes = C.GoString(c_struct.req_nodes)
go_struct.ReqNodeInx = int32(C.int32_ptr(c_struct.req_node_inx))
go_struct.ReqSwitch = uint32(c_struct.req_switch)
go_struct.Requeue = uint32(c_struct.requeue)
go_struct.ResizeTime = int64(c_struct.resize_time)
go_struct.RestartCnt = uint32(c_struct.restart_cnt)
go_struct.ResvName = C.GoString(c_struct.resv_name)
go_struct.Shared = uint32(c_struct.shared)
go_struct.ShowFlags = uint32(c_struct.show_flags)
go_struct.SocketsPerBoard = uint32(c_struct.sockets_per_board)
go_struct.SocketsPerNode = uint32(c_struct.sockets_per_node)
go_struct.StartTime = int64(c_struct.start_time)
go_struct.StateDesc = C.GoString(c_struct.state_desc)
go_struct.StateReason = uint32(c_struct.state_reason)
go_struct.SubmitTime = int64(c_struct.submit_time)
go_struct.SuspendTime = int64(c_struct.suspend_time)
go_struct.TimeLimit = uint32(c_struct.time_limit)
go_struct.TimeMin = uint32(c_struct.time_min)
go_struct.ThreadsPerCore = uint32(c_struct.threads_per_core)
go_struct.UserId = uint32(c_struct.user_id)
go_struct.Wait4Switch = uint32(c_struct.wait4switch)
go_struct.Wckey = C.GoString(c_struct.wckey)
go_struct.WorkDir = C.GoString(c_struct.work_dir)
return go_struct
}