合約跟單(火幣/幣安/OK/OKEX歐易交易所)系統開發詳細及分析丨原始碼功能

xiaofufu發表於2023-04-13

  What are the functions of the contract tracking system?


  1.A high concurrency system that can support tens of millions of TPS per second,of course,this refers to pure ordering.The specific transaction process also includes matchmaking and clearing,among which clearing is the most time-consuming and poses the greatest challenge to the stability of the system.


  2.High availability backup system:It is completely consistent with the main system architecture.If network line failure occurs due to instantaneous high traffic,we can switch to the backup system within a few minutes.


  3.API limit:This is a self stability protection mechanism when the system is overloaded.


  關於區塊鏈專案技術開發唯:MrsFu123,代幣發行、dapp智慧合約開發、鏈遊開發、單雙幣質押、多鏈錢包開發、NFT盲盒遊戲、公鏈、鏈上游戲開發


  Uniswap博餅、交易所開發、量化合約開發、合約對沖、互助遊戲開發、Nft數字藏品開發、眾籌互助開發、元宇宙開發、swap開發、DAO智慧合約、


  夾子合約、鏈上合約開發、ido開發、商城開發等,開發過各種各樣的系統模式,更有多種模式、制度、案例、後臺等,成熟技術團隊,歡迎實體參考。


  區塊鏈的核心——分散式和儲存不依賴於中心化的硬體或管理機構,在區塊鏈中的所有節點的許可權和義務都是對等的,因此,每個結果也能夠參與到資料的記錄和維護。它區別於傳統資料結構中對“中心”的依賴,能夠實現點對點的資料傳輸和實時的資料記錄,效率更高、速度更快。


  從本質上看,開發邏輯及原始碼為:yy625019,區塊鏈是以分散式資料儲存、點對點傳輸、共識機制、加密演算法、,智慧合約等計算機技術整合創新而產生的分散式賬本技術,是基於網際網路的分散式資料庫,具有去中心化、共識機制、不可篡改、可以追溯、規則透明等特點,


  int main(int argc,const char*argv[]){


  if(argc<4){


  DLOG(INFO)<<"Usage:./quantized.out src.mnn dst.mnn preTreatConfig.jsonn";


  return 0;


  }


  const char*modelFile=argv[1];


  const char*preTreatConfig=argv[3];


  const char*dstFile=argv[2];


  DLOG(INFO)<<">>>modelFile:"<<modelFile;


  DLOG(INFO)<<">>>preTreatConfig:"<<preTreatConfig;


  DLOG(INFO)<<">>>dstFile:"<<dstFile;


  //載入待量化的模型


  std::unique_ptr<MNN::NetT>netT;


  {


  std::ifstream input(modelFile);


  std::ostringstream outputOs;


  outputOs<<input.rdbuf();


  netT=MNN::UnPackNet(outputOs.str().c_str());


  }


  //temp build net for inference


  flatbuffers::FlatBufferBuilder builder(1024);


  auto offset=MNN::Net::Pack(builder,netT.get());


  builder.Finish(offset);


  int size=builder.GetSize();


  auto ocontent=builder.GetBufferPointer();


  //model buffer for creating mnn Interpreter


  std::unique_ptr<uint8_t>modelForInference(new uint8_t[size]);


  memcpy(modelForInference.get(),ocontent,size);


  std::unique_ptr<uint8_t>modelOriginal(new uint8_t[size]);


  memcpy(modelOriginal.get(),ocontent,size);


  netT.reset();


  netT=MNN::UnPackNet(modelOriginal.get());


  //quantize model's weight


  DLOG(INFO)<<"Calibrate the feature and quantize model...";


  //構建Calibration物件,負責量化


  std::shared_ptr<Calibration>calibration(


  new Calibration(netT.get(),modelForInference.get(),size,preTreatConfig));


  //執行量化,更新引數為int8


  calibration->runQuantizeModel();


  //將量化的引數寫入json檔案


  calibration->dumpTensorScales(dstFile);


  DLOG(INFO)<<"Quantize model done!";


  //儲存量化後的模型


  flatbuffers::FlatBufferBuilder builderOutput(1024);


  builderOutput.ForceDefaults(true);


  auto len=MNN::Net::Pack(builderOutput,netT.get());


  builderOutput.Finish(len);


  {


  std::ofstream output(dstFile);


  output.write((const char*)builderOutput.GetBufferPointer(),builderOutput.GetSize());


  }


  return 0;


  }


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69956839/viewspace-2945540/,如需轉載,請註明出處,否則將追究法律責任。

相關文章